Skip to content

Commit 3695efe

Browse files
committed
MAGETWO-34612: Unit tests coverage build failure
- changes after merging with mainline
1 parent 7db9e4d commit 3695efe

File tree

5 files changed

+17
-1476
lines changed

5 files changed

+17
-1476
lines changed

dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ protected function _collectResourceHelpersPhp($contents, &$classes)
9090

9191
public function testConfigFiles()
9292
{
93-
$invoker = new \Magento\Framework\Test\Utility\AggregateInvoker($this);
93+
$invoker = new \Magento\Framework\App\Utility\AggregateInvoker($this);
9494
$invoker(
9595
/**
9696
* @param string $path
@@ -105,7 +105,7 @@ function ($path) {
105105

106106
public function testLayoutFiles()
107107
{
108-
$invoker = new \Magento\Framework\Test\Utility\AggregateInvoker($this);
108+
$invoker = new \Magento\Framework\App\Utility\AggregateInvoker($this);
109109
$invoker(
110110
/**
111111
* @param string $path
@@ -190,7 +190,7 @@ protected function _assertClassesExist($classes, $path)
190190

191191
public function testClassNamespaces()
192192
{
193-
$invoker = new \Magento\Framework\Test\Utility\AggregateInvoker($this);
193+
$invoker = new \Magento\Framework\App\Utility\AggregateInvoker($this);
194194
$invoker(
195195
/**
196196
* Assert PHP classes have valid formal namespaces according to file locations
@@ -301,7 +301,7 @@ protected function _assertClassNamespace($file, $relativePath, $contents, $class
301301

302302
public function testClassReferences()
303303
{
304-
$invoker = new \Magento\Framework\Test\Utility\AggregateInvoker($this);
304+
$invoker = new \Magento\Framework\App\Utility\AggregateInvoker($this);
305305
$invoker(
306306
/**
307307
* @param string $file

lib/internal/Magento/Framework/App/Utility/Classes.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
*/
88
namespace Magento\Framework\App\Utility;
99

10+
use Magento\Framework\App\Utility\Files;
11+
1012
class Classes
1113
{
1214
/**
@@ -185,11 +187,11 @@ public static function collectLayoutClasses(\SimpleXMLElement $xml)
185187
public static function collectModuleClasses($subTypePattern = '[A-Za-z]+')
186188
{
187189
$pattern = '/^' . preg_quote(
188-
\Magento\Framework\App\Utility\Files::init()->getPathToSource(),
190+
Files::init()->getPathToSource(),
189191
'/'
190192
) . '\/app\/code\/([A-Za-z]+)\/([A-Za-z]+)\/(' . $subTypePattern . '\/.+)\.php$/';
191193
$result = [];
192-
foreach (\Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, false, false, false) as $file) {
194+
foreach (Files::init()->getPhpFiles(true, false, false, false, false) as $file) {
193195
if (preg_match($pattern, $file, $matches)) {
194196
$module = "{$matches[1]}_{$matches[2]}";
195197
$class = "{$module}" . '\\' . str_replace(
@@ -214,7 +216,7 @@ public static function getVirtualClasses()
214216
if (!empty(self::$_virtualClasses)) {
215217
return self::$_virtualClasses;
216218
}
217-
$configFiles = \Magento\Framework\App\Utility\Files::init()->getDiConfigs();
219+
$configFiles = Files::init()->getDiConfigs();
218220
foreach ($configFiles as $fileName) {
219221
$configDom = new \DOMDocument();
220222
$configDom->load($fileName);

lib/internal/Magento/Framework/App/Utility/Files.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,10 @@ public function getPathToSource()
109109
* @param bool $otherCode non-application PHP-code (doesn't include "dev" directory)
110110
* @param bool $templates application PHTML-code
111111
* @param bool $asDataSet
112+
* @param bool $tests tests folder
112113
* @return array
113114
*/
114-
public function getPhpFiles($appCode = true, $otherCode = true, $templates = true, $asDataSet = true)
115+
public function getPhpFiles($appCode = true, $otherCode = true, $templates = true, $asDataSet = true, $tests = true)
115116
{
116117
$key = __METHOD__ . "/{$this->_path}/{$appCode}/{$otherCode}/{$templates}";
117118
if (!isset(self::$_cache[$key])) {
@@ -137,6 +138,12 @@ public function getPhpFiles($appCode = true, $otherCode = true, $templates = tru
137138
self::getFiles(["{$this->_path}/dev/tools/Magento/Tools/SampleData"], '*.php')
138139
);
139140
}
141+
if ($tests) {
142+
$files = array_merge(
143+
$files,
144+
self::getFiles(["{$this->_path}/dev/tests"], '*.php')
145+
);
146+
}
140147
if ($templates) {
141148
$files = array_merge($files, $this->getPhtmlFiles(false, false));
142149
}

0 commit comments

Comments
 (0)