Пример #1
0
 function testShouldImportName()
 {
     $csv = "name\n";
     $csv .= 'foo';
     $importer = new Importer($this->db);
     $importer->importFromText($csv);
     $categoryMapper = new \Metator\Category\DataMapper($this->db);
     $categories = $categoryMapper->findAll();
     $this->assertEquals('foo', $categories[0]['name'], 'should add a new category by name');
 }
Пример #2
0
 function testShouldNotCreateDuplicateCategory()
 {
     $categoryMapper = new \Metator\Category\DataMapper($this->db);
     $id = $categoryMapper->save(['name' => 'test']);
     $csv = "sku,name,base_price,attributes,categories\n";
     $csv .= '123,name,0,null,test';
     $importer = new Importer($this->db);
     $importer->importFromText($csv);
     $categoryMapper = new \Metator\Category\DataMapper($this->db);
     $categories = $categoryMapper->findAll();
     $this->assertEquals(1, count($categories), 'should not create duplicate categories');
 }