Exemple #1
0
 public function testSaveAttributeValueData()
 {
     $attributeMock = $this->mockModel('xcom_mapping/attribute');
     $attributeMock->expects($this->any())->method('getId')->will($this->returnValue('100500'));
     $data = array('channelValueDecorations' => array(array('channelId' => 'test_channel_id_1'), array('channelId' => 'test_channel_id_2')), 'id_key' => 'test_id_1', 'name_key' => 'test_name_1', 'locale' => array('country' => 'test_US', 'language' => 'test_en'));
     $attributeValueMock = $this->mockModel('xcom_mapping/attribute_value');
     $attributeValueMock->expects($this->any())->method('addData')->with($this->equalTo(array('mapping_attribute_id' => $attributeMock->getId(), 'channel_codes' => array('test_channel_id_1', 'test_channel_id_2'), 'value_id' => 'test_id_1', 'name' => 'test_name_1', 'locale_code' => 'test_en_test_US')))->will($this->returnValue($attributeValueMock));
     $attributeValueMock->expects($this->any())->method('save')->will($this->returnSelf());
     $attributeValueMock->expects($this->any())->method('getCollection')->will($this->returnValue($this->_mockAttributeValueCollection()));
     $this->_object->setBody($data);
     $result = $this->_object->saveAttributeValueData($attributeMock, $data, 'id_key', 'name_key');
     $this->assertInstanceOf($this->_instanceOf, $result);
 }