Skip to content

Commit

Permalink
Use getenv() to retrieve test testup factory (ezsystems#2397)
Browse files Browse the repository at this point in the history
  • Loading branch information
pspanja authored and andrerom committed Jul 17, 2018
1 parent b0c9201 commit 67603a3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions eZ/Publish/API/Repository/Tests/BaseTest.php
Expand Up @@ -160,17 +160,18 @@ protected function getRepository($initialInitializeFromScratch = true)
protected function getSetupFactory()
{
if (null === $this->setupFactory) {
if (false === isset($_ENV['setupFactory'])) {
$setupClass = getenv('setupFactory');

if (false === $setupClass) {
throw new \ErrorException(
'Missing mandatory setting $_ENV["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'
'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'
);
}

$setupClass = $_ENV['setupFactory'];
if (false === class_exists($setupClass)) {
throw new \ErrorException(
sprintf(
'$_ENV["setupFactory"] does not reference an existing class: %s. Did you forget to install an package dependency?',
'Environment variable "setupFactory" does not reference an existing class: %s. Did you forget to install an package dependency?',
$setupClass
)
);
Expand Down

0 comments on commit 67603a3

Please sign in to comment.