本文整理汇总了PHP中VF_Singleton类的典型用法代码示例。如果您正苦于以下问题:PHP VF_Singleton类的具体用法?PHP VF_Singleton怎么用?PHP VF_Singleton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VF_Singleton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testShouldReturnInjectedDatabase
function testShouldReturnInjectedDatabase()
{
$database = new VF_TestDbAdapter(array('dbname' => VAF_DB_NAME, 'username' => VAF_DB_USERNAME, 'password' => VAF_DB_PASSWORD));
$singleton = new VF_Singleton();
$singleton->setReadAdapter($database);
$this->assertSame($database, $singleton->getReadAdapter(), 'should return injected database');
}
示例2: testNewRequest
function testNewRequest()
{
$singleton = new VF_Singleton();
$request = $singleton->getRequest();
// make sure it doesn't run Magento specific code here
$this->assertNull($request);
// we won't get here if it did.
}
示例3: testSelection
function testSelection()
{
$vehicle = $this->createMMY(self::MAKE, self::MODEL, self::YEAR);
$request = $this->getRequest($vehicle->toValueArray());
$helper = new VF_Singleton();
$helper->setRequest($request);
$vehicle = $helper->vehicleSelection();
$this->assertMMYTitlesEquals(self::MAKE, self::MODEL, self::YEAR, $vehicle);
}
示例4: testCount1
function testCount1()
{
$sitemap = new Elite_Vafsitemap_Model_Sitemap_Vehicle(VF_Singleton::getInstance()->getConfig());
$vehicle = $this->createMMTC();
$this->insertMappingMMTC($vehicle);
$this->assertEquals(1, $sitemap->vehicleCount());
}
示例5: testShouldCreateSchemaOverCommandLine
function testShouldCreateSchemaOverCommandLine()
{
$command = __DIR__ . '/vf schema --force --levels="year,make,model"';
exec($command);
$schema = VF_Singleton::getInstance()->schema();
$this->assertEquals(array('year', 'make', 'model'), $schema->getLevels(), 'should create default schema of MMY');
}
示例6: doSetUp
function doSetUp()
{
$this->switchSchema('make,model,year');
$this->expectedDefinition = $this->createMMY();
$this->setRequestParams($this->expectedDefinition->toValueArray());
$this->sitemap = new Elite_Vafsitemap_Model_Sitemap_Product_Sub(VF_Singleton::getInstance()->getConfig());
}
示例7: listAction
function listAction()
{
$helper = VF_Singleton::getInstance();
$helper->setRequest($this->getRequest());
$helper->storeFitInSession();
if (!$helper->vehicleSelection() || !$helper->getProductIds()) {
return $this->redirectToHomePage();
}
$this->myLoadLayout();
switch (VF_Singleton::getInstance()->getConfig()->homepagesearch->mode) {
case 'grid':
// set in layout.xml
break;
default:
case 'group':
// unset the grid block added from layout.xml
$this->getLayout()->getBlock('content')->unsetChild('vaf_products');
$block = $this->createBlock('vaf/product_result_group', 'vaf_products');
$this->appendBlock($block);
break;
case 'category':
// unset the grid block added from layout.xml
$this->getLayout()->getBlock('content')->unsetChild('vaf_products');
$block = $this->createBlock('vaf/product_result_group2', 'vaf_products');
$this->appendBlock($block);
break;
case 'group3':
// unset the grid block added from layout.xml
$this->getLayout()->getBlock('content')->unsetChild('vaf_products');
$block = $this->createBlock('vaf/product_result_group3', 'vaf_products');
$this->appendBlock($block);
break;
}
$this->renderLayout();
}
示例8: testGetProductIDsWithSpace
function testGetProductIDsWithSpace()
{
$vehicle2 = $this->createMMY('Ford', 'F 150', '2000');
$this->insertMappingMMY($vehicle2, 2);
$this->setRequestParams($vehicle2->toTitleArray());
$this->assertEquals(array(2), VF_Singleton::getInstance()->getProductIds());
}
示例9: getConfig
function getConfig()
{
if (!$this->config instanceof Zend_Config) {
$this->config = VF_Singleton::getInstance()->getConfig();
}
return $this->config;
}
示例10: testDefinitionsMMY
function testDefinitionsMMY()
{
$sitemap = new Elite_Vafsitemap_Model_Sitemap_Vehicle(VF_Singleton::getInstance()->getConfig());
$vehicles = $sitemap->getDefinitions(10);
$this->assertTrue($vehicles[0] instanceof VF_Vehicle);
$this->assertNotEquals(0, (int) $vehicles[0]->getLevel('year')->getId());
}
示例11: block
protected function block($config = array(), $request)
{
$block = new Elite_Vaf_Block_Search_SubmitTestSub();
$block->setConfig($this->config($config));
VF_Singleton::getInstance()->setRequest($request);
return $block;
}
示例12: indexAction
function indexAction()
{
if (!VF_Singleton::getInstance()->getConfig()->seo->htmlSitemap) {
return;
}
$this->loadLayoutAndBlock();
}
示例13: getSelections
function getSelections()
{
$startTime = time();
$vehicle = VF_Singleton::getInstance()->vehicleSelection();
if (Mage::app()->getStore()->isAdmin()) {
return $this->getData('selections');
}
if (!$this->superProductFits($vehicle)) {
return $this->getData('selections');
}
$selections = $this->getData('selections');
if (!$selections) {
return;
}
if ($vehicle && $vehicle->getLeafValue()) {
$productIds = VF_Singleton::getInstance()->getProductIds();
$return = array();
foreach ($selections as $product) {
if (in_array($product->getId(), $productIds)) {
array_push($return, $product);
}
}
return $return;
}
$endTime = time();
var_dump($endTime - $startTime);
exit;
return $selections;
}
示例14: testShouldClearFromSession
function testShouldClearFromSession()
{
$flexibleSearch = $this->flexibleWheeladapterSearch(array('wheel_stud_spread' => '114.3'));
VF_Singleton::getInstance()->storeFitInSession();
$flexibleSearch = $this->flexibleWheeladapterSearch(array('wheel_stud_spread' => '0'));
VF_Singleton::getInstance()->storeFitInSession();
$this->assertNull($this->flexibleWheeladapterSearch()->wheelSideStudSpread(), 'should clear wheel side stud spread from session');
}
示例15: testShouldClearFromSession
function testShouldClearFromSession()
{
$flexibleSearch = $this->flexibleTireSearch(array('section_width' => '205', 'aspect_ratio' => '55', 'diameter' => '16'));
VF_Singleton::getInstance()->storeFitInSession();
$flexibleSearch = $this->flexibleTireSearch(array('section_width' => '0', 'aspect_ratio' => '0', 'diameter' => '0'));
VF_Singleton::getInstance()->storeFitInSession();
$this->assertNull($this->flexibleTireSearch()->diameter(), 'should clear diameter from session');
}