Skip to content

Commit 9411507

Browse files
author
Ankur Kaneria
committed
MAGETWO-42263: Register non-composer components
- changes to support 'api-functional/_files/' modules from original location
1 parent 2693ff7 commit 9411507

File tree

3 files changed

+72
-21
lines changed

3 files changed

+72
-21
lines changed

app/etc/NonComposerComponentRegistration.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ private function __construct()
4141
// 2. app/design
4242
// 3. app/i18n
4343
// 4. lib/internal
44-
static::$pathList[ ] = dirname(dirname(__FILE__)) . '/code/*/*/registration.php';
45-
static::$pathList[ ] = dirname(dirname(__FILE__)) . '/design/*/*/*/registration.php';
46-
static::$pathList[ ] = dirname(dirname(__FILE__)) . '/i18n/*/*/registration.php';
47-
static::$pathList[ ] = dirname(dirname(__FILE__)) . '/lib/internal/*/*/registration.php';
44+
static::$pathList[ ] = dirname(__DIR__) . '/code/*/*/registration.php';
45+
static::$pathList[ ] = dirname(__DIR__) . '/design/*/*/*/registration.php';
46+
static::$pathList[ ] = dirname(__DIR__) . '/i18n/*/*/registration.php';
47+
static::$pathList[ ] = dirname(dirname(__DIR__)) . '/lib/internal/*/*/registration.php';
4848
}
4949

