Пример #1
0
 public function testGetList()
 {
     $path = '/tmp/test';
     $classes = ['NameSpace1\\ClassName1', 'NameSpace1\\ClassName2'];
     $this->classesScannerMock->expects($this->once())->method('getList')->with($path)->willReturn($classes);
     $constructors = [['NameSpace1\\ClassName1', ['arg1' => 'NameSpace1\\class5', 'arg2' => 'NameSpace1\\ClassName4']], ['NameSpace1\\ClassName2', ['arg1' => 'NameSpace1\\class5']]];
     $this->classReaderDecoratorMock->expects($this->exactly(count($classes)))->method('getConstructor')->will($this->returnValueMap($constructors));
     $result = $this->model->getList($path);
     $expected = [$classes[0] => $constructors[0][1], $classes[1] => $constructors[1][1]];
     $this->assertEquals($result, $expected);
 }
Пример #2
0
 /**
  * Returns definitions collection
  *
  * @param string $path
  * @return DefinitionsCollection
  */
 protected function getDefinitionsCollection($path)
 {
     $definitions = new DefinitionsCollection();
     foreach ($this->areaInstancesNamesList->getList($path) as $className => $constructorArguments) {
         $definitions->addDefinition($className, $constructorArguments);
     }
     return $definitions;
 }