Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ServiceDataAttributesGeneratorTest.php
Go to the documentation of this file.
1 <?php
8 
10 
14 class ServiceDataAttributesGeneratorTest extends \PHPUnit\Framework\TestCase
15 {
19  private $configurationScannerMock;
20 
24  private $serviceDataAttributesScannerMock;
25 
29  private $model;
30 
31  protected function setUp()
32  {
33  $this->configurationScannerMock = $this->getMockBuilder(
34  \Magento\Setup\Module\Di\Code\Scanner\ConfigurationScanner::class
35  )->disableOriginalConstructor()
36  ->getMock();
37  $this->serviceDataAttributesScannerMock = $this->getMockBuilder(
38  \Magento\Setup\Module\Di\Code\Scanner\ServiceDataAttributesScanner::class
39  )->disableOriginalConstructor()
40  ->getMock();
41  $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
42  $this->model = $objectManagerHelper->getObject(
43  \Magento\Setup\Module\Di\App\Task\Operation\ServiceDataAttributesGenerator::class,
44  [
45  'serviceDataAttributesScanner' => $this->serviceDataAttributesScannerMock,
46  'configurationScanner' => $this->configurationScannerMock,
47  ]
48  );
49  }
50 
51  public function testDoOperation()
52  {
53  $files = ['file1', 'file2'];
54  $this->configurationScannerMock->expects($this->once())
55  ->method('scan')
56  ->with('extension_attributes.xml')
57  ->willReturn($files);
58  $this->serviceDataAttributesScannerMock->expects($this->once())
59  ->method('collectEntities')
60  ->with($files)
61  ->willReturn([]);
62 
63  $this->model->doOperation();
64  }
65 }
foreach($appDirs as $dir) $files