Exemple #1
0
 public function testSaveProductType()
 {
     $data = array('id' => "22", 'name' => 'test_name', 'version' => 'test_version', 'description' => 'test_description', 'productClassIds' => array('1', '2', '3'), 'locale' => array('country' => 'test_US', 'language' => 'test_en'));
     $productTypeMock = $this->mockModel('xcom_mapping/product_type');
     $expectedData = $data;
     $expectedData['product_type_id'] = (int) $data['id'];
     $expectedData['locale_code'] = 'test_en_test_US';
     $expectedData['product_class_ids'] = array('1', '2', '3');
     unset($expectedData['id']);
     unset($expectedData['locale']);
     unset($expectedData['productClassIds']);
     $productTypeMock->expects($this->any())->method('addData')->with($this->equalTo($expectedData))->will($this->returnValue($productTypeMock));
     $productTypeMock->expects($this->any())->method('save')->will($this->returnValue($productTypeMock));
     $this->_object->setBody($data);
     $result = $this->_object->saveProductType($productTypeMock, $data);
     $this->assertInstanceOf($this->_instanceOf, $result);
 }