29 lines
810 B
PHP
29 lines
810 B
PHP
<?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]);
|
|
}
|
|
}
|