Skip to content

Commit

Permalink
Cleanup SHOP_ROOT_PATH constant usage cases
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Fedurtsya <[email protected]>
  • Loading branch information
Sieg committed Mar 21, 2024
1 parent 10bac1d commit f9e4e62
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
5 changes: 0 additions & 5 deletions tests/Codeception/Acceptance/_bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,3 @@
declare(strict_types=1);

// This is acceptance bootstrap

use Symfony\Component\Filesystem\Path;

$sourcePath = getenv('SHOP_ROOT_PATH') ?: (new \OxidEsales\Facts\Facts())->getShopRootPath();
require_once Path::join($sourcePath, 'source', 'bootstrap.php');
18 changes: 8 additions & 10 deletions tests/Codeception/Config/params.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
use OxidEsales\Facts\Facts;
use Symfony\Component\Filesystem\Path;

$facts = new Facts(configFile: getConfigFile());
if ($shopRootPath = getenv('SHOP_ROOT_PATH')){
include(Path::join($shopRootPath, 'source', 'bootstrap.php'));
}

$facts = new Facts();
return [
'SHOP_URL' => $facts->getShopUrl(),
'SHOP_SOURCE_PATH' => $facts->getSourcePath(),
Expand Down Expand Up @@ -59,16 +63,10 @@ function getTestFixtureSqlFilePath(): string

function getMysqlConfigPath()
{
$configFile = getConfigFile();
$facts = new Facts();
$configFilePath = Path::join($facts->getSourcePath(), 'config.inc.php');
$configFile = new ConfigFile($configFilePath);
$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 f9e4e62

Please sign in to comment.