Skip to content

Commit 6bba213

Browse files
author
Oleksii Korshenko
committed
Merge branch 'MAGETWO-55501-queue-intergartion-test-framework' into MAGETWO-54560-Split-Queue-Configs
2 parents 4090ab3 + 49995d3 commit 6bba213

File tree

7 files changed

+100
-28
lines changed

7 files changed

+100
-28
lines changed

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

+1-28
Original file line numberDiff line numberDiff line change
@@ -18,34 +18,7 @@
1818
$logWriter->setFormatter(new \Zend_Log_Formatter_Simple('%message%' . PHP_EOL));
1919
$logger = new \Zend_Log($logWriter);
2020

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

5023
/* Bootstrap the application */
5124
$settings = new \Magento\TestFramework\Bootstrap\Settings($testsBaseDir, get_defined_constants());
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.1.*",
7+
"magento/module-integration": "100.1.*"
8+
},
9+
"type": "magento2-module",
10+
"version": "1.0",
11+
"extra": {
12+
"map": [
13+
[
14+
"*",
15+
"Magento/TestModuleSample"
16+
]
17+
]
18+
}
19+
}
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>
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

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
define('TESTS_TEMP_DIR', $testsBaseDir . '/tmp');
1616
}
1717

18+
require_once __DIR__ . '/deployFixture.php';
19+
1820
try {
1921
/* Bootstrap the application */
2022
$settings = new \Magento\TestFramework\Bootstrap\Settings($testsBaseDir, get_defined_constants());
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
/** Copy test modules to app/code/Magento to make them visible for Magento instance */
8+
$pathToCommittedTestModules = __DIR__ . '/../_files/Magento';
9+
$pathToInstalledMagentoInstanceModules = __DIR__ . '/../../../../app/code/Magento';
10+
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($pathToCommittedTestModules));
11+
/** @var SplFileInfo $file */
12+
foreach ($iterator as $file) {
13+
if (!$file->isDir()) {
14+
$source = $file->getPathname();
15+
$relativePath = substr($source, strlen($pathToCommittedTestModules));
16+
$destination = $pathToInstalledMagentoInstanceModules . $relativePath;
17+
$targetDir = dirname($destination);
18+
if (!is_dir($targetDir)) {
19+
mkdir($targetDir, 0755, true);
20+
}
21+
copy($source, $destination);
22+
}
23+
}
24+
unset($iterator, $file);
25+
26+
// Register the modules under '_files/'
27+
$pathPattern = $pathToInstalledMagentoInstanceModules . '/TestModule*/registration.php';
28+
$files = glob($pathPattern, GLOB_NOSORT);
29+
if ($files === false) {
30+
throw new \RuntimeException('glob() returned error while searching in \'' . $pathPattern . '\'');
31+
}
32+
foreach ($files as $file) {
33+
include $file;
34+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\TestModuleSample;
7+
8+
class ModuleInstallationTest extends \PHPUnit_Framework_TestCase
9+
{
10+
public function testSampleModuleInstallation()
11+
{
12+
/** @var \Magento\Framework\Module\ModuleListInterface $moduleList */
13+
$moduleList = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
14+
\Magento\Framework\Module\ModuleListInterface::class
15+
);
16+
$this->assertTrue(
17+
$moduleList->has('Magento_TestModuleSample'),
18+
'Test module [Magento_TestModuleSample] is not installed'
19+
);
20+
}
21+
}

0 commit comments

Comments
 (0)