From 2854583acb819fa091c3e0405e50f5e2139ba9b7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 13 Mar 2009 20:59:39 +0000 Subject: [PATCH] Evn more quotes rewritten, old try-catch-blocks removed from old tests --- inc/classes.php | 26 +-- inc/config.php | 6 +- inc/database.php | 29 +--- inc/language.php | 29 +--- tests/old/contract-test.php | 318 ++++------------------------------- tests/old/loader-test.php | 112 +----------- tests/old/personell-test.php | 112 +----------- 7 files changed, 53 insertions(+), 579 deletions(-) diff --git a/inc/classes.php b/inc/classes.php index dbeb75a4..9d1af75d 100644 --- a/inc/classes.php +++ b/inc/classes.php @@ -32,30 +32,8 @@ $lowerClasses = array( // Load all classes foreach ($lowerClasses as $className) { // Try to load the framework classes - try { - ClassLoader::getInstance()->scanClassPath(sprintf("inc/classes/%s/", $className)); - } catch (PathIsNoDirectoryException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Could not load framework classes from path %s for the follwing reason: %s", - $className, - $e->getMessage() - )); - } catch (PathIsEmptyException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Could not load framework classes from path %s for the follwing reason: %s", - $className, - $e->getMessage() - )); - } catch (PathReadProtectedException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Could not load framework classes from path %s for the follwing reason: %s", - $className, - $e->getMessage() - )); - } catch (DirPointerNotOpenedException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Could not load framework classes from path %s for the follwing reason: %s", - $className, - $e->getMessage() - )); - } -} + ClassLoader::getInstance()->scanClassPath(sprintf("inc/classes/%s/", $className)); +} // END - foreach // Clean up the global namespace unset($lowerClasses[3]); // Applications shall not have any middleware diff --git a/inc/config.php b/inc/config.php index 63940c8d..d4620733 100644 --- a/inc/config.php +++ b/inc/config.php @@ -117,16 +117,16 @@ $cfg->setConfigEntry('web_content_type', "text/html"); $cfg->setConfigEntry('tpl_valid_var', "content"); // CFG: META-AUTHOR -$cfg->setConfigEntry('meta_author', "Roland Häder"); +$cfg->setConfigEntry('meta_author', "Your-name-here"); // CFG: META-PUBLISHER -$cfg->setConfigEntry('meta_publisher', "Roland Häder"); +$cfg->setConfigEntry('meta_publisher', "Your-name-here"); // CFG: META-KEYWORDS $cfg->setConfigEntry('meta_keywords', "test,test,test"); // CFG: META-DESCRIPTION -$cfg->setConfigEntry('meta_description', "A lame description for an application framework"); +$cfg->setConfigEntry('meta_description', "A description for your website"); // CFG: SELECTOR-MAIN-TEMPLATE $cfg->setConfigEntry('selector_main_tpl', "selector_main"); diff --git a/inc/database.php b/inc/database.php index 30792197..544a2a55 100644 --- a/inc/database.php +++ b/inc/database.php @@ -49,35 +49,10 @@ if ((file_exists($INC)) && (is_file($INC)) && (is_readable($INC))) { unset($INC); // Prepare database instance -try { - $db = DatabaseConnection::createDatabaseConnection(DebugMiddleware::getInstance(), $layerInstance); -} catch (NullPointerException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Database sub-system not initialized for the follwing reason: %s
\n", - $e->getMessage() - )); -} catch (InvalidDirectoryResourceException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Database sub-system not initialized for the follwing reason: %s
\n", - $e->getMessage() - )); -} catch (PathIsEmptyException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Database sub-system not initialized for the follwing reason: %s
\n", - $e->getMessage() - )); -} catch (PathIsNoDirectoryException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Database sub-system not initialized for the follwing reason: %s
\n", - $e->getMessage() - )); -} catch (PathReadProtectedException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Database sub-system not initialized for the follwing reason: %s
\n", - $e->getMessage() - )); -} catch (DirPointerNotOpenedException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Database sub-system not initialized for the follwing reason: %s
\n", - $e->getMessage() - )); -} +$db = DatabaseConnection::createDatabaseConnection(DebugMiddleware::getInstance(), $layerInstance); // Is the app variable there and valid? +// @TODO Rewrite this if (is_object($app)) $app->setDatabaseInstance($db); // [EOF] diff --git a/inc/language.php b/inc/language.php index 7f63099c..30a35751 100644 --- a/inc/language.php +++ b/inc/language.php @@ -20,30 +20,15 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -try { - $lang = LanguageSystem::createLanguageSystem( - $cfg->readConfig('base_path'). - FrameworkConfiguration::getInstance()->readConfig('lang_base_path') - ); -} catch (LanguagePathIsEmptyException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] The language sub-system could not be initialized for the following reason: %s", - $e->getMessage() - )); -} catch (InvalidLanguagePathStringException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] The language sub-system could not be initialized for the following reason: %s", - $e->getMessage() - )); -} catch (LanguagePathIsNoDirectoryException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] The language sub-system could not be initialized for the following reason: %s", - $e->getMessage() - )); -} catch (LanguagePathReadProtectedException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] The language sub-system could not be initialized for the following reason: %s", - $e->getMessage() - )); -} + +// Try to instance the language system +$lang = LanguageSystem::createLanguageSystem( + $cfg->readConfig('base_path'). + FrameworkConfiguration::getInstance()->readConfig('lang_base_path') +); // Is the app variable there and valid? +// @TODO Rewrite this if (is_object($app)) $app->setLanguageInstance($lang); // [EOF] diff --git a/tests/old/contract-test.php b/tests/old/contract-test.php index 5dfeabf4..ccf6fdb9 100644 --- a/tests/old/contract-test.php +++ b/tests/old/contract-test.php @@ -1,12 +1,12 @@ readConfig('base_path') . 'inc/includes.php'); @@ -29,69 +29,7 @@ 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'); -} catch (InvalidIDFormatException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (InvalidArrayCountException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (NullPointerException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (MissingMethodException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (FileIsEmptyException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (FilePointerNotOpenedException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (InvalidArrayCountException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (InvalidMD5ChecksumException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (InvalidDataLengthException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (InvalidSimulatorIDException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (MismatchingCompressorsException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (ContainerItemIsNullException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (ContainerItemIsNoArrayException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (ContainerMaybeDamagedException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} +$personell = SimulatorPersonell::createSimulatorPersonellByID('SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98'); // Personal-Objekt debuggen if (defined('DEBUG_PERSONELL_OBJ')) { @@ -246,29 +184,21 @@ foreach ($einbauten['parts'] as $key=>$part) { // Random price $price = mt_rand(5, 12) * 10000; - // Give it a try... - try { - // Generate command for adding objects to a price list - $eval = sprintf("\$merchant->addItemToPriceList(%s::create%s(%s), %d);", - $key, - $key, - $item, - $price - ); - - // Debug message - if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) DebugMiddleware::getInstance()->output(sprintf("[Main:] Konstruierte PHP-Anweisung:
%s

