X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=tests%2Fpersonell-test.php;fp=tests%2Fpersonell-test.php;h=c49d238685d65e07cacc005549617388a19629e6;hb=bfe9a4a335b6dce42742baeef1a03e0c45eeb5b8;hp=e6acd10a4706c498edd356fecc25e211a40ac29f;hpb=ff66822b5fb6a92f5dc8af55290ecb89ec7f1aaf;p=shipsimu.git 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()