8
8
$ projectRootPath = $ bootstrapRoot ;
9
9
10
10
// If we're under a vendor directory, find project root.
11
- if (strpos ($ bootstrapRoot , '/vendor ' ) != 0 ) {
11
+ if (strpos ($ bootstrapRoot , '/vendor ' ) !== false ) {
12
12
$ projectRootPath = substr ($ bootstrapRoot , 0 , strpos ($ bootstrapRoot , '/vendor/ ' ));
13
13
}
14
14
28
28
// Find framework path
29
29
$ COMPOSER_FW_FULL_PREFIX = $ loader ->getPrefixesPsr4 ()[$ FW_PACKAGE_NAME ][0 ] ?? null ;
30
30
if ($ COMPOSER_FW_FULL_PREFIX === null ) {
31
- throw new Exception ("You must have the magento/magento2-functional-testing-framework installed to be able to generate tests. " );
31
+ throw new Exception (
32
+ "You must have the magento/magento2-functional-testing-framework
33
+ installed to be able to generate tests. "
34
+ );
32
35
}
33
- $ FW_PATH = substr ($ COMPOSER_FW_FULL_PREFIX , 0 , strpos ($ COMPOSER_FW_FULL_PREFIX , "/src/Magento/FunctionalTestingFramework " ));
36
+ $ FW_PATH = substr (
37
+ $ COMPOSER_FW_FULL_PREFIX ,
38
+ 0 ,
39
+ strpos ($ COMPOSER_FW_FULL_PREFIX , "/src/Magento/FunctionalTestingFramework " )
40
+ );
34
41
35
42
// Find tests path
36
43
$ COMPOSER_TEST_FULL_PREFIX = $ loader ->getPrefixesPsr4 ()[$ TESTS_PACKAGE_NAME ][0 ] ?? null ;
41
48
$ TEST_PATH = $ COMPOSER_TEST_FULL_PREFIX ;
42
49
}
43
50
44
- // We register "Magento\\" to "tests/functional/Magento" for our own class loading, need to try and find a prefix that isn't that one.
51
+ // We register "Magento\\" to "tests/functional/Magento" for our own class loading, need to try and find a
52
+ // prefix that isn't that one.
45
53
$ COMPOSER_MAGENTO_PREFIXES = $ loader ->getPrefixesPsr4 ()[$ MAGENTO_PACKAGE_NAME ];
46
54
$ COMPOSER_MAGENTO_FULL_PREFIX = null ;
47
55
foreach ($ COMPOSER_MAGENTO_PREFIXES as $ path ) {
48
- if (strpos ($ path , "tests/functional/Magento " ) == 0 ) {
56
+ if (strpos ($ path , "tests/functional/Magento " ) === 0 ) {
49
57
$ COMPOSER_MAGENTO_FULL_PREFIX = $ path ;
50
58
}
51
59
}
52
60
if ($ COMPOSER_MAGENTO_FULL_PREFIX === null ) {
53
61
$ MAGENTO_PATH = dirname (__DIR__ . "/../../../../../ " );
54
62
} else {
55
- $ MAGENTO_PATH = substr ($ COMPOSER_MAGENTO_FULL_PREFIX , 0 , strpos ($ COMPOSER_MAGENTO_FULL_PREFIX , "/app/code/Magento " ));
63
+ $ MAGENTO_PATH = substr (
64
+ $ COMPOSER_MAGENTO_FULL_PREFIX ,
65
+ 0 ,
66
+ strpos ($ COMPOSER_MAGENTO_FULL_PREFIX , "/app/code/Magento " )
67
+ );
56
68
}
57
69
58
70
$ RELATIVE_TESTS_MODULE_PATH = '/Magento/FunctionalTest ' ;
65
77
$ env ->load ();
66
78
67
79
if (array_key_exists ('TESTS_MODULE_PATH ' , $ _ENV ) xor array_key_exists ('TESTS_BP ' , $ _ENV )) {
68
- throw new Exception ('You must define both parameters TESTS_BP and TESTS_MODULE_PATH or neither parameter ' );
80
+ throw new Exception (
81
+ 'You must define both parameters TESTS_BP and TESTS_MODULE_PATH or neither parameter '
82
+ );
69
83
}
70
84
71
85
foreach ($ _ENV as $ key => $ var ) {
72
86
defined ($ key ) || define ($ key , $ var );
73
87
}
74
88
75
- defined ('MAGENTO_CLI_COMMAND_PATH ' ) || define ('MAGENTO_CLI_COMMAND_PATH ' , 'dev/tests/acceptance/utils/command.php ' );
89
+ defined ('MAGENTO_CLI_COMMAND_PATH ' ) || define (
90
+ 'MAGENTO_CLI_COMMAND_PATH ' ,
91
+ 'dev/tests/acceptance/utils/command.php '
92
+ );
76
93
$ env ->setEnvironmentVariable ('MAGENTO_CLI_COMMAND_PATH ' , MAGENTO_CLI_COMMAND_PATH );
77
94
78
95
defined ('MAGENTO_CLI_COMMAND_PARAMETER ' ) || define ('MAGENTO_CLI_COMMAND_PARAMETER ' , 'command ' );
81
98
82
99
defined ('FW_BP ' ) || define ('FW_BP ' , realpath ($ FW_PATH ));
83
100
defined ('TESTS_BP ' ) || define ('TESTS_BP ' , realpath ($ TEST_PATH ));
84
- defined ('TESTS_MODULE_PATH ' ) || define ('TESTS_MODULE_PATH ' , realpath ($ TEST_PATH . $ RELATIVE_TESTS_MODULE_PATH ));
101
+ defined ('TESTS_MODULE_PATH ' ) || define (
102
+ 'TESTS_MODULE_PATH ' ,
103
+ realpath ($ TEST_PATH . $ RELATIVE_TESTS_MODULE_PATH )
104
+ );
85
105
86
106
// add the debug flag here
87
107
$ debug_mode = $ _ENV ['MFTF_DEBUG ' ] ?? false ;
88
108
if (!(bool )$ debug_mode && extension_loaded ('xdebug ' )) {
89
109
xdebug_disable ();
90
- }
110
+ }
0 commit comments