fixes on default app for tests
[shipsimu.git] / tests / loader-test.php
index 668e612254a0e54817158dd0494d3c31f4d192eb..b1682eaf76708f15616e63a9f616cc2dafa75c42 100644 (file)
@@ -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: <strong>%s</strong><br />\n",
                $e->getMessage()
@@ -85,7 +91,7 @@ try {
 if (defined('DEBUG_PERSONELL_OBJ')) {
        DebugMiddleware::getInstance()->output(sprintf("Das Personal-Objekt sieht wie folgt aus:<br />
 <pre>%s</pre>\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: <strong>%s</strong><br />\n",
                $e->getMessage()
@@ -107,19 +113,19 @@ try {
        die(sprintf("[Main:] Personenliste nicht angelegt. Grund: <strong>%s</strong><br />\n",
                $e->getMessage()
        ));
-} 
+}
 
 // Personal-Objekt debuggen
 if (defined('DEBUG_PERSONELL_OBJ')) {
        DebugMiddleware::getInstance()->output(sprintf("Das Personal-Objekt sieht wie folgt aus:<br />
 <pre>%s</pre>\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: <strong>%s</strong><br />\n",
                $e->getMessage()