@@ -17,9 +17,21 @@ class ObsoleteResponseTest extends \PHPUnit_Framework_TestCase
17
17
*/
18
18
protected $ obsoleteMethods = [];
19
19
20
+ /**
21
+ * @var array
22
+ */
23
+ protected $ filesBlackList = [];
24
+
25
+ /**
26
+ * @var string
27
+ */
28
+ protected $ appPath ;
29
+
20
30
protected function setUp ()
21
31
{
22
- $ this ->obsoleteMethods = include __DIR__ . '/_files/obsolete_response_methods.php ' ;
32
+ $ this ->appPath = \Magento \Framework \Test \Utility \Files::init ()->getPathToSource ();
33
+ $ this ->obsoleteMethods = include __DIR__ . '/_files/response/obsolete_response_methods.php ' ;
34
+ $ this ->filesBlackList = $ this ->getBlackList ();
23
35
}
24
36
25
37
/**
@@ -50,25 +62,40 @@ function ($file) {
50
62
*/
51
63
public function modulesFilesDataProvider ()
52
64
{
53
- $ result = [];
54
- $ appPath = \Magento \Framework \Test \Utility \Files::init ()->getPathToSource ();
55
- $ refactoredModules = $ this ->getRefactoredModules ('refactored_modules* ' );
56
- foreach ($ refactoredModules as $ refactoredFolder ) {
57
- $ files = \Magento \Framework \Test \Utility \Files::init ()->getFiles ([$ appPath . $ refactoredFolder ], '*.php ' );
58
- $ result = array_merge ($ result , $ files );
65
+ $ filesList = [];
66
+
67
+ foreach ($ this ->getFilesData ('whitelist/refactored_modules* ' ) as $ refactoredFolder ) {
68
+ $ files = \Magento \Framework \Test \Utility \Files::init ()->getFiles (
69
+ [$ this ->appPath . $ refactoredFolder ], '*.php '
70
+ );
71
+ $ filesList = array_merge ($ filesList , $ files );
59
72
}
60
73
74
+ $ result = array_map ('realpath ' , $ filesList );
75
+ $ result = array_diff ($ result , $ this ->filesBlackList );
61
76
return \Magento \Framework \Test \Utility \Files::composeDataSets ($ result );
62
77
}
63
78
79
+ /**
80
+ * @return array
81
+ */
82
+ protected function getBlackList ()
83
+ {
84
+ $ blackListFiles = [];
85
+ foreach ($ this ->getFilesData ('blacklist/files_list* ' ) as $ file ) {
86
+ $ blackListFiles [] = realpath ($ this ->appPath . $ file );
87
+ }
88
+ return $ blackListFiles ;
89
+ }
90
+
64
91
/**
65
92
* @param string $filePattern
66
93
* @return array
67
94
*/
68
- protected function getRefactoredModules ($ filePattern )
95
+ protected function getFilesData ($ filePattern )
69
96
{
70
97
$ result = [];
71
- foreach (glob (__DIR__ . '/_files/response_whitelist / ' . $ filePattern ) as $ file ) {
98
+ foreach (glob (__DIR__ . '/_files/response / ' . $ filePattern ) as $ file ) {
72
99
$ fileData = include $ file ;
73
100
$ result = array_merge ($ result , $ fileData );
74
101
}
0 commit comments