Skip to content

Commit

Permalink
EntityFromIdArgs: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mabar committed May 20, 2023
1 parent 126250b commit c1e6c78
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/Unit/Rules/EntityFromIdArgsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php declare(strict_types = 1);

namespace Tests\OriNextras\ObjectMapper\Unit\Rules;

use OriNextras\ObjectMapper\Rules\EntityFromIdArgs;
use Orisai\ObjectMapper\Args\EmptyArgs;
use Orisai\ObjectMapper\Meta\Runtime\RuleRuntimeMeta;
use Orisai\ObjectMapper\Rules\MixedRule;
use PHPUnit\Framework\TestCase;
use Tests\OriNextras\ObjectMapper\Doubles\TestEntity;
use function serialize;
use function unserialize;

final class EntityFromIdArgsTest extends TestCase
{

public function test(): void
{
$idRule = new RuleRuntimeMeta(MixedRule::class, new EmptyArgs());
$args = new EntityFromIdArgs('name', TestEntity::class, $idRule);

self::assertSame('name', $args->name);
self::assertSame(TestEntity::class, $args->entity);
self::assertSame($idRule, $args->idRule);

self::assertEquals(
unserialize(serialize($args)),
$args,
);
}

}

0 comments on commit c1e6c78

Please sign in to comment.