/** * @expectedException \UnexpectedValueException * @expectedExceptionMessage Filter factory must implement FilterFactoryInterface interface, stdClass was given. */ public function testGetFilterFactoriesWrongInstance() { $factoryName = 'Magento\\Framework\\Filter\\Factory'; $this->_factoryMock = new \stdClass(); $this->_objectManager = $this->getMock('Magento\\Framework\\ObjectManagerInterface'); $this->_objectManager->expects($this->atLeastOnce())->method('create')->with($this->equalTo($factoryName))->will($this->returnValue($this->_factoryMock)); $this->_config = $this->getMock('\\Magento\\Framework\\Filter\\FilterManager\\Config', ['getFactories'], [], '', false); $this->_config->expects($this->atLeastOnce())->method('getFactories')->will($this->returnValue([$factoryName])); $this->_filterManager = new \Magento\Framework\Filter\FilterManager($this->_objectManager, $this->_config); $method = new \ReflectionMethod('Magento\\Framework\\Filter\\FilterManager', 'getFilterFactories'); $method->setAccessible(true); $method->invoke($this->_filterManager); }
public function testGetFactories() { $expectedConfig = ['test' => 'test', 'Magento\\Framework\\Filter\\Factory', 'Magento\\Framework\\Filter\\ZendFactory']; $this->assertEquals($expectedConfig, $this->_config->getFactories()); }