コード例 #1
0
ファイル: MappingTest.php プロジェクト: vehiclefits/library
 function testShouldSaveMappingInSecondSchema()
 {
     $schema = VF_Schema::create('foo,bar');
     $vehicle = $this->createVehicle(array('foo' => '123', 'bar' => '456'), $schema);
     $mapping = new VF_Mapping(1, $vehicle);
     $id = $mapping->save();
     $this->assertTrue($id > 0, 'should save mapping in second schema');
 }
コード例 #2
0
 function testShuoldListFromSecondSchema()
 {
     $schema = VF_Schema::create('foo,bar');
     $vehicle = $this->createVehicle(array('foo' => '123', 'bar' => '456'), $schema);
     $mapping = new VF_Mapping(1, $vehicle);
     $mapping->save();
     $foo = new VF_Level('foo', null, $schema);
     $actual = $foo->listInUse();
     $this->assertEquals('123', $actual[0], 'should list for level in 2nd schema "foo"');
 }
コード例 #3
0
 function testShouldListChildLevel_WhenCalledFromBackend()
 {
     $schema = VF_Schema::create('foo,bar');
     $vehicle = $this->createVehicle(array('foo' => '123', 'bar' => '456'), $schema);
     $mapping = new VF_Mapping(1, $vehicle);
     $mapping->save();
     ob_start();
     $_GET['requestLevel'] = 'bar';
     $_GET['foo'] = $vehicle->getValue('bar');
     $ajax = new VF_Ajax();
     $ajax->execute($schema);
     $actual = ob_get_clean();
     $this->assertEquals('<option value="' . $vehicle->getValue('bar') . '">456</option>', $actual, 'should list child levels from 2nd schema');
 }
コード例 #4
0
$schemaGenerator = new VF_Schema_Generator();
$schemaGenerator->dropExistingTables();
$schemaGenerator->execute(array('make','model type','year'));

$schema = new VF_Schema();

$vehicle = VF_Vehicle::create( $schema, array(
    'make' => 'Honda_Unique'.uniqid(),
    'model type' => 'Civic',
    'year' => '2002'
));
$vehicle->save();

$values = $vehicle->toValueArray();

$mapping = new VF_Mapping( 1, $vehicle );
$mapping->save();

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
      "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <link rel="stylesheet" href="../qunit/qunit.css" type="text/css"/>
  </head>
  <body>
    <h1 id="qunit-header">VAF - Space</h1>
    <h2 id="qunit-banner"></h2>
    <h2 id="qunit-userAgent"></h2>
    <ol id="qunit-tests">
    </ol>
コード例 #5
0
ファイル: Product.php プロジェクト: vehiclefits/library
 function insertMapping(VF_Vehicle $vehicle)
 {
     $mapping = new VF_Mapping($this->getId(), $vehicle);
     return $mapping->save();
 }
コード例 #6
0
 /**
 * @expectedException Exception
 */
 function testRequiresProduct()
 {
     $vehicle = $this->createMMY();
     $mapping = new VF_Mapping( 0, $vehicle );
     $mapping_id = $mapping->save();
 }
コード例 #7
0
 /** @return integer the created fit's ID */
 protected function insertMappingMMTC($vehicle, $product_id = 1)
 {
     $mapping = new VF_Mapping($product_id, $vehicle);
     return $mapping->save();
 }