-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #282 from magento-east/pr-23
MAGETWO-56586: Port MAGETWO-55862 to develop
- Loading branch information
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
dev/tests/static/testsuite/Magento/Test/Legacy/ModuleDBChangeTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
/** | ||
* Scan source code for DB schema or data updates for patch releases in non-actual branches | ||
* Backwards compatibility test | ||
*/ | ||
namespace Magento\Test\Legacy; | ||
|
||
class ModuleDBChangeTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected static $changedFilesPattern = __DIR__ . '/../_files/changed_files*'; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected static $changedFileList = ''; | ||
|
||
/** | ||
* Set changed files paths and list for all projects | ||
*/ | ||
public static function setUpBeforeClass() | ||
{ | ||
foreach (glob(self::$changedFilesPattern) as $changedFile) { | ||
self::$changedFileList .= file_get_contents($changedFile) . PHP_EOL; | ||
} | ||
} | ||
|
||
/** | ||
* Test changes for module.xml files | ||
*/ | ||
public function testModuleXmlFiles() | ||
{ | ||
preg_match_all('|etc/module\.xml$|mi', self::$changedFileList, $matches); | ||
$this->assertEmpty( | ||
reset($matches), | ||
'module.xml changes for patch releases in non-actual branches are not allowed:' . PHP_EOL . | ||
implode(PHP_EOL, array_values(reset($matches))) | ||
); | ||
} | ||
|
||
/** | ||
* Test changes for files in Module Setup dir | ||
*/ | ||
public function testModuleSetupFiles() | ||
{ | ||
preg_match_all('|app/code/Magento/[^/]+/Setup/[^/]+$|mi', self::$changedFileList, $matches); | ||
$this->assertEmpty( | ||
reset($matches), | ||
'Code with changes for DB schema or data in non-actual branches are not allowed:' . PHP_EOL . | ||
implode(PHP_EOL, array_values(reset($matches))) | ||
); | ||
} | ||
} |