From bfe9a4a335b6dce42742baeef1a03e0c45eeb5b8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 3 Mar 2008 20:43:58 +0000 Subject: [PATCH] fixes on default app for tests --- tests/contract-test.php | 11 ++++++++--- tests/loader-test.php | 24 +++++++++++++++--------- tests/personell-test.php | 23 ++++++++++++++--------- 3 files changed, 37 insertions(+), 21 deletions(-) diff --git a/tests/contract-test.php b/tests/contract-test.php index 326d104..e202630 100644 --- a/tests/contract-test.php +++ b/tests/contract-test.php @@ -12,9 +12,14 @@ require(PATH . "inc/includes.php"); // Load all game classes require(PATH . "inc/classes.php"); -// Load more include files -$_GET['app'] = "ship-simu"; -require_once(PATH . "inc/selector.php"); +// Set default application +FrameworkConfiguration::getInstance()->setConfigEntry("default_application", "ship-simu"); + +// Set testing mode (no starter.php will be loaded!) +define('TEST_MODE', true); + +// Load the "selector" +require(PATH . "inc/selector.php"); // Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen // jetzt die Personalliste wiederherstellen diff --git a/tests/loader-test.php b/tests/loader-test.php index 668e612..b1682ea 100644 --- a/tests/loader-test.php +++ b/tests/loader-test.php @@ -12,13 +12,19 @@ require(PATH . "inc/includes.php"); // Load all game classes require(PATH . "inc/classes.php"); -// Load more include files -$_GET['app'] = "ship-simu"; -require_once(PATH . "inc/selector.php"); +// Set default application +FrameworkConfiguration::getInstance()->setConfigEntry("default_application", "ship-simu"); +// Set testing mode (no starter.php will be loaded!) +define('TEST_MODE', true); + +// Load the "selector" +require(PATH . "inc/selector.php"); + +// Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen // jetzt die Personalliste wiederherstellen try { - $test = SimulatorPersonell::createSimulatorPersonellByID("SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98"); + $personell = SimulatorPersonell::createSimulatorPersonellByID("SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98"); } catch (InvalidIDFormatException $e) { die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", $e->getMessage() @@ -85,7 +91,7 @@ try { if (defined('DEBUG_PERSONELL_OBJ')) { DebugMiddleware::getInstance()->output(sprintf("Das Personal-Objekt sieht wie folgt aus:
%s
\n", - print_r($test, true) + print_r($personell, true) )); } @@ -94,7 +100,7 @@ exit(); // Etwas zum Testen... try { - $test = SimulatorPersonell::createSimulatorPersonell(20); + $personell = SimulatorPersonell::createSimulatorPersonell(20); } catch (NullPointerException $e) { die(sprintf("[Main:] Personenliste nicht angelegt. Grund: %s
\n", $e->getMessage() @@ -107,19 +113,19 @@ try { die(sprintf("[Main:] Personenliste nicht angelegt. Grund: %s
\n", $e->getMessage() )); -} +} // Personal-Objekt debuggen if (defined('DEBUG_PERSONELL_OBJ')) { DebugMiddleware::getInstance()->output(sprintf("Das Personal-Objekt sieht wie folgt aus:
%s
\n", - print_r($test, true) + print_r($personell, true) )); } // Try to save the object (for testing purposes) try { - $test->saveObjectToDatabase(); + $personell->saveObjectToDatabase(); } catch (NullPointerException $e) { die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", $e->getMessage() diff --git a/tests/personell-test.php b/tests/personell-test.php index e6acd10..c49d238 100644 --- a/tests/personell-test.php +++ b/tests/personell-test.php @@ -12,14 +12,19 @@ require(PATH . "inc/includes.php"); // Load all game classes require(PATH . "inc/classes.php"); -// Load more include files -$_GET['app'] = "ship-simu"; -require_once(PATH . "inc/selector.php"); +// Set default application +FrameworkConfiguration::getInstance()->setConfigEntry("default_application", "ship-simu"); + +// Set testing mode (no starter.php will be loaded!) +define('TEST_MODE', true); + +// Load the "selector" +require(PATH . "inc/selector.php"); // Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen // jetzt die Personalliste wiederherstellen try { - $test = SimulatorPersonell::createSimulatorPersonellByID("SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98"); + $personell = SimulatorPersonell::createSimulatorPersonellByID("SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98"); } catch (InvalidIDFormatException $e) { die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", $e->getMessage() @@ -86,7 +91,7 @@ try { if (defined('DEBUG_PERSONELL_OBJ')) { echo sprintf("Das Personal-Objekt sieht wie folgt aus:
%s
\n", - print_r($test, true) + print_r($personell, true) ); } @@ -95,7 +100,7 @@ exit(); // Etwas zum Testen... try { - $test = SimulatorPersonell::createSimulatorPersonell(20); + $personell = SimulatorPersonell::createSimulatorPersonell(20); } catch (NullPointerException $e) { die(sprintf("[Main:] Personenliste nicht angelegt. Grund: %s
\n", $e->getMessage() @@ -108,19 +113,19 @@ try { die(sprintf("[Main:] Personenliste nicht angelegt. Grund: %s
\n", $e->getMessage() )); -} +} // Personal-Objekt debuggen if (defined('DEBUG_PERSONELL_OBJ')) { echo sprintf("Das Personal-Objekt sieht wie folgt aus:
%s
\n", - print_r($test, true) + print_r($personell, true) ); } // Try to save the object (for testing purposes) try { - $test->saveObjectToDatabase(); + $personell->saveObjectToDatabase(); } catch (NullPointerException $e) { die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", $e->getMessage() -- 2.30.2