Skip to content

Commit 18e1715

Browse files
committed
MAGETWO-33064: Implement obsolete test for refactored controllers
1 parent 73a2234 commit 18e1715

File tree

4 files changed

+51
-9
lines changed

4 files changed

+51
-9
lines changed

dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteResponseTest.php

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,21 @@ class ObsoleteResponseTest extends \PHPUnit_Framework_TestCase
1717
*/
1818
protected $obsoleteMethods = [];
1919

20+
/**
21+
* @var array
22+
*/
23+
protected $filesBlackList = [];
24+
25+
/**
26+
* @var string
27+
*/
28+
protected $appPath;
29+
2030
protected function setUp()
2131
{
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();
2335
}
2436

2537
/**
@@ -50,25 +62,40 @@ function ($file) {
5062
*/
5163
public function modulesFilesDataProvider()
5264
{
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);
5972
}
6073

74+
$result = array_map('realpath', $filesList);
75+
$result = array_diff($result, $this->filesBlackList);
6176
return \Magento\Framework\Test\Utility\Files::composeDataSets($result);
6277
}
6378

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+
6491
/**
6592
* @param string $filePattern
6693
* @return array
6794
*/
68-
protected function getRefactoredModules($filePattern)
95+
protected function getFilesData($filePattern)
6996
{
7097
$result = [];
71-
foreach (glob(__DIR__ . '/_files/response_whitelist/' . $filePattern) as $file) {
98+
foreach (glob(__DIR__ . '/_files/response/' . $filePattern) as $file) {
7299
$fileData = include $file;
73100
$result = array_merge($result, $fileData);
74101
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
/**
8+
* Temporary implementation that will be removed in scope of MAGETWO-28356.
9+
*
10+
* Files that temporary excluded from results
11+
*/
12+
return [
13+
'/app/code/Magento/Backend/Model/View.php',
14+
];

dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_response_methods.php renamed to dev/tests/static/testsuite/Magento/Test/Legacy/_files/response/obsolete_response_methods.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
'loadLayout',
1414
'renderLayout',
1515
'_redirect',
16+
'_forward',
1617
'_setActiveMenu',
1718
'_addBreadcrumb',
1819
'_addContent',

0 commit comments

Comments
 (0)