Skip to content
This repository was archived by the owner on Mar 3, 2025. It is now read-only.

Commit 48ecd40

Browse files
committed
More testing
1 parent 532de90 commit 48ecd40

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tests/CastableDataTransferObjectTest.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Illuminate\Database\Eloquent\Factories\HasFactory;
77
use Illuminate\Database\Eloquent\Model;
88
use Illuminate\Support\Str;
9+
use InvalidArgumentException;
910
use JessArcher\CastableDataTransferObject\CastableDataTransferObject;
1011
use Spatie\DataTransferObject\DataTransferObjectError;
1112

@@ -67,7 +68,7 @@ public function it_json_to_a_data_transfer_object()
6768
}
6869

6970
/** @test */
70-
public function it_throws_exceptions_for_incorrect_data()
71+
public function it_throws_exceptions_for_incorrect_data_structures()
7172
{
7273
$this->expectException(DataTransferObjectError::class);
7374

@@ -78,6 +79,16 @@ public function it_throws_exceptions_for_incorrect_data()
7879
]);
7980
}
8081

82+
/** @test */
83+
public function it_rejects_invalid_types()
84+
{
85+
$this->expectException(InvalidArgumentException::class);
86+
87+
User::factory()->create([
88+
'address' => 'string',
89+
]);
90+
}
91+
8192
/** @test */
8293
public function it_handles_nullable_columns()
8394
{

0 commit comments

Comments
 (0)