Ejemplo n.º 1
0
 public function testDoOperation()
 {
     $this->classesScannerMock->expects($this->once())->method('getList')->with('path/to/app');
     $this->repositoryScannerMock->expects($this->once())->method('setUseAutoload')->with(false);
     $files = ['file1', 'file2'];
     $this->configurationScannerMock->expects($this->once())->method('scan')->with('di.xml')->willReturn($files);
     $this->repositoryScannerMock->expects($this->once())->method('collectEntities')->with($files)->willReturn([]);
     $this->model->doOperation();
 }
 public function testDoOperationEmptyRepositories()
 {
     $data = ['paths' => ['path/to/app'], 'filePatterns' => ['di' => 'di.xml'], 'excludePatterns' => ['/\\/Test\\//']];
     $files = ['di' => []];
     $model = new RepositoryGenerator($this->directoryScannerMock, $this->classesScannerMock, $this->repositoryScannerMock, $data);
     $this->classesScannerMock->expects($this->once())->method('getList')->with($data['paths'][0]);
     $this->directoryScannerMock->expects($this->once())->method('scan')->with($data['paths'][0], $data['filePatterns'])->willReturn($files);
     $this->repositoryScannerMock->expects($this->once())->method('setUseAutoload')->with(false);
     $this->repositoryScannerMock->expects($this->once())->method('collectEntities')->with($files['di'])->willReturn([]);
     $this->assertEmpty($model->doOperation());
 }