/** * Get argument handler by type * * @param string $type * @throws InvalidArgumentException * @return Mage_Core_Model_Layout_Argument_HandlerInterface */ protected function _getArgumentHandler($type) { if (isset($this->_argumentHandlers[$type])) { return $this->_argumentHandlers[$type]; } /** @var $handler Mage_Core_Model_Layout_Argument_HandlerInterface */ $handler = $this->_handlerFactory->getArgumentHandlerByType($type); if (false === $handler instanceof Mage_Core_Model_Layout_Argument_HandlerInterface) { throw new InvalidArgumentException($type . ' type handler should implement Mage_Core_Model_Layout_Argument_HandlerInterface'); } $this->_argumentHandlers[$type] = $handler; return $handler; }
/** * @param string $type * @param string $className * @dataProvider getArgumentHandlerFactoryByTypeWithValidTypeDataProvider */ public function testGetArgumentHandlerFactoryByTypeWithValidType($type, $className) { $factoryMock = $this->getMock($className, array(), array(), '', false); $this->_objectManagerMock->expects($this->once())->method('create')->with($className)->will($this->returnValue($factoryMock)); $this->assertInstanceOf($className, $this->_model->getArgumentHandlerByType($type)); }