Skip to content

Commit

Permalink
refactor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
VasekPurchart committed Nov 20, 2024
2 parents 81b5de0 + e570401 commit 876b986
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Consistence\Type\ArrayType\ArrayType;
use Consistence\Type\ArrayType\KeyValuePair;
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\DoctrineExtension;
use PHPUnit\Framework\Assert;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class ConsistenceDoctrineExtensionTest extends \PHPUnit\Framework\TestCase
Expand Down Expand Up @@ -46,8 +47,8 @@ public function testRegisterPostLoadEntityListener(): void
$extension = new ConsistenceDoctrineExtension();
$extension->load([], $containerBuilder);

$this->assertTrue($containerBuilder->has('consistence.doctrine.enum.enum_post_load_entity_listener'));
$this->assertEquals(EnumPostLoadEntityListener::class, $containerBuilder->getDefinition('consistence.doctrine.enum.enum_post_load_entity_listener')->getClass());
Assert::assertTrue($containerBuilder->has('consistence.doctrine.enum.enum_post_load_entity_listener'));
Assert::assertSame(EnumPostLoadEntityListener::class, $containerBuilder->getDefinition('consistence.doctrine.enum.enum_post_load_entity_listener')->getClass());
}

/**
Expand Down Expand Up @@ -80,15 +81,15 @@ private function getDoctrineTypesConfig(): array
private function assertTypes(array $expectedTypes, array $actualTypes): void
{
foreach ($expectedTypes as $typeName => $typeClass) {
$this->assertTrue(ArrayType::containsByCallback(
Assert::assertTrue(ArrayType::containsByCallback(
$actualTypes,
static function (KeyValuePair $keyValuePair) use ($typeName, $typeClass): bool {
return $keyValuePair->getKey() === $typeName
&& $keyValuePair->getValue() === $typeClass;
}
), sprintf('Expected type name: %s, class: %s missing', $typeName, $typeClass));
}
$this->assertCount(count($expectedTypes), $actualTypes);
Assert::assertCount(count($expectedTypes), $actualTypes);
}

}

0 comments on commit 876b986

Please sign in to comment.