diff --git a/composer.json b/composer.json index 4273292..883d6a8 100644 --- a/composer.json +++ b/composer.json @@ -77,7 +77,7 @@ "codeception": [ "Composer\\Config::disableProcessTimeout", - "MODULE_IDS=oe_graphql_base,oe_graphql_configuration_access /var/www/vendor/bin/codecept run acceptance -c /var/www/vendor/oxid-esales/graphql-configuration-access/tests/codeception.yml --no-redirect" + "MODULE_IDS=oe_graphql_base,oe_graphql_configuration_access SHOP_ROOT_PATH=/var/www vendor/bin/codecept run acceptance -c /var/www/vendor/oxid-esales/graphql-configuration-access/tests/codeception.yml --no-redirect" ] }, "config": { diff --git a/tests/Codeception/Acceptance/_bootstrap.php b/tests/Codeception/Acceptance/_bootstrap.php index be9db0e..e32d091 100644 --- a/tests/Codeception/Acceptance/_bootstrap.php +++ b/tests/Codeception/Acceptance/_bootstrap.php @@ -11,4 +11,5 @@ use Symfony\Component\Filesystem\Path; -require_once Path::join((new \OxidEsales\Facts\Facts())->getShopRootPath(), 'source', 'bootstrap.php'); +$sourcePath = getenv('SHOP_ROOT_PATH') ?: (new \OxidEsales\Facts\Facts())->getShopRootPath(); +require_once Path::join($sourcePath, 'source', 'bootstrap.php'); diff --git a/tests/Codeception/Config/params.php b/tests/Codeception/Config/params.php index 13f8241..9574916 100644 --- a/tests/Codeception/Config/params.php +++ b/tests/Codeception/Config/params.php @@ -12,7 +12,7 @@ use OxidEsales\Facts\Facts; use Symfony\Component\Filesystem\Path; -$facts = new Facts(); +$facts = new Facts(configFile: getConfigFile()); return [ 'SHOP_URL' => $facts->getShopUrl(), 'SHOP_SOURCE_PATH' => $facts->getSourcePath(), @@ -59,10 +59,16 @@ function getTestFixtureSqlFilePath(): string function getMysqlConfigPath() { - $facts = new Facts(); - $configFilePath = Path::join($facts->getSourcePath(), 'config.inc.php'); - $configFile = new ConfigFile($configFilePath); + $configFile = getConfigFile(); $generator = new DatabaseDefaultsFileGenerator($configFile); return $generator->generate(); } + +function getConfigFile(): ConfigFile +{ + $facts = new Facts(); + $sourcePath = getenv('SHOP_ROOT_PATH') ?: $facts->getShopRootPath(); + $configFilePath = Path::join($sourcePath, 'source', 'config.inc.php'); + return new ConfigFile($configFilePath); +}