/** * Test for method getBehavior() with $rowData argument = null * * @covers Mage_ImportExport_Model_Import_EntityAbstract::getBehavior * * @dataProvider dataProviderForTestGetBehaviorWithRowData * @param $inputBehavior * @param $rowData * @param $expectedBehavior * @param null $availableBehaviors */ public function testGetBehaviorWithRowData($inputBehavior, $rowData, $expectedBehavior, $availableBehaviors = null) { $property = new ReflectionProperty($this->_model, '_availableBehaviors'); $property->setAccessible(true); if (isset($availableBehaviors)) { $property->setValue($this->_model, $availableBehaviors); } else { $property->setValue($this->_model, $this->_availableBehaviors); } $this->_model->setParameters(array('behavior' => $inputBehavior)); $this->assertSame($expectedBehavior, $this->_model->getBehavior($rowData)); }
/** * Set data from outside to change behavior * * @param array $parameters * @return Mage_ImportExport_Model_Import_Entity_CustomerComposite */ public function setParameters(array $parameters) { parent::setParameters($parameters); if ($this->getBehavior() == Mage_ImportExport_Model_Import::BEHAVIOR_APPEND) { $parameters['behavior'] = Mage_ImportExport_Model_Import::BEHAVIOR_ADD_UPDATE; } $this->_customerEntity->setParameters($parameters); $this->_addressEntity->setParameters($parameters); return $this; }