Example #1
0
    function test2()
    {
        $this->importVehiclesList('make, model, year
honda, ci-vic, 2000
honda, ci-vic, 2001');
        $finder = new VF_Vehicle_Finder(new VF_Schema());
        $vehicles = $finder->findByLevels(array('make' => 'honda', 'model' => 'ci-vic', 'year' => '2001'));
        $this->assertEquals(1, count($vehicles));
    }
    function testComma()
    {
        $importer = $this->vehiclesListImporter('"make", "model", "year"
"honda", "accord,civic", "2000,2003"');
        $importer->import();
        $vehicleFinder = new VF_Vehicle_Finder(new VF_Schema());
        $vehicles = $vehicleFinder->findByLevels(array('make' => 'honda'));
        $this->assertEquals(4, count($vehicles), 'should enumerate out options');
        $this->assertEquals('honda accord 2000', $vehicles[0]->__toString());
        $this->assertEquals('honda accord 2003', $vehicles[1]->__toString());
        $this->assertEquals('honda civic 2000', $vehicles[2]->__toString());
        $this->assertEquals('honda civic 2003', $vehicles[3]->__toString());
    }
 function explode($input)
 {
     $this->input = $input;
     if (!$this->hasWildCards()) {
         return array($input);
     }
     $this->result = array();
     $this->i = 0;
     $this->replaceAllWithWildcard();
     $result = array();
     $finder = new VF_Vehicle_Finder($this->getSchema());
     foreach ($finder->findByLevels($this->input) as $vehicle) {
         array_push($result, $vehicle->toTitleArray());
     }
     return $result;
 }
Example #4
0
 /**
  * @param Elite_Vaf_Model_Abstract - if is an "aggregrate" of fits ( iterate and add it's children )
  */
 function doAddFit($entity)
 {
     $vehicleFinder = new VF_Vehicle_Finder(new VF_Schema());
     $params = array($entity->getType() => $entity->getTitle());
     $vehicles = $vehicleFinder->findByLevels($params);
     return $vehicles;
 }