1
1
<?php
2
2
/**
3
- * Copyright © 2013-2017 Magento, Inc . All rights reserved.
3
+ * Copyright © 2016 Magento. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
6
@@ -15,7 +15,12 @@ class ModuleDBChangeTest extends \PHPUnit_Framework_TestCase
15
15
/**
16
16
* @var string
17
17
*/
18
- protected static $ changedFilesPattern = __DIR__ . '/../_files/changed_files* ' ;
18
+ private static $ branchesFilesPattern = __DIR__ . '/../_files/branches* ' ;
19
+
20
+ /**
21
+ * @var string
22
+ */
23
+ private static $ changedFilesPattern = __DIR__ . '/../_files/changed_files* ' ;
19
24
20
25
/**
21
26
* @var string
@@ -32,6 +37,24 @@ class ModuleDBChangeTest extends \PHPUnit_Framework_TestCase
32
37
*/
33
38
public static function setUpBeforeClass ()
34
39
{
40
+ foreach (glob (self ::$ branchesFilesPattern ) as $ branchesFile ) {
41
+ //get the current branchname from the first line
42
+ $ branchName = trim (file ($ branchesFile )[0 ]);
43
+ if ($ branchName === 'develop ' ) {
44
+ self ::$ actualBranch = true ;
45
+ } else {
46
+ //get current minor branch name
47
+ preg_match ('|^(\d+\.\d+)| ' , $ branchName , $ minorBranch );
48
+ $ branchName = $ minorBranch [0 ];
49
+
50
+ //get all version branches
51
+ preg_match_all ('|^(\d+\.\d+)|m ' , file_get_contents ($ branchesFile ), $ matches );
52
+
53
+ //check is this a latest release branch
54
+ self ::$ actualBranch = ($ branchName == max ($ matches [0 ]));
55
+ }
56
+ }
57
+
35
58
foreach (glob (self ::$ changedFilesPattern ) as $ changedFile ) {
36
59
self ::$ changedFileList .= file_get_contents ($ changedFile ) . PHP_EOL ;
37
60
}
0 commit comments