-
Notifications
You must be signed in to change notification settings - Fork 132
/
Copy path_bootstrap.php
79 lines (64 loc) · 2.21 KB
/
_bootstrap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
error_reporting(~E_USER_NOTICE);
define('PROJECT_ROOT', dirname(dirname(__DIR__)));
require_once PROJECT_ROOT . '/vendor/autoload.php';
require_once 'util/MftfTestCase.php';
// Set up AspectMock
$kernel = \AspectMock\Kernel::getInstance();
$kernel->init([
'debug' => true,
'includePaths' => [PROJECT_ROOT . '/src']
]);
// set mftf appplication context
\Magento\FunctionalTestingFramework\Config\MftfApplicationConfig::create(
true,
\Magento\FunctionalTestingFramework\Config\MftfApplicationConfig::GENERATION_PHASE,
true
);
// Load needed framework env params
$TEST_ENVS = [
'MAGENTO_BASE_URL' => 'http://baseurl:8080',
'MAGENTO_BACKEND_NAME' => 'admin',
'MAGENTO_ADMIN_USERNAME' => 'admin',
'MAGENTO_ADMIN_PASSWORD' => 'admin123'
];
foreach ($TEST_ENVS as $key => $value) {
$_ENV[$key] = $value;
putenv("{$key}=${value}");
}
// Add our test module to the whitelist
putenv('MODULE_WHITELIST=Magento_TestModule');
// Define our own set of paths for the tests
defined('FW_BP') || define('FW_BP', PROJECT_ROOT);
$RELATIVE_TESTS_MODULE_PATH = DIRECTORY_SEPARATOR . 'verification';
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', __DIR__);
$utilDir = DIRECTORY_SEPARATOR . 'Util'. DIRECTORY_SEPARATOR . '*.php';
//Load required util files from functional dir
$functionalUtilFiles = glob(TESTS_BP . DIRECTORY_SEPARATOR . 'verification' . $utilDir);
foreach (sortInterfaces($functionalUtilFiles) as $functionalUtilFile) {
require($functionalUtilFile);
}
//Load required util files from unit dir
$unitUtilFiles = glob(TESTS_BP . DIRECTORY_SEPARATOR . 'unit' . $utilDir);
foreach (sortInterfaces($unitUtilFiles) as $unitUtilFile) {
require($unitUtilFile);
}
function sortInterfaces($files)
{
$bottom = [];
$top = [];
foreach ($files as $file) {
if (strstr(strtolower($file), 'interface')) {
$top[] = $file;
continue;
}
$bottom[] = $file;
}
return array_merge($top, $bottom);
}