Skip to content

Commit

Permalink
[Tests] Provided autoconfiguration for API integration tests (#2534)
Browse files Browse the repository at this point in the history
  • Loading branch information
alongosz committed Feb 19, 2019
1 parent c53d48d commit 9e06bc9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Repository/Tests/BaseTest.php
Expand Up @@ -11,6 +11,7 @@
use Doctrine\DBAL\Connection;
use eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException;
use eZ\Publish\API\Repository\Tests\PHPUnitConstraint\ValidationErrorOccurs as PHPUnitConstraintValidationErrorOccurs;
use eZ\Publish\API\Repository\Tests\SetupFactory\Legacy;
use eZ\Publish\API\Repository\Values\Content\Language;
use EzSystems\EzPlatformSolrSearchEngine\Tests\SetupFactory\LegacySetupFactory as LegacySolrSetupFactory;
use PHPUnit\Framework\TestCase;
Expand Down Expand Up @@ -162,12 +163,13 @@ protected function getRepository($initialInitializeFromScratch = true)
protected function getSetupFactory()
{
if (null === $this->setupFactory) {
$setupClass = getenv('setupFactory');
if (false === ($setupClass = getenv('setupFactory'))) {
$setupClass = Legacy::class;
putenv("setupFactory=${setupClass}");
}

if (false === $setupClass) {
throw new \ErrorException(
'Missing mandatory environment variable "setupFactory", this should normally be set in the relevant phpunit-integration-*.xml file and refer to a setupFactory for the given StorageEngine/SearchEngine in use'
);
if (false === ($fixtureDir = getenv('fixtureDir'))) {
putenv('fixtureDir=Legacy');
}

if (false === class_exists($setupClass)) {
Expand Down

0 comments on commit 9e06bc9

Please sign in to comment.