public function testProcessMultiple() { $mapping = array(0 => 'attribute.type', 1 => 'attribute.code', 2 => 'product.list.type'); $data = array(0 => 'color', 1 => "white\nblack\naimeos", 2 => 'variant'); $product = $this->_create('job_csv_test'); $object = new Controller_Common_Product_Import_Csv_Processor_Catalog_Default($this->_context, $mapping, $this->_endpoint); $result = $object->process($product, $data); $product = $this->_get('job_csv_test'); $this->_delete($product); $pos = 0; $codes = array('white', 'black', 'aimeos'); foreach ($product->getListItems() as $listItems) { $this->assertEquals(3, count($listItems)); foreach ($listItems as $listItem) { $this->assertEquals(1, $listItem->getStatus()); $this->assertEquals('attribute', $listItem->getDomain()); $this->assertEquals('variant', $listItem->getType()); $this->assertEquals($codes[$pos], $listItem->getRefItem()->getCode()); $pos++; } } }
public function testProcessListtypes() { $mapping = array(0 => 'catalog.list.type', 1 => 'catalog.code', 2 => 'catalog.list.type', 3 => 'catalog.code'); $data = array(0 => 'promotion', 1 => 'job_csv_test', 2 => 'default', 3 => 'job_csv_test'); $this->_context->getConfig()->set('controller/common/product/import/csv/processor/catalog/listtypes', array('default')); $category = $this->_create('job_csv_test'); $object = new Controller_Common_Product_Import_Csv_Processor_Catalog_Default($this->_context, $mapping, $this->_endpoint); $result = $object->process(self::$_product, $data); $category = $this->_get('job_csv_test'); $this->_delete($category); $listItems = $category->getListItems(); $listItem = reset($listItems); $this->assertEquals(1, count($listItems)); $this->assertInstanceOf('MShop_Common_Item_List_Interface', $listItem); $this->assertEquals('default', $listItem->getType()); $this->assertEquals('job_csv_prod', $listItem->getRefItem()->getCode()); }