Version 1.0.0
This commit is contained in:
24
tests/Object/ItemTest.php
Normal file
24
tests/Object/ItemTest.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Diffhead\PHP\DataEnrichmentKit\Interface;
|
||||
|
||||
use Diffhead\PHP\DataEnrichmentKit\Object\Item;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\CoversMethod;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
#[CoversClass(Item::class)]
|
||||
#[CoversMethod(Item::class, 'key')]
|
||||
#[CoversMethod(Item::class, 'alias')]
|
||||
class ItemTest extends TestCase
|
||||
{
|
||||
public function testProperlyInitialized(): void
|
||||
{
|
||||
$item = new Item('key', 'alias');
|
||||
|
||||
$this->assertEquals('key', $item->key());
|
||||
$this->assertEquals('alias', $item->alias());
|
||||
}
|
||||
}
|
||||
28
tests/Object/ItemsBagTest.php
Normal file
28
tests/Object/ItemsBagTest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Diffhead\PHP\DataEnrichmentKit\Tests\Object;
|
||||
|
||||
use Diffhead\PHP\DataEnrichmentKit\Object\Item;
|
||||
use Diffhead\PHP\DataEnrichmentKit\Object\ItemsBag;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\CoversMethod;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
#[CoversClass(ItemsBag::class)]
|
||||
#[CoversMethod(ItemsBag::class, 'push')]
|
||||
#[CoversMethod(ItemsBag::class, 'getIterator')]
|
||||
class ItemsBagTest extends TestCase
|
||||
{
|
||||
public function testProperlyInitialized(): void
|
||||
{
|
||||
$itemsBag = new ItemsBag();
|
||||
$item = new Item('key', 'alias');
|
||||
|
||||
$itemsBag->push($item);
|
||||
|
||||
$this->assertCount(1, iterator_to_array($itemsBag->getIterator()));
|
||||
$this->assertSame($item, iterator_to_array($itemsBag->getIterator())[0]);
|
||||
}
|
||||
}
|
||||
28
tests/Object/RequestTest.php
Normal file
28
tests/Object/RequestTest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Diffhead\PHP\DataEnrichmentKit\Tests\Object;
|
||||
|
||||
use Diffhead\PHP\DataEnrichmentKit\Object\ItemsBag;
|
||||
use Diffhead\PHP\DataEnrichmentKit\Object\Request;
|
||||
use Diffhead\PHP\DataEnrichmentKit\Object\Target;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\CoversMethod;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
#[CoversClass(Request::class)]
|
||||
#[CoversMethod(Request::class, 'items')]
|
||||
#[CoversMethod(Request::class, 'target')]
|
||||
class RequestTest extends TestCase
|
||||
{
|
||||
public function testProperlyInitialized(): void
|
||||
{
|
||||
$itemsBag = new ItemsBag();
|
||||
$target = new Target('entity', 'field');
|
||||
$request = new Request($itemsBag, $target);
|
||||
|
||||
$this->assertSame($itemsBag, $request->items());
|
||||
$this->assertSame($target, $request->target());
|
||||
}
|
||||
}
|
||||
24
tests/Object/TargetTest.php
Normal file
24
tests/Object/TargetTest.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Diffhead\PHP\DataEnrichmentKit\Tests\Object;
|
||||
|
||||
use Diffhead\PHP\DataEnrichmentKit\Object\Target;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\CoversMethod;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
#[CoversClass(Target::class)]
|
||||
#[CoversMethod(Target::class, 'entity')]
|
||||
#[CoversMethod(Target::class, 'field')]
|
||||
class TargetTest extends TestCase
|
||||
{
|
||||
public function testProperlyInitialized(): void
|
||||
{
|
||||
$target = new Target('entity', 'field');
|
||||
|
||||
$this->assertEquals('entity', $target->entity());
|
||||
$this->assertEquals('field', $target->field());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user