Skip to content

Commit

Permalink
Improve Map attribute tests (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik committed May 25, 2023
1 parent e392eb6 commit fcebe68
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 41 deletions.
6 changes: 3 additions & 3 deletions tests/Attribute/Data/MapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function testBase(): void
{
$hydrator = new Hydrator(new SimpleContainer());

$object = $hydrator->create(MapClass::class);
$object = $hydrator->create(MapClass::class, ['x' => 1, 'y' => 2]);

$this->assertSame('1', $object->a);
$this->assertSame('2', $object->b);
Expand All @@ -32,7 +32,7 @@ public function testStrict(): void
{
$hydrator = new Hydrator(new SimpleContainer());

$object = $hydrator->create(MapStrictClass::class);
$object = $hydrator->create(MapStrictClass::class, ['a' => 1, 'y' => 2, 'c' => 3]);

$this->assertSame('1', $object->a);
$this->assertSame('2', $object->b);
Expand All @@ -43,7 +43,7 @@ public function testNonStrict(): void
{
$hydrator = new Hydrator(new SimpleContainer());

$object = $hydrator->create(MapNonStrictClass::class, strict: true);
$object = $hydrator->create(MapNonStrictClass::class, ['a' => 1, 'y' => 2, 'c' => 3], strict: true);

$this->assertSame('1', $object->a);
$this->assertSame('2', $object->b);
Expand Down
5 changes: 0 additions & 5 deletions tests/Support/Classes/MapClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@
namespace Yiisoft\Hydrator\Tests\Support\Classes;

use Yiisoft\Hydrator\Attribute\Data\Map;
use Yiisoft\Hydrator\Tests\Support\CustomData;

#[CustomData([
'x' => 1,
'y' => 2,
])]
#[Map([
'a' => 'x',
'b' => 'y',
Expand Down
2 changes: 0 additions & 2 deletions tests/Support/Classes/MapNonStrictClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
namespace Yiisoft\Hydrator\Tests\Support\Classes;

use Yiisoft\Hydrator\Attribute\Data\Map;
use Yiisoft\Hydrator\Tests\Support\CustomData;

#[CustomData(['a' => 1, 'y' => 2, 'c' => 3])]
#[Map(['b' => 'y'], false)]
final class MapNonStrictClass
{
Expand Down
2 changes: 0 additions & 2 deletions tests/Support/Classes/MapStrictClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
namespace Yiisoft\Hydrator\Tests\Support\Classes;

use Yiisoft\Hydrator\Attribute\Data\Map;
use Yiisoft\Hydrator\Tests\Support\CustomData;

#[CustomData(['a' => 1, 'y' => 2, 'c' => 3])]
#[Map(['a' => 'a', 'b' => 'y'], true)]
final class MapStrictClass
{
Expand Down
29 changes: 0 additions & 29 deletions tests/Support/CustomData.php

This file was deleted.

0 comments on commit fcebe68

Please sign in to comment.