Skip to content

Commit

Permalink
Fix IdentifierMapTest
Browse files Browse the repository at this point in the history
  • Loading branch information
JanisVepris committed Jan 29, 2024
1 parent c784b0c commit 19ce798
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/Unit/IdentifierMap/IdentifierMapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,32 @@
use Janisvepris\Gs1Decoder\Exception\IdentifierMap\DuplicateIdentifierCodeException;
use Janisvepris\Gs1Decoder\IdentifierMap\IdentifierMap;
use Janisvepris\Gs1Decoder\Util\AiFinder;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

/** @covers IdentifierMap */
class IdentifierMapTest extends TestCase
{
public function testAllIdentifiersAreInDefaultMap(): void
{
$identifierClasses = AiFinder::all();
$identifierCount = count($identifierClasses);
$identifierClasses = array_filter(
AiFinder::all(),
fn (string $classString) => !is_subclass_of($classString, MockObject::class),
);

$subject = new IdentifierMap();

foreach ($identifierClasses as $identifierClass) {
/** @var ApplicationIdentifierInterface $identifier */
$identifier = new $identifierClass();

static::assertTrue(
$subject->hasIdentifierClass($identifier->getCode()),
sprintf('Identifier class "%s" is not in default map', $identifierClass),
);
}

static::assertSame($identifierCount, $subject->getElementCount());
static::assertSame(count($identifierClasses), $subject->getElementCount());
}

public function testInitializeWithCustomMap(): void
Expand Down

0 comments on commit 19ce798

Please sign in to comment.