/** * @AfterScenario */ public function afterResetDatabase(ScenarioEvent $event) { \SapphireTest::empty_temp_db(); }
public function emptydb() { if (SapphireTest::using_temp_db()) { SapphireTest::empty_temp_db(); if (isset($_GET['fixture']) && ($fixtureFile = $_GET['fixture'])) { $fixture = new YamlFixture($fixtureFile); $fixture->saveIntoDatabase(); return "<p>Re-test the test database with fixture '{$fixtureFile}'. Time to start testing; where would" . " you like to start?</p>"; } else { return "<p>Re-test the test database. Time to start testing; where would you like to start?</p>"; } } else { return "<p>dev/tests/emptydb can only be used with a temporary database. Perhaps you should use" . " dev/tests/startsession first?</p>"; } }
public function clear() { if (!$this->environment->isRunningTests()) { throw new LogicException("No test session in progress."); } $this->extend('onBeforeClear'); if (SapphireTest::using_temp_db()) { SapphireTest::empty_temp_db(); } if (isset($_SESSION['_testsession_codeblocks'])) { unset($_SESSION['_testsession_codeblocks']); } $this->extend('onAfterClear'); return "Cleared database and test state"; }