-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Deeka Wong <[email protected]>
- Loading branch information
1 parent
317eaa3
commit dafe7db
Showing
2 changed files
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
* @document https://github.com/friendsofhyperf/components/blob/main/README.md | ||
* @contact [email protected] | ||
*/ | ||
use FriendsOfHyperf\Tests\ValidatedDTO\Datasets\AttributesDTO; | ||
use FriendsOfHyperf\Tests\ValidatedDTO\Datasets\CallableCastingDTOInstance; | ||
use FriendsOfHyperf\Tests\ValidatedDTO\Datasets\SimpleDTOInstance; | ||
use FriendsOfHyperf\Tests\ValidatedDTO\Datasets\SimpleMapBeforeExportDTO; | ||
|
@@ -284,3 +285,15 @@ public function __construct(protected string $subject_name) | |
->and($dto->age) | ||
->toBe(30); | ||
}); | ||
|
||
it('checks that update for property reflects while converting DTO', function () { | ||
$dto = AttributesDTO::fromArray([ | ||
'age' => 18, | ||
'doc' => 'test', | ||
]); | ||
|
||
$dto->age = 20; | ||
|
||
expect($dto->age)->toBe(20) | ||
->and($dto->toArray())->toBe(['age' => 20, 'doc' => 'test']); | ||
}); |