]> git.mxchange.org Git - shipsimu.git/blobdiff - tests/old/personell-test.php
No longer thrown exceptions deprecated (still some there), naming-convention todo...
[shipsimu.git] / tests / old / personell-test.php
index c28823797a0d955303c99fe7ba646fdc5605ee10..622c2c79819676d9b9a0b1362d99e73dcd4f996a 100644 (file)
 // Change directory
 @chdir("../..");
 
+// Set testing mode (no starter.php will be loaded!)
+define('TEST_MODE', true);
+
 // Load config file
-require(dirname(dirname(__FILE__)) . "/inc/config.php");
+require(dirname(dirname(dirname(__FILE__))) . "/inc/config.php");
 
 // Load all include files
-require(PATH . "inc/includes.php");
+require($cfg->readConfig('base_path') . 'inc/includes.php');
 
 // Load all game classes
-require(PATH . "inc/classes.php");
+require($cfg->readConfig('base_path') . 'inc/classes.php');
+
+// Load file I/O handler
+require($cfg->readConfig('base_path') . 'inc/file_io.php');
+
+// Load database layer
+require($cfg->readConfig('base_path') . 'inc/database.php');
 
 // Set default application
-FrameworkConfiguration::getInstance()->setConfigEntry("default_application", "ship-simu");
+FrameworkConfiguration::getInstance()->setConfigEntry('default_application', 'ship-simu');
+$application = 'ship-simu';
 
-// Set testing mode (no starter.php will be loaded!)
-define('TEST_MODE', true);
+// Load more includes
+require($cfg->readConfig('base_path') . 'application/ship-simu/loader.php');
 
 // Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen
 // jetzt die Personalliste wiederherstellen
 try {
-       $personell = 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",
+       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
                $e->getMessage()
        ));
 } catch (InvalidArrayCountException $e) {
-       die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
                $e->getMessage()
        ));
 } catch (NullPointerException $e) {
-       die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
                $e->getMessage()
        ));
 } catch (NoObjectException $e) {
-       die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
                $e->getMessage()
        ));
 } catch (MissingMethodException $e) {
-       die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
                $e->getMessage()
        ));
 } catch (FileIsEmptyException $e) {
-       die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
                $e->getMessage()
        ));
 } catch (FilePointerNotOpenedException $e) {
-       die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
                $e->getMessage()
        ));
 } catch (InvalidArrayCountException $e) {
-       die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
                $e->getMessage()
        ));
 } catch (InvalidMD5ChecksumException $e) {
-       die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
                $e->getMessage()
        ));
 } catch (InvalidDataLengthException $e) {
-       die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
                $e->getMessage()
        ));
 } catch (InvalidSimulatorIDException $e) {
-       die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
                $e->getMessage()
        ));
 } catch (MismatchingCompressorsException $e) {
-       die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
                $e->getMessage()
        ));
 } catch (ContainerItemIsNullException $e) {
-       die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
                $e->getMessage()
        ));
 } catch (ContainerItemIsNoArrayException $e) {
-       die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
                $e->getMessage()
        ));
 } catch (ContainerMaybeDamagedException $e) {
-       die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
                $e->getMessage()
        ));
 }
 
 // Personal-Objekt debuggen
 if (defined('DEBUG_PERSONELL_OBJ')) {
-       echo sprintf("Das Personal-Objekt sieht wie folgt aus:<br />
+       echo sprintf("The personal object looks like this:<br />
 <pre>%s</pre>\n",
                print_r($personell, true)
        );
@@ -98,22 +108,22 @@ exit();
 try {
        $personell = SimulatorPersonell::createSimulatorPersonell(20);
 } catch (NullPointerException $e) {
-       die(sprintf("[Main:] Personenliste nicht angelegt. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] Personal list not created for following reason: <span class=\"exception_reason\">%s</span><br />\n",
                $e->getMessage()
        ));
 } catch (NoObjectException $e) {
-       die(sprintf("[Main:] Personenliste nicht angelegt. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] Personal list not created for following reason: <span class=\"exception_reason\">%s</span><br />\n",
                $e->getMessage()
        ));
 } catch (MissingMethodException $e) {
-       die(sprintf("[Main:] Personenliste nicht angelegt. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] Personal list not created for following reason: <span class=\"exception_reason\">%s</span><br />\n",
                $e->getMessage()
        ));
 }
 
 // Personal-Objekt debuggen
 if (defined('DEBUG_PERSONELL_OBJ')) {
-       echo sprintf("Das Personal-Objekt sieht wie folgt aus:<br />
+       echo sprintf("The personal object looks like this:<br />
 <pre>%s</pre>\n",
                print_r($personell, true)
        );
@@ -123,35 +133,27 @@ if (defined('DEBUG_PERSONELL_OBJ')) {
 try {
        $personell->saveObjectToDatabase();
 } catch (NullPointerException $e) {
-       die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] Object not saved for following reason: <span class=\"exception_reason\">%s</span><br />\n",
                $e->getMessage()
        ));
 } catch (NoObjectException $e) {
-       die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] Object not saved for following reason: <span class=\"exception_reason\">%s</span><br />\n",
                $e->getMessage()
        ));
 } catch (InvalidObjectException $e) {
-       die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] Object not saved for following reason: <span class=\"exception_reason\">%s</span><br />\n",
                $e->getMessage()
        ));
 } catch (MissingMethodException $e) {
-       die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] Object not saved for following reason: <span class=\"exception_reason\">%s</span><br />\n",
                $e->getMessage()
        ));
 } catch (UnsupportedLimitationPartException $e) {
-       die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
-               $e->getMessage()
-       ));
-} catch (GetterNotFoundException $e) {
-       die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
-               $e->getMessage()
-       ));
-} catch (NoArrayCreatedException $e) {
-       die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] Object not saved for following reason: <span class=\"exception_reason\">%s</span><br />\n",
                $e->getMessage()
        ));
 } catch (InvalidArrayCountException $e) {
-       die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] Object not saved for following reason: <span class=\"exception_reason\">%s</span><br />\n",
                $e->getMessage()
        ));
 }