public function testDoOperation() { $files = ['file1', 'file2']; $this->configurationScannerMock->expects($this->once())->method('scan')->with('extension_attributes.xml')->willReturn($files); $this->serviceDataAttributesScannerMock->expects($this->once())->method('collectEntities')->with($files)->willReturn([]); $this->model->doOperation(); }
/** * Processes operation task * * @return void */ public function doOperation() { $files = $this->configurationScanner->scan('extension_attributes.xml'); $repositories = $this->serviceDataAttributesScanner->collectEntities($files); foreach ($repositories as $entityName) { class_exists($entityName); } }
public function testDoOperation() { $data = ['paths' => ['path/to/app'], 'filePatterns' => ['di' => 'di.xml']]; $files = ['extension_attributes' => []]; $model = new ServiceDataAttributesGenerator($this->directoryScannerMock, $this->serviceDataAttributesScannerMock, $data); $this->directoryScannerMock->expects($this->once())->method('scan')->with($data['paths'][0], $data['filePatterns'])->willReturn($files); $this->serviceDataAttributesScannerMock->expects($this->once())->method('collectEntities')->with($files['extension_attributes'])->willReturn([]); $model->doOperation(); }
/** * Processes operation task * * @return void */ public function doOperation() { if (array_diff(array_keys($this->data), ['filePatterns', 'path']) !== array_diff(['filePatterns', 'path'], array_keys($this->data))) { return; } $files = $this->directoryScanner->scan($this->data['path'], $this->data['filePatterns']); $repositories = $this->serviceDataAttributesScanner->collectEntities($files['extension_attributes']); foreach ($repositories as $entityName) { class_exists($entityName); } }
public function testCollectEntities() { $files = [$this->testFile]; $expectedResult = ['Magento\\Sales\\Api\\Data\\OrderExtensionInterface', 'Magento\\Sales\\Api\\Data\\OrderExtension', 'Magento\\Sales\\Api\\Data\\OrderItemExtensionInterface', 'Magento\\Sales\\Api\\Data\\OrderItemExtension']; $this->assertSame($expectedResult, $this->model->collectEntities($files)); }