protected function setUp() { $config = new \Magento\Framework\ObjectManager\Config\Config(new \Magento\Framework\ObjectManager\Relations\Runtime()); $factory = new Developer($config, null, null, ['first_param' => 'first_param_value', 'second_param' => 'second_param_value']); $this->_object = new \Magento\Framework\ObjectManager\ObjectManager($factory, $config); $factory->setObjectManager($this->_object); }
public function testCreateUsingReflection() { $type = 'Magento\\Framework\\ObjectManager\\Factory\\Fixture\\Polymorphous'; $definitions = $this->getMock('Magento\\Framework\\ObjectManager\\DefinitionInterface'); // should be more than defined in "switch" of create() method $definitions->expects($this->once())->method('getParameters')->with($type)->will($this->returnValue([['one', null, false, null], ['two', null, false, null], ['three', null, false, null], ['four', null, false, null], ['five', null, false, null], ['six', null, false, null], ['seven', null, false, null], ['eight', null, false, null], ['nine', null, false, null], ['ten', null, false, null]])); $factory = new Developer($this->config, null, $definitions); $result = $factory->create($type, ['one' => 1, 'two' => 2, 'three' => 3, 'four' => 4, 'five' => 5, 'six' => 6, 'seven' => 7, 'eight' => 8, 'nine' => 9, 'ten' => 10]); $this->assertSame(10, $result->getArg(9)); }