function testShouldMakeSafeOperations() { $this->createVehicle(array('year' => 2000, 'make' => 'Ford', 'model' => 'F-150', 'engine' => '1.6L')); $this->createVehicle(array('year' => 2000, 'make' => 'Ford', 'model' => 'F-150', 'engine' => '1.8L')); $this->createVehicle(array('year' => 2001, 'make' => 'Ford', 'model' => 'F-150', 'engine' => '1.6L')); // there is no 2001/Ford/F-150 with a 1.8L in this example $this->mappingsImport('sku, make, model, year, engine' . "\n" . 'sku,Ford,F-150,"2000,2001,2002",{{all}}'); $product = new VF_Product(); $product->setId($this->product_id); $fits = $product->getFits(); $this->assertEquals(3, count($fits), 'should not a non-existant vehicle even it is implied'); }
function testBlowoutMultipleColumn() { $this->importVehiclesList($this->vehiclesList); $this->mappingsImport('sku, make, model, year sku, honda, {{all}}, {{all}}'); $product = new VF_Product(); $product->setId($this->product_id); $fits = $product->getFits(); $this->assertEquals(3, count($fits), 'should blow out options'); $this->assertEquals('civic', $fits[0]->model); $this->assertEquals('accord', $fits[1]->model); $this->assertEquals('2000', $fits[1]->year); $this->assertEquals('accord', $fits[2]->model); $this->assertEquals('2001', $fits[2]->year); }