/** * @expectedException \RuntimeException */ public function testIsDetectingNonExistingHandlerClass() { $typeHandlerMock = $this->getMockBuilder('Input\\TypeHandler')->disableOriginalConstructor()->getMock(); $inputFactory = new Factory(); $inputFactory->setHandlerNamespace('This\\Does\\Not\\Exists'); $inputFactory->setTypeHandler($typeHandlerMock); $inputHandler = $inputFactory->getHandler('simple'); }
public function register(Container $container) { $container['input.type_handler'] = function () { $typeHandler = new \Input\TypeHandler(); return $typeHandler; }; $container['input.factory'] = function ($container) { $inputFactory = new \Input\Factory(); $inputFactory->setHandlerNamespace($container['input.handler_namespace']); $inputFactory->setTypeHandler($container['input.type_handler']); return $inputFactory; }; }