public function _initErfurt() { $erfurt = null; // require Config $this->bootstrap('Config'); $config = $this->getResource('Config'); // require OntoWiki $this->bootstrap('OntoWiki'); $ontoWiki = $this->getResource('OntoWiki'); // require Logger, since Erfurt logger should write into OW logs dir $this->bootstrap('Logger'); // Reset the Erfurt app for testability... needs to be refactored. Erfurt_App::reset(); try { $erfurt = Erfurt_App::getInstance(false)->start($config); } catch (Erfurt_Exception $ee) { throw new OntoWiki_Exception('Error loading Erfurt framework: ' . $ee->getMessage()); } catch (Exception $e) { throw new OntoWiki_Exception('Unexpected error: ' . $e->getMessage()); } $store = new Erfurt_Store(array('adapterInstance' => new Erfurt_Store_Adapter_Test()), 'Test'); $erfurt->setStore($store); // make available $ontoWiki->erfurt = $erfurt; return $erfurt; }
private function _setupStore() { //$this->markTestNeedsDatabase(); $this->markTestNeedsTestConfig(); // prepare Erfurt_App $testConfig = $this->getTestConfig(); $testConfig->debug = true; $testConfig->store->backend = 'memory'; Erfurt_App::reset(); Erfurt_App::getInstance(false)->start($testConfig); $app = Erfurt_App::getInstance(); $this->markTestIncomplete('This test doesn\'t work because of an authentication problem in _setupStore'); // PHP Fatal error: Call to a member function getUri() on a non-object in Erfurt/library/Erfurt/Versioning.php on line 606 $this->authenticateDbUser(); // prepare Model $this->_store = $app->getStore(); }
public function testStartVersioningDisabled() { $this->markTestNeedsTestConfig(); $testConfig = $this->getTestConfig(); $testConfig->versioning = false; Erfurt_App::reset(); $app = Erfurt_App::getInstance(false)->start($testConfig); $this->assertFalse($app->getVersioning()); }
public function testGetStoreWithCleanDatabase() { Erfurt_App::reset(); $this->markTestNeedsCleanZendDbDatabase(); try { $store = Erfurt_App::getInstance()->getStore(); } catch (Erfurt_Exception $e) { // Should not fail! Instead should initialize the db tables. $this->fail('Something went wrong while initialization of new db environment: ' . $e->getMessage()); } }
public function markTestNeedsCleanZendDbDatabase() { $this->markTestNeedsZendDb(); $store = Erfurt_App::getInstance()->getStore(); $sql = 'DROP TABLE IF EXISTS ' . implode(',', $store->listTables()) . ';'; $store->sqlQuery($sql); // We do not clean up the db on tear down, for it is empty now. $this->_dbWasUsed = false; Erfurt_App::reset(); $this->_loadTestConfig(); }