Skip to content

Commit

Permalink
Exposed getSchemaFiles & getFixtures methods in IbexaTestKernel
Browse files Browse the repository at this point in the history
  • Loading branch information
Steveb-p committed Feb 10, 2022
1 parent 0106c4a commit cdf5312
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/contracts/Test/IbexaKernelTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
use eZ\Publish\Core\Repository\Values\User\UserReference;
use eZ\Publish\SPI\Persistence\TransactionHandler;
use eZ\Publish\SPI\Tests\Persistence\FixtureImporter;
use eZ\Publish\SPI\Tests\Persistence\YamlFixture;
use LogicException;
use RuntimeException;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
Expand Down Expand Up @@ -55,11 +54,11 @@ final protected static function loadSchema(): void
}

/**
* @return array<string>
* @return iterable<string>
*/
protected static function getSchemaFiles(): iterable
{
yield self::$kernel->locateResource('@EzPublishCoreBundle/Resources/config/storage/legacy/schema.yaml');
yield from self::$kernel->getSchemaFiles();
}

final protected static function loadFixtures(): void
Expand All @@ -82,7 +81,7 @@ protected static function postLoadFixtures(): void
*/
protected static function getFixtures(): iterable
{
yield new YamlFixture(dirname(__DIR__, 3) . '/eZ/Publish/API/Repository/Tests/_fixtures/Legacy/data/test_data.yaml');
yield from self::$kernel->getFixtures();
}

/**
Expand Down
17 changes: 17 additions & 0 deletions src/contracts/Test/IbexaTestKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use eZ\Bundle\EzPublishLegacySearchEngineBundle\EzPublishLegacySearchEngineBundle;
use eZ\Publish\API\Repository;
use eZ\Publish\SPI\Persistence\TransactionHandler;
use eZ\Publish\SPI\Tests\Persistence\YamlFixture;
use FOS\JsRoutingBundle\FOSJsRoutingBundle;
use JMS\TranslationBundle\JMSTranslationBundle;
use Liip\ImagineBundle\LiipImagineBundle;
Expand Down Expand Up @@ -97,6 +98,22 @@ public static function getAliasServiceId(string $id): string
return 'test.' . $id;
}

/**
* @return iterable<string>
*/
public function getSchemaFiles(): iterable
{
yield $this->locateResource('@EzPublishCoreBundle/Resources/config/storage/legacy/schema.yaml');
}

/**
* @return iterable<\eZ\Publish\SPI\Tests\Persistence\Fixture>
*/
public function getFixtures(): iterable
{
yield new YamlFixture(dirname(__DIR__, 3) . '/eZ/Publish/API/Repository/Tests/_fixtures/Legacy/data/test_data.yaml');
}

public function getCacheDir(): string
{
return sys_get_temp_dir() . '/ibexa-test-kernel/' . md5(serialize(getenv())) . md5(static::class);
Expand Down

0 comments on commit cdf5312

Please sign in to comment.