5050
/**

dev/tests/api-functional/framework/autoload.php

+60
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,63 @@
1313
$autoloadWrapper->addPsr4('Magento\\TestFramework\\', "{$testsBaseDir}/framework/Magento/TestFramework/");
1414
$autoloadWrapper->addPsr4('Magento\\TestFramework\\', "{$integrationTestsDir}/framework/Magento/TestFramework/");
1515
$autoloadWrapper->addPsr4('Magento\\', "{$testsBaseDir}/testsuite/Magento/");
16+
17+
// registration of name spaces under '../_files'
18+
$_filesDir = realpath("{$testsBaseDir}/_files");
19+
20+
// TestModule1
21+
$autoloadWrapper->addPsr4('Magento\\TestModule1\\Controller\\CookieTester', "{$_filesDir}/TestModule1/Controller/CookieTester/");
22+
$autoloadWrapper->addPsr4('Magento\\TestModule1\\Controller', "{$_filesDir}/TestModule1/Controller/");
23+
$autoloadWrapper->addPsr4('Magento\\TestModule1\\Service\\V1', "{$_filesDir}/TestModule1/Service/V1/");
24+
$autoloadWrapper->addPsr4('Magento\\TestModule1\\Service\\V1\\Entity', "{$_filesDir}/TestModule1/Service/V1/Entity/");
25+
$autoloadWrapper->addPsr4('Magento\\TestModule1\\Service\\V2', "{$_filesDir}/TestModule1/Service/V2/");
26+
$autoloadWrapper->addPsr4('Magento\\TestModule1\\Service\\V2\\Entity', "{$_filesDir}/TestModule1/Service/V2/Entity/");
27+
28+
// TestModule2
29+
$autoloadWrapper->addPsr4('Magento\\TestModule2\\Controller\\CookieTester', "{$_filesDir}/TestModule2/Controller/CookieTester/");
30+
$autoloadWrapper->addPsr4('Magento\\TestModule2\\Controller', "{$_filesDir}/TestModule2/Controller/");
31+
$autoloadWrapper->addPsr4('Magento\\TestModule2\\Service\\V1', "{$_filesDir}/TestModule2/Service/V1/");
32+
$autoloadWrapper->addPsr4('Magento\\TestModule2\\Service\\V1\\Entity', "{$_filesDir}/TestModule2/Service/V1/Entity/");
33+
$autoloadWrapper->addPsr4('Magento\\TestModule2\\Service\\V2', "{$_filesDir}/TestModule2/Service/V2/");
34+
$autoloadWrapper->addPsr4('Magento\\TestModule2\\Service\\V2\\Entity', "{$_filesDir}/TestModule2/Service/V2/Entity/");
35+
36+
// TestModule3
37+
$autoloadWrapper->addPsr4('Magento\\TestModule3\\Controller\\CookieTester', "{$_filesDir}/TestModule3/Controller/CookieTester/");
38+
$autoloadWrapper->addPsr4('Magento\\TestModule3\\Controller', "{$_filesDir}/TestModule3/Controller/");
39+
$autoloadWrapper->addPsr4('Magento\\TestModule3\\Service\\V1', "{$_filesDir}/TestModule3/Service/V1/");
40+
$autoloadWrapper->addPsr4('Magento\\TestModule3\\Service\\V1\\Entity', "{$_filesDir}/TestModule3/Service/V1/Entity/");
41+
$autoloadWrapper->addPsr4('Magento\\TestModule3\\Service\\V2', "{$_filesDir}/TestModule3/Service/V2/");
42+
$autoloadWrapper->addPsr4('Magento\\TestModule3\\Service\\V2\\Entity', "{$_filesDir}/TestModule3/Service/V2/Entity/");
43+
44+
// TestModule4
45+
$autoloadWrapper->addPsr4('Magento\\TestModule4\\Controller\\CookieTester', "{$_filesDir}/TestModule4/Controller/CookieTester/");
46+
$autoloadWrapper->addPsr4('Magento\\TestModule4\\Controller', "{$_filesDir}/TestModule4/Controller/");
47+
$autoloadWrapper->addPsr4('Magento\\TestModule4\\Service\\V1', "{$_filesDir}/TestModule4/Service/V1/");
48+
$autoloadWrapper->addPsr4('Magento\\TestModule4\\Service\\V1\\Entity', "{$_filesDir}/TestModule4/Service/V1/Entity/");
49+
$autoloadWrapper->addPsr4('Magento\\TestModule4\\Service\\V2', "{$_filesDir}/TestModule4/Service/V2/");
50+
$autoloadWrapper->addPsr4('Magento\\TestModule4\\Service\\V2\\Entity', "{$_filesDir}/TestModule4/Service/V2/Entity/");
51+
52+
// TestModule5
53+
$autoloadWrapper->addPsr4('Magento\\TestModule5\\Controller\\CookieTester', "{$_filesDir}/TestModule5/Controller/CookieTester/");
54+
$autoloadWrapper->addPsr4('Magento\\TestModule5\\Controller', "{$_filesDir}/TestModule5/Controller/");
55+
$autoloadWrapper->addPsr4('Magento\\TestModule5\\Service\\V1', "{$_filesDir}/TestModule5/Service/V1/");
56+
$autoloadWrapper->addPsr4('Magento\\TestModule5\\Service\\V1\\Entity', "{$_filesDir}/TestModule5/Service/V1/Entity/");
57+
$autoloadWrapper->addPsr4('Magento\\TestModule5\\Service\\V2', "{$_filesDir}/TestModule5/Service/V2/");
58+
$autoloadWrapper->addPsr4('Magento\\TestModule5\\Service\\V2\\Entity', "{$_filesDir}/TestModule5/Service/V2/Entity/");
59+
60+
// TestModuleIntegrationFromConfig
61+
$autoloadWrapper->addPsr4('Magento\TestModuleIntegrationFromConfig\Setup', "{$_filesDir}/TestModuleIntegrationFromConfig/Setup/");
62+
63+
// TestModuleJoinDirectives
64+
$autoloadWrapper->addPsr4('Magento\\TestModuleJoinDirectives\\Api', "{$_filesDir}/TestModuleJoinDirectives/Api/");
65+
$autoloadWrapper->addPsr4('Magento\\TestModuleJoinDirectives\\Model', "{$_filesDir}/TestModuleJoinDirectives/Model/");
66+
67+
// TestModuleMSC
68+
$autoloadWrapper->addPsr4('Magento\\TestModuleMSC\\Api', "{$_filesDir}/TestModuleMSC/Api/");
69+
$autoloadWrapper->addPsr4('Magento\\TestModuleMSC\\Api\\Data', "{$_filesDir}/TestModuleMSC/Api/Data/");
70+
$autoloadWrapper->addPsr4('Magento\\TestModuleMSC\\Model', "{$_filesDir}/TestModuleMSC/Model/");
71+
$autoloadWrapper->addPsr4('Magento\\TestModuleMSC\\Model\\Data', "{$_filesDir}/TestModuleMSC/Model/Data/");
72+
$autoloadWrapper->addPsr4('Magento\\TestModuleMSC\\Model\\Resource', "{$_filesDir}/TestModuleMSC/Model/Resource");
73+
74+
75+

dev/tests/api-functional/framework/bootstrap.php

+8-17
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,15 @@
1919
$logWriter->setFormatter(new \Zend_Log_Formatter_Simple('%message%' . PHP_EOL));
2020
$logger = new \Zend_Log($logWriter);
2121

22-
/** Copy test modules to app/code/Magento to make them visible for Magento instance */
23-
$pathToCommittedTestModules = __DIR__ . '/../_files/Magento';
24-
$pathToInstalledMagentoInstanceModules = __DIR__ . '/../../../../app/code/Magento';
25-
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($pathToCommittedTestModules));
26-
/** @var SplFileInfo $file */
27-
foreach ($iterator as $file) {
28-
if (!$file->isDir()) {
29-
$source = $file->getPathname();
30-
$relativePath = substr($source, strlen($pathToCommittedTestModules));
31-
$destination = $pathToInstalledMagentoInstanceModules . $relativePath;
32-
$targetDir = dirname($destination);
33-
if (!is_dir($targetDir)) {
34-
mkdir($targetDir, 0755, true);
35-
}
36-
copy($source, $destination);
37-
}
22+
// Register the modules under '_files/'
23+
$path = dirname(__DIR__) . '/_files/*/*/registration.php';
24+
$files = glob($path, GLOB_NOSORT);
25+
if ( $files === false ) {
26+
throw new \RuntimeException('glob() returned error while searching in \'' . $path . '\'');
27+
}
28+
foreach ($files as $file) {
29+
include $file;
3830
}
39-
unset($iterator, $file);
4031

4132
/* Bootstrap the application */
4233
$settings = new \Magento\TestFramework\Bootstrap\Settings($testsBaseDir, get_defined_constants());

0 commit comments

Comments
 (0)