1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* Tests to ensure that all license blocks are represented by placeholders
*/
namespace Magento\Test\Legacy;
class LicenseTest extends \PHPUnit\Framework\TestCase
{
public function testLegacyComment()
{
$invoker = new \Magento\Framework\App\Utility\AggregateInvoker($this);
$invoker(
function ($filename) {
$fileText = file_get_contents($filename);
if (!preg_match_all('#/\*\*.+@copyright.+?\*/#s', $fileText, $matches)) {
return;
}
foreach ($matches[0] as $commentText) {
foreach (['Irubin Consulting Inc', 'DBA Varien', 'Magento Inc'] as $legacyText) {
$this->assertNotContains(
$legacyText,
$commentText,
"The license of file {$filename} contains legacy text."
);
}
}
},
$this->legacyCommentDataProvider()
);
}
public function legacyCommentDataProvider()
{
$allFiles = \Magento\Framework\App\Utility\Files::init()->getAllFiles();
$result = [];
foreach ($allFiles as $file) {
if (!file_exists($file[0]) || !is_readable($file[0])) {
continue;
}
$result[] = [$file[0]];
}
return $result;
}
}