Skip to content

Commit

Permalink
OXDEV-7845: Adjust shop root path for codeception tests with SHOP_ROO…
Browse files Browse the repository at this point in the history
…T_PATH env
  • Loading branch information
MarcelOxid committed Mar 14, 2024
1 parent 01dd250 commit 10bac1d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion tests/Codeception/Acceptance/_bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
14 changes: 10 additions & 4 deletions tests/Codeception/Config/params.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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);
}

0 comments on commit 10bac1d

Please sign in to comment.