Skip to content

Commit

Permalink
Test EntityID too
Browse files Browse the repository at this point in the history
  • Loading branch information
PowerKiKi committed Dec 8, 2023
1 parent 3cd54ca commit 84b1db7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/UtilityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,22 @@ public function getEntity(): object
public function testModelToId(): void
{
$input = [
'entity' => new class() implements Model {
3 => new stdClass(),
'model' => new class() implements Model {
public function getId(): ?int
{
return 123456;
}
},
4 => 1,
'entityId' => new EntityID(_em(), User::class, '456'),
];

$actual = Utility::modelToId($input);

$expected = $input;
$expected['entity'] = 123456;
$expected['model'] = 123456;
$expected['entityId'] = '456';

self::assertSame($expected, $actual, 'models must be replaced by their ids, other values should be preserved');
}
Expand Down

0 comments on commit 84b1db7

Please sign in to comment.