Skip to content

Commit 284aec3

Browse files
Merge remote-tracking branch 'origin/MAGETWO-50848-compile-folders-as-files' into develop
2 parents 50eb392 + 14445fa commit 284aec3

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-1
lines changed

Diff for: setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function getList($path)
5555
$classes = [];
5656
foreach ($recursiveIterator as $fileItem) {
5757
/** @var $fileItem \SplFileInfo */
58-
if ($fileItem->getExtension() !== 'php') {
58+
if ($fileItem->isDir() || $fileItem->getExtension() !== 'php') {
5959
continue;
6060
}
6161
foreach ($this->excludePatterns as $excludePatterns) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Setup\Test\Unit\Module\Di\Code\Reader;
7+
8+
class ClassesScannerTest extends \PHPUnit_Framework_TestCase
9+
{
10+
/**
11+
* @var \Magento\Setup\Module\Di\Code\Reader\ClassesScanner
12+
*/
13+
private $model;
14+
15+
protected function setUp()
16+
{
17+
$this->model = new \Magento\Setup\Module\Di\Code\Reader\ClassesScanner();
18+
}
19+
20+
public function testGetList()
21+
{
22+
$pathToScan = str_replace('\\', '/', realpath(__DIR__ . '/../../') . '/_files/app/code/Magento/SomeModule');
23+
$actual = $this->model->getList($pathToScan);
24+
$this->assertTrue(is_array($actual));
25+
$this->assertCount(5, $actual);
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* Copyright © 2016 Magento. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
/**
7+
* This file exists for the sake of \Magento\Setup\Test\Unit\Module\Di\Code\Reader\ClassesScannerTest, in order
8+
* to verify that PHP files are correctly scanned and things that are not PHP files (like this file and its parent
9+
* directory) are not scanned.
10+
*/
11+
12+
/**
13+
* True Function
14+
*
15+
* @return bool
16+
*/
17+
public function someTrueFunction()
18+
{
19+
return true;
20+
}
21+

0 commit comments

Comments
 (0)