Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/mftf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if (PHP_SAPI !== 'cli') {
}

$autoloadPath = realpath(__DIR__ . '/../../../autoload.php');
$testBootstrapPath = realpath(__DIR__ . '/../dev/tests/functional/_bootstrap.php');
$testBootstrapPath = realpath(__DIR__ . '/../dev/tests/functional/standalone_bootstrap.php');

try {
if (file_exists($autoloadPath)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,31 @@
}

defined('PROJECT_ROOT') || define('PROJECT_ROOT', dirname(dirname(dirname(__DIR__))));

require_once realpath(PROJECT_ROOT . '/vendor/autoload.php');

//Load constants from .env file
defined('FW_BP') || define('FW_BP', PROJECT_ROOT);

// add the debug flag here
$debug_mode = $_ENV['MFTF_DEBUG'] ?? false;
if (!(bool)$debug_mode && extension_loaded('xdebug')) {
xdebug_disable();
}

$RELATIVE_TESTS_MODULE_PATH = '/tests/functional/tests/MFTF';

defined('MAGENTO_BP') || define('MAGENTO_BP', PROJECT_ROOT);
defined('TESTS_BP') || define('TESTS_BP', dirname(dirname(__DIR__)));
defined('TESTS_MODULE_PATH') || define('TESTS_MODULE_PATH', realpath(TESTS_BP . $RELATIVE_TESTS_MODULE_PATH));

if (file_exists(TESTS_BP . DIRECTORY_SEPARATOR . '.env')) {
$env = new \Dotenv\Loader(TESTS_BP . DIRECTORY_SEPARATOR . '.env');
$envFilePath = dirname(dirname(__DIR__));
if (file_exists($envFilePath . DIRECTORY_SEPARATOR . '.env')) {
$env = new \Dotenv\Loader($envFilePath . DIRECTORY_SEPARATOR . '.env');
$env->load();

foreach ($_ENV as $key => $var) {
defined($key) || define($key, $var);
}

if (array_key_exists('MAGENTO_BP', $_ENV)) {
// TODO REMOVE THIS CODE ONCE WE HAVE STOPPED SUPPORTING dev/tests/acceptance PATH
// define TEST_PATH and TEST_MODULE_PATH
defined('TESTS_BP') || define('TESTS_BP', realpath(MAGENTO_BP . DIRECTORY_SEPARATOR . 'dev/tests/acceptance/'));

$RELATIVE_TESTS_MODULE_PATH = '/tests/functional/Magento/FunctionalTest';
defined('TESTS_MODULE_PATH') || define(
'TESTS_MODULE_PATH',
realpath(TESTS_BP . $RELATIVE_TESTS_MODULE_PATH)
);
}

defined('MAGENTO_CLI_COMMAND_PATH') || define(
'MAGENTO_CLI_COMMAND_PATH',
'dev/tests/acceptance/utils/command.php'
Expand All @@ -56,3 +56,17 @@
}

}

defined('FW_BP') || define('FW_BP', PROJECT_ROOT);
defined('MAGENTO_BP') || define('MAGENTO_BP', PROJECT_ROOT);
defined('TESTS_BP') || define('TESTS_BP', dirname(dirname(__DIR__)));

$RELATIVE_TESTS_MODULE_PATH = '/tests/functional/tests/MFTF';
defined('TESTS_MODULE_PATH') || define('TESTS_MODULE_PATH', realpath(TESTS_BP . $RELATIVE_TESTS_MODULE_PATH));


// add the debug flag here
$debug_mode = $_ENV['MFTF_DEBUG'] ?? false;
if (!(bool)$debug_mode && extension_loaded('xdebug')) {
xdebug_disable();
}
15 changes: 6 additions & 9 deletions src/Magento/FunctionalTestingFramework/_bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,17 @@

// define framework basepath for schema pathing
defined('FW_BP') || define('FW_BP', realpath(__DIR__ . '/../../../'));

// get the root path of the project (we will always be installed under vendor)
// get the root path of the project
$projectRootPath = substr(FW_BP, 0, strpos(FW_BP, DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR));

if (empty($projectRootPath)) {
// If ProjectRootPath is empty, we are not under vendor and are executing standalone.
require_once (realpath(FW_BP . "/dev/tests/functional/_bootstrap.php"));
require_once (realpath(FW_BP . "/dev/tests/functional/standalone_bootstrap.php"));
return;
}
defined('PROJECT_ROOT') || define('PROJECT_ROOT', $projectRootPath);
$envFilepath = realpath($projectRootPath . '/dev/tests/acceptance/');

// set Magento_BP as Root_Project Path
define('PROJECT_ROOT', $projectRootPath);
defined('MAGENTO_BP') || define('MAGENTO_BP', realpath($projectRootPath));

// load .env (if it exists)
$envFilepath = realpath(MAGENTO_BP . '/dev/tests/acceptance/');
if (file_exists($envFilepath . DIRECTORY_SEPARATOR . '.env')) {
$env = new \Dotenv\Loader($envFilepath . DIRECTORY_SEPARATOR . '.env');
$env->load();
Expand Down Expand Up @@ -56,6 +51,8 @@
}
}


defined('MAGENTO_BP') || define('MAGENTO_BP', realpath(PROJECT_ROOT));
// TODO REMOVE THIS CODE ONCE WE HAVE STOPPED SUPPORTING dev/tests/acceptance PATH
// define TEST_PATH and TEST_MODULE_PATH
defined('TESTS_BP') || define('TESTS_BP', realpath(MAGENTO_BP . DIRECTORY_SEPARATOR . 'dev/tests/acceptance/'));
Expand Down