Skip to content

Commit

Permalink
Fix translations paths for Codeception runs
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Fedurtsya <[email protected]>
  • Loading branch information
Sieg committed Oct 6, 2024
1 parent b57923f commit 9b1e2d0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

"tests-codeception": [
"Composer\\Config::disableProcessTimeout",
"THEME_ID=twig MODULE_IDS=fa_nutrition_facts SHOP_ROOT_PATH=/var/www vendor/bin/codecept run Acceptance -c tests/codeception.yml --no-redirect"
"THEME_ID=twig MODULE_IDS=fa_nutrition_facts vendor/bin/codecept run Acceptance -c tests/codeception.yml --no-redirect"
],

"tests-all": [
Expand Down
8 changes: 5 additions & 3 deletions tests/Codeception/Acceptance.suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ modules:
- \OxidEsales\Codeception\Module\Translation\TranslationsModule:
shop_path: '%SHOP_SOURCE_PATH%'
paths:
- Application/views/admin_twig
- Application/views/twig
- ../vendor/fresh-advance/nutrition-facts/views/admin_twig
- 'Application/views/apex'
- '%SOURCE_RELATIVE_PACKAGE_PATH%/translations'
paths_admin:
- 'Application/views/admin_twig'
- '%SOURCE_RELATIVE_PACKAGE_PATH%/views/admin_twig'
- \OxidEsales\Codeception\Module\OxideshopModules

step_decorators:
Expand Down
10 changes: 6 additions & 4 deletions tests/Codeception/Config/params.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@
use OxidEsales\Facts\Facts;
use Symfony\Component\Filesystem\Path;

if ($shopRootPath = getenv('SHOP_ROOT_PATH')) {
require_once($shopRootPath . '/source/bootstrap.php');
}

$facts = new Facts();
return [
'SHOP_URL' => $facts->getShopUrl(),
'SHOP_SOURCE_PATH' => $facts->getSourcePath(),
'SOURCE_RELATIVE_PACKAGE_PATH' => getSourceRelativePackagePath($facts),
'VENDOR_PATH' => $facts->getVendorPath(),
'DB_NAME' => $facts->getDatabaseName(),
'DB_USERNAME' => $facts->getDatabaseUserName(),
Expand All @@ -37,6 +34,11 @@
'SCREEN_SHOT_URL' => getenv('CC_SCREEN_SHOTS_PATH') ?: '',
];

function getSourceRelativePackagePath(Facts $facts): string
{
return str_replace($facts->getShopRootPath(), '..', __DIR__) . '/../../../';
}

function getTestDataDumpFilePath(): string
{
return Path::join(__DIR__, '/../Support/Data', 'generated', 'dump.sql');
Expand Down

0 comments on commit 9b1e2d0

Please sign in to comment.