File tree Expand file tree Collapse file tree 2 files changed +69
-0
lines changed
dev/tests/static/testsuite/Magento/Test/Legacy Expand file tree Collapse file tree 2 files changed +69
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © 2016 Magento. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ /**
8
+ * Tests to ensure that all files has up to date copyright info
9
+ */
10
+ namespace Magento \Test \Legacy ;
11
+
12
+ class CopyrightTest extends \PHPUnit_Framework_TestCase
13
+ {
14
+ public function testCopyright ()
15
+ {
16
+ $ invoker = new \Magento \Framework \App \Utility \AggregateInvoker ($ this );
17
+ $ invoker (
18
+ function ($ filename ) {
19
+ $ fileText = file_get_contents ($ filename );
20
+ if (strpos ($ fileText , 'Copyright © ' . date ('Y ' )) === false ) {
21
+ $ this ->fail ('Copyright is missing or has wrong year in ' . $ filename );
22
+ }
23
+ },
24
+ $ this ->copyrightDataProvider ()
25
+ );
26
+ }
27
+
28
+ public function copyrightDataProvider ()
29
+ {
30
+ $ blackList = include __DIR__ . '/_files/copyright/blacklist.php ' ;
31
+
32
+ $ changedFiles = [];
33
+ foreach (glob (__DIR__ . '/../_files/changed_files* ' ) as $ listFile ) {
34
+ $ changedFiles = array_merge ($ changedFiles , file ($ listFile , FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES ));
35
+ }
36
+ array_walk (
37
+ $ changedFiles ,
38
+ function (&$ file ) {
39
+ $ file = [BP . '/ ' . $ file ];
40
+ }
41
+ );
42
+ $ changedFiles = array_filter (
43
+ $ changedFiles ,
44
+ function ($ path ) use ($ blackList ) {
45
+ if (!file_exists ($ path [0 ]) || !is_readable ($ path [0 ])) {
46
+ return false ;
47
+ }
48
+ $ path [0 ] = realpath ($ path [0 ]);
49
+ foreach ($ blackList as $ item ) {
50
+ if (preg_match ($ item , $ path [0 ])) {
51
+ return false ;
52
+ }
53
+ }
54
+ return true ;
55
+ }
56
+ );
57
+ return $ changedFiles ;
58
+ }
59
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © 2016 Magento. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ return [
7
+ '/\.(jpe?g|png|gif|ttf|swf|eot|woff|pdf|mp3|pdf|jar|jbf)$/ ' ,
8
+ '/pub\/opt\/magento\/var/ '
9
+ ];
10
+
You can’t perform that action at this time.
0 commit comments