Skip to content

Commit aaf2059

Browse files
author
Volodymyr Klymenko
authored
Merge pull request #282 from magento-east/pr-23
MAGETWO-56586: Port MAGETWO-55862 to develop
2 parents 3bcc1c9 + 15cbd5c commit aaf2059

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
/**
8+
* Scan source code for DB schema or data updates for patch releases in non-actual branches
9+
* Backwards compatibility test
10+
*/
11+
namespace Magento\Test\Legacy;
12+
13+
class ModuleDBChangeTest extends \PHPUnit_Framework_TestCase
14+
{
15+
/**
16+
* @var string
17+
*/
18+
protected static $changedFilesPattern = __DIR__ . '/../_files/changed_files*';
19+
20+
/**
21+
* @var string
22+
*/
23+
protected static $changedFileList = '';
24+
25+
/**
26+
* Set changed files paths and list for all projects
27+
*/
28+
public static function setUpBeforeClass()
29+
{
30+
foreach (glob(self::$changedFilesPattern) as $changedFile) {
31+
self::$changedFileList .= file_get_contents($changedFile) . PHP_EOL;
32+
}
33+
}
34+
35+
/**
36+
* Test changes for module.xml files
37+
*/
38+
public function testModuleXmlFiles()
39+
{
40+
preg_match_all('|etc/module\.xml$|mi', self::$changedFileList, $matches);
41+
$this->assertEmpty(
42+
reset($matches),
43+
'module.xml changes for patch releases in non-actual branches are not allowed:' . PHP_EOL .
44+
implode(PHP_EOL, array_values(reset($matches)))
45+
);
46+
}
47+
48+
/**
49+
* Test changes for files in Module Setup dir
50+
*/
51+
public function testModuleSetupFiles()
52+
{
53+
preg_match_all('|app/code/Magento/[^/]+/Setup/[^/]+$|mi', self::$changedFileList, $matches);
54+
$this->assertEmpty(
55+
reset($matches),
56+
'Code with changes for DB schema or data in non-actual branches are not allowed:' . PHP_EOL .
57+
implode(PHP_EOL, array_values(reset($matches)))
58+
);
59+
}
60+
}

0 commit comments

Comments
 (0)