Skip to content

Commit b61e235

Browse files
author
vklymenko
committed
MAGETWO-59409: [Backport] MAGETWO-55501: Add support of queue testing in integration tests framework
1 parent 6f97f01 commit b61e235

File tree

5 files changed

+85
-0
lines changed

5 files changed

+85
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "magento/module-sample-test",
3+
"description": "test sample module",
4+
"require": {
5+
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
6+
"magento/framework": "100.0.*",
7+
"magento/module-integration": "100.0.*"
8+
},
9+
"type": "magento2-module",
10+
"version": "1.0",
11+
"extra": {
12+
"map": [
13+
[
14+
"*",
15+
"Magento/TestModuleSample"
16+
]
17+
]
18+
}
19+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © 2016 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9+
<module name="Magento_TestModuleSample" setup_version="0.0.1" active="true">
10+
</module>
11+
</config>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
use Magento\Framework\Component\ComponentRegistrar;
8+
9+
$registrar = new ComponentRegistrar();
10+
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModuleSample') === null) {
11+
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModuleSample', __DIR__);
12+
}

dev/tests/integration/framework/bootstrap.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
define('TESTS_TEMP_DIR', $testsBaseDir . '/tmp');
1616
}
1717

18+
$testFrameworkDir = __DIR__;
19+
require_once 'deployTestModules.php';
20+
1821
try {
1922
/* Bootstrap the application */
2023
$settings = new \Magento\TestFramework\Bootstrap\Settings($testsBaseDir, get_defined_constants());
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
/**
8+
* @var $testFrameworkDir string - Must be defined in parent script.
9+
*/
10+
11+
/** Copy test modules to app/code/Magento to make them visible for Magento instance */
12+
$pathToCommittedTestModules = $testFrameworkDir . '/../_files/Magento';
13+
$pathToInstalledMagentoInstanceModules = $testFrameworkDir . '/../../../../app/code/Magento';
14+
$iterator = new RecursiveIteratorIterator(
15+
new RecursiveDirectoryIterator($pathToCommittedTestModules, RecursiveDirectoryIterator::FOLLOW_SYMLINKS)
16+
);
17+
/** @var SplFileInfo $file */
18+
foreach ($iterator as $file) {
19+
if (!$file->isDir()) {
20+
$source = $file->getPathname();
21+
$relativePath = substr($source, strlen($pathToCommittedTestModules));
22+
$destination = $pathToInstalledMagentoInstanceModules . $relativePath;
23+
$targetDir = dirname($destination);
24+
if (!is_dir($targetDir)) {
25+
mkdir($targetDir, 0755, true);
26+
}
27+
copy($source, $destination);
28+
}
29+
}
30+
unset($iterator, $file);
31+
32+
// Register the modules under '_files/'
33+
$pathPattern = $pathToInstalledMagentoInstanceModules . '/TestModule*/registration.php';
34+
$files = glob($pathPattern, GLOB_NOSORT);
35+
if ($files === false) {
36+
throw new \RuntimeException('glob() returned error while searching in \'' . $pathPattern . '\'');
37+
}
38+
foreach ($files as $file) {
39+
include $file;
40+
}

0 commit comments

Comments
 (0)