Exemplo n.º 1
0
 public function testProcessMultiple()
 {
     $mapping = array(0 => 'attribute.type', 1 => 'attribute.code', 2 => 'product.lists.type');
     $data = array(0 => 'color', 1 => "white\nblack\naimeos", 2 => 'variant');
     $product = $this->create('job_csv_test');
     $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Catalog\Standard($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++;
         }
     }
 }
Exemplo n.º 2
0
 public function testProcessListtypes()
 {
     $mapping = array(0 => 'catalog.lists.type', 1 => 'catalog.code', 2 => 'catalog.lists.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 \Aimeos\Controller\Common\Product\Import\Csv\Processor\Catalog\Standard($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('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem);
     $this->assertEquals('default', $listItem->getType());
     $this->assertEquals('job_csv_prod', $listItem->getRefItem()->getCode());
 }