示例#1
0
 /**
  * @param array $row
  * @param VF_Vehicle|boolean the vehicle, false if none (for example, when setting a product as universal)
  */
 function doImportRow($row, $vehicle)
 {
     $boltPattern = $this->getFieldValue('bolt_pattern', $row);
     $offset = $this->getFieldValue('offset', $row);
     $boltPattern = VF_Wheel_BoltPattern::create($boltPattern, $offset);
     $wheelDefinition = new VF_Wheel_Vehicle($vehicle);
     $wheelDefinition->addBoltPattern($boltPattern);
 }
 /**
  * @expectedException Elite_Vaf_Model_Merge_Exception_IncompatibleVehicleAttribute
  */
 function testShouldPreventOperation()
 {
     $vehicle1 = $this->createMMY('Honda', 'Civic', '2000');
     $vehicle2 = $this->createMMY('Honda', 'Civic', '2001');
     $wheelVehicle1 = new VF_Wheel_Vehicle($vehicle1);
     $wheelVehicle1->save();
     $wheelVehicle1->addBoltPattern($this->boltPattern('4x114.3'));
     $wheelVehicle2 = new VF_Wheel_Vehicle($vehicle2);
     $wheelVehicle2->save();
     $wheelVehicle2->addBoltPattern($this->boltPattern('5x114'));
     $slaveLevels = array(array('year', $vehicle1), array('year', $vehicle2));
     $masterLevel = array('year', $vehicle2);
     $this->merge($slaveLevels, $masterLevel);
 }
示例#3
0
 function testShouldDuplicateWheel()
 {
     $vehicle = $this->createMMY('Honda', 'Civic', '2000');
     $wheelVehicle = new VF_Wheel_Vehicle($vehicle);
     $wheelVehicle->save();
     $wheelVehicle->addBoltPattern($this->boltPattern('4x114.3'));
     $this->split($vehicle, 'year', array('2000', '2001'));
     $one = $this->vehicleFinder()->findOneByLevels(array('make' => 'Honda', 'model' => 'Civic', 'year' => '2000'));
     $wheelVehicle1 = new VF_Wheel_Vehicle($one);
     $two = $this->vehicleFinder()->findOneByLevels(array('make' => 'Honda', 'model' => 'Civic', 'year' => '2000'));
     $wheelVehicle2 = new VF_Wheel_Vehicle($two);
     $this->assertEquals(4, $wheelVehicle1->boltPattern()->lug_count, 'SPLIT Should copy wheel (bolt pattern) to each resultant vehicle.');
     $this->assertEquals(114.3, $wheelVehicle1->boltPattern()->bolt_distance, 'SPLIT Should copy wheel (bolt pattern) to each resultant vehicle.');
     $this->assertEquals(4, $wheelVehicle2->boltPattern()->lug_count, 'SPLIT Should copy wheel (bolt pattern) to each resultant vehicle.');
     $this->assertEquals(114.3, $wheelVehicle2->boltPattern()->bolt_distance, 'SPLIT Should copy wheel (bolt pattern) to each resultant vehicle.');
 }
示例#4
0
 function testShouldNotAddWhenOffsetDoesntFit()
 {
     $wheelVehicle = new VF_Wheel_Vehicle($this->createMMY());
     $wheelVehicle->save();
     $wheelVehicle->addBoltPattern($this->boltPattern('4x114.3', 20));
     $wheelProduct = $this->newWheelProduct();
     $wheelProduct->setId(1);
     $wheelProduct->addBoltPattern($this->boltPattern('4x114.3', 42));
     $this->assertEquals(0, count($wheelProduct->getFits()), 'should not add when offset does not matche');
 }