]> git.mxchange.org Git - shipsimu.git/blobdiff - tests/old/contract-test.php
Constants PATH and _DB_TYPE replaced
[shipsimu.git] / tests / old / contract-test.php
index db00cedc731f96f8d9e92d469e2dfb237e35875c..3e9cd2b4ba735f0d8e2fef8f25cc11b13028d83f 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: <strong>%s</strong><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: <strong>%s</strong><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: <strong>%s</strong><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: <strong>%s</strong><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: <strong>%s</strong><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: <strong>%s</strong><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: <strong>%s</strong><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: <strong>%s</strong><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: <strong>%s</strong><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: <strong>%s</strong><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: <strong>%s</strong><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: <strong>%s</strong><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: <strong>%s</strong><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: <strong>%s</strong><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: <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 />
+       DebugMiddleware::getInstance()->output(sprintf("The personal object looks like this:<br />
 <pre>%s</pre>\n",
                print_r($personell, true)
        ));
@@ -435,12 +445,12 @@ try {
 if ($typeValid) {
        DebugMiddleware::getInstance()->output(sprintf("Die Reederei <strong>%s</strong> kann Schiffe vom Typ <strong>%s</strong> bauen.<br />\n",
                $shipping->getCompanyName(),
-               $contract->getShipInstance()->getPartDescr()
+               $contract->getShipInstance()->getObjectDescription()
        ));
 } else {
        DebugMiddleware::getInstance()->output(sprintf("Die Reederei <strong>%s</strong> kann keine Schiffe vom Typ <strong>%s</strong> bauen!<br />\n",
                $shipping->getCompanyName(),
-               $contract->getShipInstance()->getPartDescr()
+               $contract->getShipInstance()->getObjectDescription()
        ));
        exit;
 }
@@ -524,32 +534,32 @@ unset($totalValue);
 try {
        $shipping->signContract($contract, $shipping);
 } catch (NullPointerException $e) {
-       die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte den Bauauftrag nicht unterzeichnen. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] The shipping company <strong>%s</strong> was not able to sign the contract for the following reason: <strong>%s</strong><br />\n",
                $shipping->getCompanyName(),
                $e->getMessage()
        ));
 } catch (NoObjectException $e) {
-       die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte den Bauauftrag nicht unterzeichnen. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] The shipping company <strong>%s</strong> was not able to sign the contract for the following reason: <strong>%s</strong><br />\n",
                $shipping->getCompanyName(),
                $e->getMessage()
        ));
 } catch (MissingMethodException $e) {
-       die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte den Bauauftrag nicht unterzeichnen. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] The shipping company <strong>%s</strong> was not able to sign the contract for the following reason: <strong>%s</strong><br />\n",
                $shipping->getCompanyName(),
                $e->getMessage()
        ));
 } catch (InvalidContractPartnerException $e) {
-       die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte den Bauauftrag nicht unterzeichnen. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] The shipping company <strong>%s</strong> was not able to sign the contract for the following reason: <strong>%s</strong><br />\n",
                $shipping->getCompanyName(),
                $e->getMessage()
        ));
 } catch (ContractAllreadySignedException $e) {
-       die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte den Bauauftrag nicht unterzeichnen. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] The shipping company <strong>%s</strong> was not able to sign the contract for the following reason: <strong>%s</strong><br />\n",
                $shipping->getCompanyName(),
                $e->getMessage()
        ));
 } catch (WrongContractPartnerException $e) {
-       die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte den Bauauftrag nicht unterzeichnen. Grund: <strong>%s</strong><br />\n",
+       die(sprintf("[Main:] The shipping company <strong>%s</strong> was not able to sign the contract for the following reason: <strong>%s</strong><br />\n",
                $shipping->getCompanyName(),
                $e->getMessage()
        ));