Пример #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);
 }
Пример #2
0
 function testShouldImportANSI()
 {
     return $this->markTestIncomplete();
     $importer = new VF_Wheel_Importer_Definitions_Bolts(dirname(__FILE__) . '/bolts_small-ansi.csv');
     $importer->import();
     $vehicle = $this->vehicleFinder()->findOneByLevels(array('make' => 'PROTÉGÉ', 'model' => '2.2', 'trim' => 'base', 'year' => 1995));
     $vehicle = new VF_Wheel_Vehicle($vehicle);
     $this->assertEquals(4, $vehicle->boltPattern()->lug_count, 'should import');
 }
Пример #3
0
 function ensureCompatible($slaveVehicles, $masterVehicle)
 {
     $masterVehicle = new VF_Wheel_Vehicle($masterVehicle);
     foreach ($slaveVehicles as $slaveVehicle) {
         $slaveVehicle = new VF_Wheel_Vehicle($slaveVehicle);
         if ($masterVehicle->boltPattern() != $slaveVehicle->boltPattern()) {
             throw new Elite_Vaf_Model_Merge_Exception_IncompatibleVehicleAttribute('bolt patterns dont match');
         }
     }
 }
Пример #4
0
 /**
  * @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);
 }
Пример #5
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.');
 }
Пример #6
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');
 }