function testIsDefaultDbDSNAvailable() { $tools = new lmbDbTools(); $tools->setDefaultDbDSN("mysql://localhost/test"); $this->assertTrue($tools->isDefaultDbDSNAvailable()); $toolkit = lmbToolkit::save(); $tools = new lmbDbTools(); $toolkit->setConf('db', new ExceptionalDbConfStub()); $this->assertFalse($tools->isDefaultDbDSNAvailable()); lmbToolkit::restore(); }
function tearDown() { $this->_cleanUp(); $this->conn->disconnect(); lmbToolkit::restore(); $connection = lmbToolkit::instance()->getDefaultDbConnection(); if (method_exists($connection, 'isValid')) { if (!$connection->isValid()) { $connection->connect(); } } }
function testUseRussianAsCurrentLocale() { $toolkit = lmbToolkit::save(); $toolkit->addLocaleObject(new lmbLocale('ru_RU', new lmbIni(dirname(__FILE__) . '/../../../i18n/locale/ru_RU.ini'))); $date = new lmbDateTime('2004-12-20 10:15:30'); $time = $date->getStamp(); $code = '{$#var|i18n_date:"ru_RU", "stamp"}'; $tpl = $this->_createMacroTemplate($code, 'tpl.html'); $tpl->set('var', $time); $out = $tpl->render(); $this->assertEqual($out, '20.12.2004'); lmbToolkit::restore(); }
function testIsRequestAvailableInControllerConstructor() { //this is quite a "hacky" trick which removes the fixture toolkit, this should be refactored //alas, this means the whole test suite must be reconsidered as well lmbToolkit::restore(); lmbToolkit::save(); $dispatched_params = array('controller' => 'RememberRequestParams', 'param' => 150); $this->_setUpMocks($dispatched_params); $this->filter->run($this->chain); $controller = $this->toolkit->getDispatchedController(); $this->assertEqual($controller->param, $dispatched_params['param']); //trick again... lmbToolkit::restore(); lmbToolkit::save(); }
function tearDown() { lmbToolkit::restore(); }
function tearDown() { $this->_cleanUp(); lmbToolkit::restore(); }
function testTranslateSubstituteParametersDefaultContext() { $toolkit = lmbToolkit::save(); $back = new lmbQtDictionaryBackend(); $back->setSearchPath($translations_dir = LIMB_VAR_DIR . '/translations'); $toolkit->setDictionaryBackend($back); $xml = <<<EOD <?xml version="1.0"?> <!DOCTYPE TS><TS> <context> <message> <source>Hello {name}</source> <translation>Привет {name}</translation> </message> </context> </TS> EOD; file_put_contents($translations_dir . '/default.ru_RU.ts', $xml); $toolkit->setLocale('ru_RU'); $this->assertEqual(lmb_i18n('Hello {name}', array('{name}' => 'Bob')), 'Привет Bob'); lmbToolkit::restore(); }
function testOverloadGetterByTools() { lmbToolkit::save(); $toolkit = lmbToolkit::setup(new TestTools()); $toolkit->set('var', 'value1'); $this->assertEqual($toolkit->getVar(), 'value1'); lmbToolkit::save(); $toolkit->setVar('value2'); $this->assertEqual($toolkit->getVar(), 'value2'); lmbToolkit::restore(); $this->assertEqual($toolkit->get('var'), 'value1'); lmbToolkit::restore(); }
function tearDown() { $this->db->delete('test_db_table'); lmbToolkit::restore(); }
function tearDown() { $this->cache_writer->flushAll(); lmbToolkit::restore(); }
function tearDown() { lmbToolkit::restore(); lmbFs::rm($this->application_configs_dir); lmbFs::rm($this->package_configs_dir); }
function tearDown() { $this->locator->clearTestingTemplates(); lmbToolkit::restore(); }
function testDBEUseRussianAsCurrentLocale() { $toolkit = lmbToolkit::save(); $toolkit->addLocaleObject(new lmbLocale('ru', new lmbIni(dirname(__FILE__) . '/../ru.ini'))); $date = new lmbDateTime('2005-01-20 10:15:30'); $template = '{$var|i18n_date:"ru", "stamp"}'; $this->registerTestingTemplate('/limb/locale_date_filter_dbe_use_russian_locale.html', $template); $page = $this->initTemplate('/limb/locale_date_filter_dbe_use_russian_locale.html'); $page->set('var', $date->getStamp()); $this->assertEqual($page->capture(), '20.01.2005'); lmbToolkit::restore(); }
function tearDown() { $this->db->delete('lmb_session'); lmbToolkit::restore(); }