Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ClassesScannerTest.php
Go to the documentation of this file.
1 <?php
7 
9 
10 class ClassesScannerTest extends \PHPUnit\Framework\TestCase
11 {
15  private $model;
16 
23  private $generation;
24 
25  protected function setUp()
26  {
27  $this->generation = realpath(__DIR__ . '/../../_files/var/generation');
28  $mock = $this->getMockBuilder(DirectoryList::class)->disableOriginalConstructor()->setMethods(
29  ['getPath']
30  )->getMock();
31  $mock->method('getPath')->willReturn($this->generation);
32  $this->model = new \Magento\Setup\Module\Di\Code\Reader\ClassesScanner([], $mock);
33  }
34 
35  public function testGetList()
36  {
37  $pathToScan = str_replace('\\', '/', realpath(__DIR__ . '/../../') . '/_files/app/code/Magento/SomeModule');
38  $actual = $this->model->getList($pathToScan);
39  $this->assertTrue(is_array($actual));
40  $this->assertCount(5, $actual);
41  }
42 }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60