\n", - htmlentities($eval) - )); - - // Run the constructed command - eval($eval); - } catch (ItemNotTradeableException $e) { - die(sprintf("[Main:] Die Preisliste des Händlers %s kann nicht befüllt werden. Grund: %s
\n", - $merchant->getMerchantName(), - $e->getMessage() - )); - } + // Generate command for adding objects to a price list + $eval = sprintf("\$merchant->addItemToPriceList(%s::create%s(%s), %d);", + $key, + $key, + $item, + $price + ); + + // Debug message + if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) DebugMiddleware::getInstance()->output(sprintf("[Main:] Konstruierte PHP-Anweisung:
%s

\n", + htmlentities($eval) + )); + + // Run the constructed command + eval($eval); } // Haendler-Objekt debuggen @@ -284,13 +214,7 @@ if (defined('DEBUG_MERCHANT_OBJ')) { $shipping = ShippingCompany::createShippingCompany("Hanseatic Travel Company", $harbor); // Firmenschef setzen -try { - $shipping->setCompanyFounder(CompanyEmployee::createCompanyEmployee("Roland", "Häder", "M", 1977, 9, 26, true, 2000)); -} catch (BirthdayInvalidException $e) { - die(sprintf("[Main:] Reederei-Gründer konnte nicht gesetzt werden. Grund: %s
\n", - $e->getMessage() - )); -} +$shipping->setCompanyFounder(CompanyEmployee::createCompanyEmployee("Roland", "Häder", "M", 1977, 9, 26, true, 2000)); // Dann mal ausgeben... DebugMiddleware::getInstance()->output(sprintf("Die Reederei %s ist von %s %s gegründet worden.
\n", @@ -300,19 +224,7 @@ DebugMiddleware::getInstance()->output(sprintf("Die Reederei recruitRandomEmployees(10, $personell); -} catch (ToMuchEmployeesException $e) { - die(sprintf("[Main:] Die Reederei %s konnte kein Personal einstellen. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} catch (OutOfBoundsException $e) { - die(sprintf("[Main:] Die Reederei %s konnte kein Personal einstellen. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} +$shipping->recruitRandomEmployees(10, $personell); // Anzahl Personal ausgeben DebugMiddleware::getInstance()->output(sprintf("Die Reederei %s hat nun %d weitere Mitarbeiter.
\n", @@ -326,49 +238,10 @@ $shipping->createShipyardInHarbor("Werft 2", $harbor); $shipping->createShipyardInHarbor("Werft 3", $harbor); // In alle Werften sollen Passagierschiffe gebaut werden koennen -try { - $shipping->addShipTypeToAllShipyards("PassengerShip"); -} catch (ClassNotFoundException $e) { - die(sprintf("[Main:] Die Reederei %s kann ihre Werften nicht beschäftigen. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} catch (ClassMismatchException $e) { - die(sprintf("[Main:] Die Reederei %s kann ihre Werften nicht beschäftigen. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Die Reederei %s kann ihre Werften nicht beschäftigen. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} +$shipping->addShipTypeToAllShipyards("PassengerShip"); // Personal auf die Werften verteilen -try { - $shipping->distributeAllPersonellOnShipyards(); -} catch (NoShipyardsConstructedException $e) { - die(sprintf("[Main:] Die Reederei %s konnte kein Personal den Werften zuteilen. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} catch (ClassMismatchException $e) { - die(sprintf("[Main:] Die Reederei %s konnte kein Personal den Werften zuteilen. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} catch (NullPointerException $e) { - die(sprintf("[Main:] Die Reederei %s konnte kein Personal den Werften zuteilen. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Die Reederei %s konnte kein Personal den Werften zuteilen. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} +$shipping->distributeAllPersonellOnShipyards(); // Normale Meldung ausgeben DebugMiddleware::getInstance()->output(sprintf("Die Reederei %s beschäftigt nun ihre %d Mitarbeiter in %d Werft(en):
\n", @@ -379,67 +252,16 @@ DebugMiddleware::getInstance()->output(sprintf("Die Reederei addNewWorksContract(WorksContract::createWorksContract("PassengerShip", "M/S Poseidon", $shipping)); -} catch (ClassNotFoundException $e) { - die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (NullPointerException $e) { - die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (MissingMethodException $e) { - die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (EmptyStructuresListException $e) { - die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} +$shipping->addNewWorksContract(WorksContract::createWorksContract("PassengerShip", "M/S Poseidon", $shipping)); // Auftrag-Instanz holen $contract = $shipping->getLastContractInstance(); // Die Reederei hat einen Haendler gewaehlt -try { - $shipping->setMerchantInstance($merchant); -} catch (NullPointerException $e) { - die(sprintf("[Main:] Der Händler %s konnte nicht ausgewählt werden. Grund: %s
\n", - $merchant->getMerchantName(), - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Der Händler %s konnte nicht ausgewählt werden. Grund: %s
\n", - $merchant->getMerchantName(), - $e->getMessage() - )); -} catch (ClassMismatchException $e) { - die(sprintf("[Main:] Der Händler %s konnte nicht ausgewählt werden. Grund: %s
\n", - $merchant->getMerchantName(), - $e->getMessage() - )); -} +$shipping->setMerchantInstance($merchant); // Den Bauauftrag mit der Reederei abgleichen, ob sie den Schiffstyp bauen koennen -try { - $typeValid = $shipping->validateWorksContractShipType($contract); -} catch (NullPointerException $e) { - die(sprintf("[Main:] Die Reederei %s konnte den Bauauftrag nicht validieren. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Die Reederei %s konnte den Bauauftrag nicht validieren. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} +$typeValid = $shipping->validateWorksContractShipType($contract); // Kann gebaut werden? if ($typeValid) { @@ -457,25 +279,7 @@ if ($typeValid) { // Dann den Bauauftrag verfeinern foreach ($einbauten['parts'] as $key=>$part) { - try { - $contract->addContractDetails($key, $einbauten['builds'][$key], $part); - } catch (ShipPartNotConstructableException $e) { - // Output message - die($e->getMessage()); - } catch (ShipNotConstructedException $e) { - // Output message - die($e->getMessage()); - } catch (ItemNotInPriceListException $e) { - die(sprintf("[Main:] Der Artikel %s konnte nicht in der Preisliste gefunden werden. Grund: %s
\n", - $key, - $e->getMessage() - )); - } catch (InvalidArrayCountException $e) { - die(sprintf("[Main:] Der Artikel %s konnte nicht in der Preisliste gefunden werden. Grund: %s
\n", - $key, - $e->getMessage() - )); - } + $contract->addContractDetails($key, $einbauten['builds'][$key], $part); } // Reederei-Objekt ausgeben @@ -496,29 +300,7 @@ unset($key); unset($typeValid); // Gesamtwert ausgeben -try { - $totalValue = $contract->getTotalPrice(); -} catch (NullPointerException $e) { - die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: %s
\n", - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: %s
\n", - $e->getMessage() - )); -} catch (MissingMethodException $e) { - die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: %s
\n", - $e->getMessage() - )); -} catch (EmptyStructuresListException $e) { - die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: %s
\n", - $e->getMessage() - )); -} catch (TotalPriceNotCalculatedException $e) { - die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: %s
\n", - $e->getMessage() - )); -} +$totalValue = $contract->getTotalPrice(); // Wert ausgeben DebugMiddleware::getInstance()->output(sprintf("Der Bau der %s wird der Reederei %s voraussichtlich %s kosten.
\n", @@ -531,39 +313,7 @@ DebugMiddleware::getInstance()->output(sprintf("Der Bau der signContract($contract, $shipping); -} catch (NullPointerException $e) { - die(sprintf("[Main:] The shipping company %s was not able to sign the contract for the following reason: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] The shipping company %s was not able to sign the contract for the following reason: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} catch (MissingMethodException $e) { - die(sprintf("[Main:] The shipping company %s was not able to sign the contract for the following reason: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} catch (InvalidContractPartnerException $e) { - die(sprintf("[Main:] The shipping company %s was not able to sign the contract for the following reason: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} catch (ContractAllreadySignedException $e) { - die(sprintf("[Main:] The shipping company %s was not able to sign the contract for the following reason: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} catch (WrongContractPartnerException $e) { - die(sprintf("[Main:] The shipping company %s was not able to sign the contract for the following reason: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} +$shipping->signContract($contract, $shipping); // Meldung ausgeben if ($contract->isSigned()) { @@ -591,17 +341,7 @@ if (defined('DEBUG_CONTRACT_OBJ')) { //exit(); // Anzahl Betten ermitteln -try { - $totalBeds = $contract->getShipInstance()->calcTotalBeds(); -} catch (StructuresOutOfBoundsException $e) { - die(sprintf("[Main:] Anzahl Betten konnten nicht ermittelt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (EmptyStructuresListException $e) { - die(sprintf("[Main:] Anzahl Betten konnten nicht ermittelt werden. Grund: %s
\n", - $e->getMessage() - )); -} +$totalBeds = $contract->getShipInstance()->calcTotalBeds(); // Bettenanzahl ausgeben DebugMiddleware::getInstance()->output(sprintf("Es stehen %d Betten zur Verfügung.", diff --git a/tests/old/loader-test.php b/tests/old/loader-test.php index f87b31ae..d8e00c62 100644 --- a/tests/old/loader-test.php +++ b/tests/old/loader-test.php @@ -1,12 +1,12 @@ readConfig('base_path') . 'inc/includes.php'); @@ -29,69 +29,7 @@ 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'); -} catch (InvalidIDFormatException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (InvalidArrayCountException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (NullPointerException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (MissingMethodException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (FileIsEmptyException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (FilePointerNotOpenedException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (InvalidArrayCountException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (InvalidMD5ChecksumException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (InvalidDataLengthException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (InvalidSimulatorIDException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (MismatchingCompressorsException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (ContainerItemIsNullException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (ContainerItemIsNoArrayException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (ContainerMaybeDamagedException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} +$personell = SimulatorPersonell::createSimulatorPersonellByID('SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98'); // Personal-Objekt debuggen if (defined('DEBUG_PERSONELL_OBJ')) { @@ -105,21 +43,7 @@ if (defined('DEBUG_PERSONELL_OBJ')) { exit(); // Etwas zum Testen... -try { - $personell = SimulatorPersonell::createSimulatorPersonell(20); -} catch (NullPointerException $e) { - die(sprintf("[Main:] Personal list not created for following reason: %s
\n", - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Personal list not created for following reason: %s
\n", - $e->getMessage() - )); -} catch (MissingMethodException $e) { - die(sprintf("[Main:] Personal list not created for following reason: %s
\n", - $e->getMessage() - )); -} +$personell = SimulatorPersonell::createSimulatorPersonell(20); // Personal-Objekt debuggen if (defined('DEBUG_PERSONELL_OBJ')) { @@ -130,33 +54,7 @@ if (defined('DEBUG_PERSONELL_OBJ')) { } // Try to save the object (for testing purposes) -try { - $personell->saveObjectToDatabase(); -} catch (NullPointerException $e) { - die(sprintf("[Main:] Object not saved for following reason: %s
\n", - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Object not saved for following reason: %s
\n", - $e->getMessage() - )); -} catch (InvalidObjectException $e) { - die(sprintf("[Main:] Object not saved for following reason: %s
\n", - $e->getMessage() - )); -} catch (MissingMethodException $e) { - die(sprintf("[Main:] Object not saved for following reason: %s
\n", - $e->getMessage() - )); -} catch (UnsupportedLimitationPartException $e) { - die(sprintf("[Main:] Object not saved for following reason: %s
\n", - $e->getMessage() - )); -} catch (InvalidArrayCountException $e) { - die(sprintf("[Main:] Object not saved for following reason: %s
\n", - $e->getMessage() - )); -} +$personell->saveObjectToDatabase(); // ?> diff --git a/tests/old/personell-test.php b/tests/old/personell-test.php index 622c2c79..c09ae48c 100644 --- a/tests/old/personell-test.php +++ b/tests/old/personell-test.php @@ -1,12 +1,12 @@ readConfig('base_path') . 'inc/includes.php'); @@ -29,69 +29,7 @@ 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'); -} catch (InvalidIDFormatException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (InvalidArrayCountException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (NullPointerException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (MissingMethodException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (FileIsEmptyException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (FilePointerNotOpenedException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (InvalidArrayCountException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (InvalidMD5ChecksumException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (InvalidDataLengthException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (InvalidSimulatorIDException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (MismatchingCompressorsException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (ContainerItemIsNullException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (ContainerItemIsNoArrayException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} catch (ContainerMaybeDamagedException $e) { - die(sprintf("[Main:] Could not create personal list for follwing reason: %s
\n", - $e->getMessage() - )); -} +$personell = SimulatorPersonell::createSimulatorPersonellByID('SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98'); // Personal-Objekt debuggen if (defined('DEBUG_PERSONELL_OBJ')) { @@ -105,21 +43,7 @@ if (defined('DEBUG_PERSONELL_OBJ')) { exit(); // Etwas zum Testen... -try { - $personell = SimulatorPersonell::createSimulatorPersonell(20); -} catch (NullPointerException $e) { - die(sprintf("[Main:] Personal list not created for following reason: %s
\n", - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Personal list not created for following reason: %s
\n", - $e->getMessage() - )); -} catch (MissingMethodException $e) { - die(sprintf("[Main:] Personal list not created for following reason: %s
\n", - $e->getMessage() - )); -} +$personell = SimulatorPersonell::createSimulatorPersonell(20); // Personal-Objekt debuggen if (defined('DEBUG_PERSONELL_OBJ')) { @@ -130,33 +54,7 @@ if (defined('DEBUG_PERSONELL_OBJ')) { } // Try to save the object (for testing purposes) -try { - $personell->saveObjectToDatabase(); -} catch (NullPointerException $e) { - die(sprintf("[Main:] Object not saved for following reason: %s
\n", - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Object not saved for following reason: %s
\n", - $e->getMessage() - )); -} catch (InvalidObjectException $e) { - die(sprintf("[Main:] Object not saved for following reason: %s
\n", - $e->getMessage() - )); -} catch (MissingMethodException $e) { - die(sprintf("[Main:] Object not saved for following reason: %s
\n", - $e->getMessage() - )); -} catch (UnsupportedLimitationPartException $e) { - die(sprintf("[Main:] Object not saved for following reason: %s
\n", - $e->getMessage() - )); -} catch (InvalidArrayCountException $e) { - die(sprintf("[Main:] Object not saved for following reason: %s
\n", - $e->getMessage() - )); -} +$personell->saveObjectToDatabase(); // ?> -- 2.39.5