Skip to content

MQE-987: Decouple MFTF from Magento #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2018
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
214 changes: 0 additions & 214 deletions RoboFile.php

This file was deleted.

16 changes: 15 additions & 1 deletion bin/mftf
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,27 @@ if (PHP_SAPI !== 'cli') {
exit(1);
}

$autoload_path = realpath(__DIR__ . '/../../../autoload.php');
$test_bootstrap_path = realpath(__DIR__ . '/../dev/tests/functional/_bootstrap.php');

if (file_exists($autoload_path)) {
require_once $autoload_path;
} else {
require_once $test_bootstrap_path;
}


try {
require_once __DIR__ . '/../bootstrap.php';
$application = new Symfony\Component\Console\Application();
$application->setName('Magento Functional Testing Framework CLI');
$application->setVersion('1.0.0');
$application->add(new Magento\FunctionalTestingFramework\Console\SetupEnvCommand());
$application->add(new Magento\FunctionalTestingFramework\Console\CleanProjectCommand());
$application->add(new Magento\FunctionalTestingFramework\Console\BuildProjectCommand());
$application->add(new Magento\FunctionalTestingFramework\Console\GenerateSuiteCommand());
$application->add(new Magento\FunctionalTestingFramework\Console\GenerateTestsCommand());
$application->add(new Magento\FunctionalTestingFramework\Console\RunTestGroupCommand());
$application->add(new Magento\FunctionalTestingFramework\Console\RunTestCommand());
$application->run();
} catch (\Exception $e) {
while ($e) {
Expand Down
8 changes: 0 additions & 8 deletions bootstrap.php

This file was deleted.

1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"symfony/stopwatch": "~3.4.6"
},
"autoload": {
"files": ["src/Magento/FunctionalTestingFramework/_bootstrap.php"],
"psr-4": {
"Magento\\FunctionalTestingFramework\\": "src/Magento/FunctionalTestingFramework",
"MFTF\\": "dev/tests/functional/MFTF"
Expand Down
10 changes: 7 additions & 3 deletions dev/tests/_bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@

error_reporting(~E_USER_NOTICE);
define('PROJECT_ROOT', dirname(dirname(__DIR__)));
require_once PROJECT_ROOT . '/vendor/autoload.php';
require_once 'util/MftfTestCase.php';

$vendorAutoloadPath = realpath(PROJECT_ROOT . '/vendor/autoload.php');
$mftfTestCasePath = realpath(PROJECT_ROOT . '/dev/tests/util/MftfTestCase.php');

require_once $vendorAutoloadPath;
require_once $mftfTestCasePath;

// Set up AspectMock
$kernel = \AspectMock\Kernel::getInstance();
$kernel->init([
'debug' => true,
'includePaths' => [PROJECT_ROOT . '/src'],
'includePaths' => [PROJECT_ROOT . DIRECTORY_SEPARATOR . 'src'],
'cacheDir' => PROJECT_ROOT .
DIRECTORY_SEPARATOR .
'dev' .
Expand Down
7 changes: 0 additions & 7 deletions dev/tests/functional/MFTF/_bootstrap.php

This file was deleted.

31 changes: 14 additions & 17 deletions dev/tests/functional/_bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,9 @@
*/

define('PROJECT_ROOT', dirname(dirname(dirname(__DIR__))));
require_once PROJECT_ROOT . '/vendor/autoload.php';
$RELATIVE_FW_PATH = PROJECT_ROOT;
require_once realpath(PROJECT_ROOT . '/vendor/autoload.php');

//Load constants from .env file
if (file_exists(PROJECT_ROOT . '/.env')) {
$env = new \Dotenv\Loader(PROJECT_ROOT . '/.env');
$env->load();

if (array_key_exists('TESTS_MODULE_PATH', $_ENV) xor array_key_exists('TESTS_BP', $_ENV)) {
throw new Exception('You must define both parameters TESTS_BP and TESTS_MODULE_PATH or neither parameter');
}

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

// add the debug flag here
Expand All @@ -29,7 +16,17 @@
xdebug_disable();
}

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

defined('TESTS_BP') || define('TESTS_BP', __DIR__);
defined('TESTS_MODULE_PATH') || define('TESTS_MODULE_PATH', TESTS_BP . $RELATIVE_TESTS_MODULE_PATH);
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');
$env->load();

foreach ($_ENV as $key => $var) {
defined($key) || define($key, $var);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@
class SuiteGeneratorTest extends TestCase
{

/**
* Setup entry append and clear for Suite Generator
*/
public static function setUpBeforeClass()
{
AspectMock::double(SuiteGenerator::class, [
'clearPreviousSessionConfigEntries' => null,
'appendEntriesToConfig' => null
]);
}

/**
* Tests generating a single suite given a set of parsed test data
* @throws \Exception
Expand Down Expand Up @@ -169,6 +180,5 @@ private function setMockTestAndSuiteParserOutput($testData, $suiteData)
$property = new \ReflectionProperty(SuiteGenerator::class, 'groupClassGenerator');
$property->setAccessible(true);
$property->setValue($instance, $instance);

}
}
Loading