function testSaveParenetheses() { $schema = VF_Schema::create('foo,bar'); $vehicle = VF_Vehicle::create($schema, array('foo' => 'valfoo', 'bar' => 'valbar')); $vehicle->save(); $vehicleExists = $this->vehicleExists(array('foo' => 'valfoo', 'bar' => 'valbar'), false, $schema); $this->assertTrue($vehicleExists, 'should find vehicles in different schema'); }
function testSaveParenetheses() { return $this->markTestIncomplete(); $schema = VF_Schema::create('foo,bar'); $vehicle = VF_Vehicle::create($schema, array('foo'=>'valfoo','bar'=>'valbar')); $vehicle->save(); $this->assertTrue($this->vehicleExists(array('foo'=>'valfoo','bar'=>'valbar')), 'should find vehicles in different schema' ); }
function main() { $schema = new VF_Schema(); $schemaGenerator = new VF_Schema_Generator(); $schemaGenerator->dropExistingTables(); $schemaGenerator->execute(array('make', 'model', 'year')); for ($i = 2000; $i <= 2010; $i++) { $vehicleParts = array('make' => 'Honda', 'model' => 'Civic', 'year' => $i); $vehicle = VF_Vehicle::create($schema, $vehicleParts); $vehicle->save(); echo "Created vehicle {$vehicle} \n"; } }
function apply(VF_Vehicle $descendant) { $titles = $descendant->toTitleArray(); $levelsToReplace = $this->getSchema()->getPrevLevelsIncluding($this->grain); foreach ($levelsToReplace as $levelToReplace) { $replacementTitle = $this->vehicle()->getLevel($levelToReplace)->getTitle(); $titles[$levelToReplace] = $replacementTitle; } foreach ($this->newTitles as $replacementTitle) { $titles[$this->grain] = $replacementTitle; $new_vehicle = VF_Vehicle::create($this->getSchema(), $titles); $new_vehicle->save(); $this->mergeFitments($descendant, $new_vehicle); } }
function saveAction() { $dataToSave = $this->requestLevels(); $vehiclesFinder = new \VF_Vehicle_Finder(new \VF_Schema()); $vehicle = $vehiclesFinder->findOneByLevelIds($dataToSave, \VF_Vehicle_Finder::INCLUDE_PARTIALS); if ($vehicle) { $dataToSave = $vehicle->toTitleArray(); } else { $dataToSave = array(); } $dataToSave[$this->params()->fromQuery('entity')] = $this->params()->fromQuery('title'); $vehicle = \VF_Vehicle::create(new \VF_Schema(), $dataToSave); $vehicle->save(); if (1 || $this->getRequest()->isXmlHttpRequest()) { echo $vehicle->getValue($this->params()->fromQuery('entity')); exit; } }
* @copyright Copyright (c) 2013 Vehicle Fits, llc * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ require_once '../config.default.php'; require_once(getenv('PHP_MAGE_PATH').'/app/code/local/Elite/Vaf/bootstrap-tests.php'); $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"/>
* versions in the future. If you wish to customize Vehicle Fits for your * needs please refer to http://www.vehiclefits.com for more information. * @copyright Copyright (c) 2013 Vehicle Fits, llc * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ if (file_exists('../config.php')) { require_once '../config.php'; } else { require_once '../config.default.php'; } require_once getenv('PHP_MAGE_PATH') . '/app/code/local/Elite/Vaf/bootstrap-tests.php'; $schemaGenerator = new VF_Schema_Generator(); $schemaGenerator->dropExistingTables(); $schemaGenerator->execute(array('make', 'model', 'chassis', 'trim')); $schema = VF_Singleton::getInstance()->schema(); $vehicle = VF_Vehicle::create($schema, array('make' => 'Honda_Unique' . uniqid(), 'model' => 'Civic', 'chassis' => 'chassis', 'trim' => 'trim')); $vehicle->save(); $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">Vehicle Fits - MMTC</h1> <h2 id="qunit-banner"></h2> <h2 id="qunit-userAgent"></h2> <ol id="qunit-tests">
function merge_vehicle($slave_vehicle, $master_vehicle) { $titles = $slave_vehicle->toTitleArray(); $levelsToReplace = $this->getSchema()->getPrevLevelsIncluding($this->operatingGrain()); foreach ($levelsToReplace as $levelToReplace) { $titles[$levelToReplace] = $master_vehicle->getLevel($levelToReplace)->getTitle(); } $new_vehicle = VF_Vehicle::create($this->getSchema(), $titles); $new_vehicle->save(); $this->mergeFitments($slave_vehicle, $new_vehicle); }
function saveAction() { $schema = new VF_Schema($this->getRequest()->getParam('schema')); $dataToSave = $this->requestLevels(); $vehiclesFinder = new VF_Vehicle_Finder($schema); $vehicle = $vehiclesFinder->findOneByLevelIds($dataToSave, VF_Vehicle_Finder::INCLUDE_PARTIALS); if ($vehicle) { $dataToSave = $vehicle->toTitleArray(); } else { $dataToSave = array(); } $dataToSave[$this->getRequest()->getParam('entity')] = $this->getRequest()->getParam('title'); $vehicle = VF_Vehicle::create($schema, $dataToSave); $vehicle->save(); if ($this->getRequest()->isXmlHttpRequest()) { echo $vehicle->getValue($this->getRequest()->getParam('entity')); exit; } $this->doSave(); }
require_once '../config.default.php'; } require_once getenv('PHP_MAGE_PATH') . '/app/code/local/Elite/Vaf/bootstrap-tests.php'; $schemaGenerator = new VF_Schema_Generator(); $schemaGenerator->dropExistingTables(); $schemaGenerator->execute(array('make', 'model', 'year')); $schema = VF_Singleton::getInstance()->schema(); $vehicle0 = VF_Vehicle::create($schema, array('make' => 'Ford', 'model' => 'F-150', 'year' => '2000')); $vehicle0->save(); $mapping = new VF_Mapping(1, $vehicle0); $mapping->save(); $vehicle1 = VF_Vehicle::create($schema, array('make' => 'Honda', 'model' => 'Civic', 'year' => '2002')); $vehicle1->save(); $mapping = new VF_Mapping(1, $vehicle1); $mapping->save(); $vehicle2 = VF_Vehicle::create($schema, array('make' => 'Honda', 'model' => 'Accord', 'year' => '2003')); $vehicle2->save(); $mapping = new VF_Mapping(1, $vehicle2); $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 - MMY</h1> <h2 id="qunit-banner"></h2> <h2 id="qunit-userAgent"></h2> <ol id="qunit-tests">
protected function createMMTC($makeTitle = 'test make', $modelTitle = 'test model', $trimTitle = 'test trim', $chassisTitle = 'test chassis') { $vehicle = VF_Vehicle::create(new VF_Schema(), array('make' => $makeTitle, 'model' => $modelTitle, 'trim' => $trimTitle, 'chassis' => $chassisTitle)); $vehicle->save(); return $vehicle; }
* @copyright Copyright (c) 2013 Vehicle Fits, llc * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ if (file_exists('../config.php')) { require_once '../config.php'; } else { require_once '../config.default.php'; } require_once getenv('PHP_MAGE_PATH') . '/app/code/local/Elite/Vaf/bootstrap-tests.php'; $schemaGenerator = new VF_Schema_Generator(); $schemaGenerator->dropExistingTables(); $schemaGenerator->execute(array('make', 'model', 'year')); $schema = new VF_Schema(); $vehicle = VF_Vehicle::create($schema, array('make' => 'Honda', 'model' => 'Civic', 'year' => '2001')); $vehicle->save(); $vehicle = VF_Vehicle::create($schema, array('make' => 'Honda', 'model' => '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 - MMY</h1> <h2 id="qunit-banner"></h2> <h2 id="qunit-userAgent"></h2>
if (file_exists('../config.php')) { require_once '../config.php'; } else { require_once '../config.default.php'; } require_once getenv('PHP_MAGE_PATH') . '/app/code/local/Elite/Vaf/bootstrap-tests.php'; file_put_contents(sys_get_temp_dir() . '/vf-ajax-tests', '1'); $schemaGenerator = new VF_Schema_Generator(); $schemaGenerator->dropExistingTables(); $schemaGenerator->execute(array('make', 'model', 'year')); $schema1 = new VF_Schema(1); $schema2 = VF_Schema::create('foo,bar'); $vehicle = VF_Vehicle::create($schema1, array('make' => 'Honda_Unique' . uniqid(), 'model' => 'Civic', 'year' => '2002')); $vehicle->save(); $values = $vehicle->toValueArray(); $vehicle2 = VF_Vehicle::create($schema2, array('foo' => 123, 'bar' => 456)); $vehicle2->save(); $values2 = $vehicle2->toValueArray(); ?> <!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"/> <link rel="stylesheet" href="/skin/adminhtml/default/default/multiTree.css" type="text/css"/> </head> <body> <h1 id="qunit-header">VAF - Multi Tree</h1> <h2 id="qunit-banner"></h2> <h2 id="qunit-userAgent"></h2> <ol id="qunit-tests">