32 $factoryName = \Magento\Framework\Filter\Factory::class;
33 $this->_factoryMock = $this->createPartialMock($factoryName, [
'canCreateFilter',
'createFilter']);
34 $this->_objectManager = $this->createMock(\
Magento\Framework\ObjectManagerInterface::class);
35 $this->_objectManager->expects(
40 $this->equalTo($factoryName)
42 $this->returnValue($this->_factoryMock)
45 $this->createPartialMock(\
Magento\Framework\Filter\
FilterManager\Config::class, [
'getFactories']);
46 $this->_config->expects(
51 $this->returnValue([$factoryName])
53 $this->_filterManager = new \Magento\Framework\Filter\FilterManager($this->_objectManager, $this->_config);
60 new \ReflectionMethod(\
Magento\Framework\Filter\FilterManager::class,
'getFilterFactories');
62 $this->assertEquals([$this->_factoryMock],
$method->invoke($this->_filterManager));
71 $factoryName = \Magento\Framework\Filter\Factory::class;
72 $this->_factoryMock = new \stdClass();
73 $this->_objectManager = $this->createMock(\
Magento\Framework\ObjectManagerInterface::class);
74 $this->_objectManager->expects(
79 $this->equalTo($factoryName)
81 $this->returnValue($this->_factoryMock)
84 $this->createPartialMock(\
Magento\Framework\Filter\
FilterManager\Config::class, [
'getFactories']);
85 $this->_config->expects(
90 $this->returnValue([$factoryName])
92 $this->_filterManager = new \Magento\Framework\Filter\FilterManager($this->_objectManager, $this->_config);
94 $method = new \ReflectionMethod(\
Magento\Framework\Filter\FilterManager::class,
'getFilterFactories');
96 $method->invoke($this->_filterManager);
102 $filterMock = $this->getMockBuilder(
'FactoryInterface')->getMock();
105 $method = new \ReflectionMethod(\
Magento\Framework\Filter\FilterManager::class,
'createFilterInstance');
107 $this->assertEquals($filterMock,
$method->invoke($this->_filterManager,
'alias', [
'123']));
117 $filterAlias =
'wrongAlias';
118 $this->_factoryMock->expects(
123 $this->equalTo($filterAlias)
125 $this->returnValue(
false)
128 $method = new \ReflectionMethod(\
Magento\Framework\Filter\FilterManager::class,
'createFilterInstance');
130 $method->invoke($this->_filterManager, $filterAlias, []);
140 $this->_factoryMock->expects(
147 $this->returnValue(
true)
150 $this->_factoryMock->expects(
158 $this->returnValue($filter)
166 $filterMock = $this->getMockBuilder(
'FactoryInterface')->setMethods([
'filter'])->getMock();
167 $filterMock->expects(
174 $this->returnValue(
$value)
177 $this->assertEquals(
$value, $this->_filterManager->alias(
$value, [
'123']));
configureFactoryMock($filter, $alias, $arguments=[])
testCreateFilterInstance()
testGetFilterFactoriesWrongInstance()
testCreateFilterInstanceWrongAlias()