/** * @expectedException \InvalidArgumentException * @expectedExceptionMessage Specification must implement SpecificationInterface */ public function testWrongTypeException() { $className = 'WrongClass'; $methodMock = $this->getMock($className); $this->objectManagerMock->expects($this->once())->method('get')->with($className)->will($this->returnValue($methodMock)); $this->factory->create($className); }
/** * Construct * * @param Factory $factory * @param array $specifications */ public function __construct(Factory $factory, $specifications = array()) { foreach ($specifications as $specification) { $this->specifications[] = $factory->create($specification); } }