Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposed getSchemaFiles & getFixtures methods in IbexaTestKernel #284

Merged
merged 2 commits into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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