Skip to content

Commit

Permalink
Removed IbexaKernelTestTrait changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Steveb-p committed Dec 23, 2024
1 parent bb2634f commit 9810bfc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
13 changes: 5 additions & 8 deletions src/contracts/Test/IbexaKernelTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,20 @@ protected static function getFixtures(): iterable
*
* @return T
*/
final protected static function getServiceByClassName(
string $className,
?string $id = null,
bool $prefix = true
): object {
final protected static function getServiceByClassName(string $className, ?string $id = null): object
{
if (!self::$booted) {
static::bootKernel();
}

$serviceId = self::getTestServiceId($id, $className, $prefix);
$serviceId = self::getTestServiceId($id, $className);
$service = self::getContainer()->get($serviceId);
assert(is_object($service) && is_a($service, $className));

return $service;
}

protected static function getTestServiceId(?string $id, string $className, bool $prefix = true): string
protected static function getTestServiceId(?string $id, string $className): string
{
$kernel = self::$kernel;
if (!$kernel instanceof IbexaTestKernelInterface) {
Expand All @@ -105,7 +102,7 @@ protected static function getTestServiceId(?string $id, string $className, bool

$id = $id ?? $className;

return $prefix ? $kernel->getAliasServiceId($id) : $id;
return $kernel->getAliasServiceId($id);
}

protected static function getDoctrineConnection(): Connection
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/Core/Repository/SerializationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ protected function setUp(): void

public function testSerialization(): void
{
$serializer = self::getServiceByClassName(SerializerInterface::class, 'serializer', false);
$serializer = $this->getContainer()->get(SerializerInterface::class);
self::assertInstanceOf(SerializerInterface::class, $serializer);
$contentService = self::getContentService();

$user = $contentService->loadContent(14);
Expand Down

0 comments on commit 9810bfc

Please sign in to comment.