Skip to content

Commit

Permalink
[FIX] The test setup for ci ... finally
Browse files Browse the repository at this point in the history
  • Loading branch information
cngJo committed Nov 7, 2023
1 parent 203b63a commit 8e6e956
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions tests/TestBootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,24 @@
*/
use Shopware\Core\TestBootstrapper;

$ci = false;
$projectDir = $_SERVER['SHOPWARE_BUILD_DIR'] ?? null;
if (!$projectDir) {
$projectDir = dirname(__DIR__, 4);
}

if (is_readable('/opt/share/shopware/tests/TestBootstrapper.php')) {
// For Docker image: ghcr.io/friendsofshopware/platform-plugin-dev
$testBootstrapper = require '/opt/share/shopware/tests/TestBootstrapper.php';
$ci = true;
} else if (is_readable(__DIR__ . '/../vendor/shopware/platform/src/Core/TestBootstrapper.php')) {
if (is_readable(__DIR__ . '/../vendor/shopware/platform/src/Core/TestBootstrapper.php')) {
require __DIR__ . '/../vendor/shopware/platform/src/Core/TestBootstrapper.php';
} elseif (is_readable(__DIR__ . '/../vendor/shopware/core/TestBootstrapper.php')) {
} else if (is_readable(__DIR__ . '/../vendor/shopware/core/TestBootstrapper.php')) {
require __DIR__ . '/../vendor/shopware/core/TestBootstrapper.php';
} else {
// vendored from platform, only use local TestBootstrapper if not already defined in platform
require __DIR__ . '/TestBootstrapper.php';
}

if ($ci) {
$classAutoloader = require '/opt/shopware/vendor/autoload.php';
} else {
$classAutoloader = require dirname(__DIR__) . '/vendor/autoload.php';
}
$classAutoloader = require dirname(__DIR__) . '/vendor/autoload.php';

return (new TestBootstrapper())
->setProjectDir($_SERVER['PROJECT_ROOT'] ?? dirname(__DIR__, 4))
->setProjectDir($projectDir)
->setLoadEnvFile(true)
->setForceInstallPlugins(true)
->addActivePlugins('MobiMamoConnector')
Expand Down

0 comments on commit 8e6e956

Please sign in to comment.