Skip to content

Commit dd6a74f

Browse files
committed
Add use to make code shorter
1 parent 6ff6c73 commit dd6a74f

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

tests/Columns/UnitEnumColumnTest.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Composite\Entity\Tests\Columns;
44

55
use Composite\Entity\AbstractEntity;
6+
use Composite\Entity\Tests\TestStand\TestUnitEnum;
67

78
final class UnitEnumColumnTest extends \PHPUnit\Framework\TestCase
89
{
@@ -19,19 +20,19 @@ public static function cast_dataProvider(): array
1920
],
2021
[
2122
'value' => 'Foo',
22-
'expected' => \Composite\Entity\Tests\TestStand\TestUnitEnum::Foo,
23+
'expected' => TestUnitEnum::Foo,
2324
],
2425
[
2526
'value' => 'Bar',
26-
'expected' => \Composite\Entity\Tests\TestStand\TestUnitEnum::Bar,
27+
'expected' => TestUnitEnum::Bar,
2728
],
2829
[
29-
'value' => \Composite\Entity\Tests\TestStand\TestUnitEnum::Foo,
30-
'expected' => \Composite\Entity\Tests\TestStand\TestUnitEnum::Foo,
30+
'value' => TestUnitEnum::Foo,
31+
'expected' => TestUnitEnum::Foo,
3132
],
3233
[
33-
'value' => \Composite\Entity\Tests\TestStand\TestUnitEnum::Bar,
34-
'expected' => \Composite\Entity\Tests\TestStand\TestUnitEnum::Bar,
34+
'value' => TestUnitEnum::Bar,
35+
'expected' => TestUnitEnum::Bar,
3536
],
3637
[
3738
'value' => 'non-exist',
@@ -43,11 +44,11 @@ public static function cast_dataProvider(): array
4344
/**
4445
* @dataProvider cast_dataProvider
4546
*/
46-
public function test_cast(mixed $value, ?\Composite\Entity\Tests\TestStand\TestUnitEnum $expected): void
47+
public function test_cast(mixed $value, ?TestUnitEnum $expected): void
4748
{
4849
$class = new class extends AbstractEntity {
4950
public function __construct(
50-
public ?\Composite\Entity\Tests\TestStand\TestUnitEnum $column = null,
51+
public ?TestUnitEnum $column = null,
5152
) {}
5253
};
5354
$entity = $class::fromArray(['column' => $value]);
@@ -62,11 +63,11 @@ public static function uncast_dataProvider(): array
6263
'expected' => null,
6364
],
6465
[
65-
'value' => \Composite\Entity\Tests\TestStand\TestUnitEnum::Foo,
66+
'value' => TestUnitEnum::Foo,
6667
'expected' => 'Foo',
6768
],
6869
[
69-
'value' => \Composite\Entity\Tests\TestStand\TestUnitEnum::Bar,
70+
'value' => TestUnitEnum::Bar,
7071
'expected' => 'Bar',
7172
],
7273
];
@@ -79,7 +80,7 @@ public function test_uncast(mixed $value, mixed $expected): void
7980
{
8081
$entity = new class($value) extends AbstractEntity {
8182
public function __construct(
82-
public ?\Composite\Entity\Tests\TestStand\TestUnitEnum $column,
83+
public ?TestUnitEnum $column,
8384
) {}
8485
};
8586
$actual = $entity->toArray()['column'];

0 commit comments

Comments
 (0)