Skip to content

Commit 95faf0b

Browse files
Merge pull request #39 from falahatiali/main
tests :: refactor some tests
2 parents 0645330 + 6849b6f commit 95faf0b

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

tests/Unit/ArrayCastTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use WendellAdriel\ValidatedDTO\Casting\ArrayCast;
66

7-
it('properly casts from json strign to array')
7+
it('properly casts from json string to array')
88
->expect(fn () => new ArrayCast())
99
->cast(test_property(), '{"name": "John Doe", "email": "john.doe@example.com"}')
1010
->toBe(['name' => 'John Doe', 'email' => 'john.doe@example.com']);

tests/Unit/ValidatedDTOInstanceTest.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,13 @@
1313
$castable = new DTOCast(ValidatedDTOInstance::class);
1414

1515
expect($castable)->cast(test_property(), '{"name": "John Doe", "age": 30}')
16-
->toBeInstanceOf(ValidatedDTO::class);
17-
18-
expect($castable)->cast(test_property(), '{"name": "John Doe", "age": 30}')
16+
->toBeInstanceOf(ValidatedDTO::class)
17+
->and($castable)->cast(test_property(), '{"name": "John Doe", "age": 30}')
1918
->toArray()
20-
->toBe(['name' => 'John Doe', 'age' => 30]);
21-
22-
expect($castable)->cast(test_property(), ['name' => 'John Doe', 'age' => 30])
23-
->toBeInstanceOf(ValidatedDTO::class);
24-
25-
expect($castable)->cast(test_property(), ['name' => 'John Doe', 'age' => 30])
19+
->toBe(['name' => 'John Doe', 'age' => 30])
20+
->and($castable)->cast(test_property(), ['name' => 'John Doe', 'age' => 30])
21+
->toBeInstanceOf(ValidatedDTO::class)
22+
->and($castable)->cast(test_property(), ['name' => 'John Doe', 'age' => 30])
2623
->toArray()
2724
->toEqual(['name' => 'John Doe', 'age' => 30]);
2825

0 commit comments

Comments
 (0)