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'); }
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"'); }
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'); }
$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>
function insertMapping(VF_Vehicle $vehicle) { $mapping = new VF_Mapping($this->getId(), $vehicle); return $mapping->save(); }
/** * @expectedException Exception */ function testRequiresProduct() { $vehicle = $this->createMMY(); $mapping = new VF_Mapping( 0, $vehicle ); $mapping_id = $mapping->save(); }
/** @return integer the created fit's ID */ protected function insertMappingMMTC($vehicle, $product_id = 1) { $mapping = new VF_Mapping($product_id, $vehicle); return $mapping->save(); }