personell-test.php

Go to the documentation of this file.
00001 <?php
00002 // Change directory
00003 @chdir("../..");
00004 
00005 // Set testing mode (no starter.php will be loaded!)
00006 define('TEST_MODE', true);
00007 
00008 // Load config file
00009 require(dirname(dirname(dirname(__FILE__))) . "/inc/config.php");
00010 
00011 // Load all include files
00012 require($cfg->readConfig('base_path') . 'inc/includes.php');
00013 
00014 // Load all game classes
00015 require($cfg->readConfig('base_path') . 'inc/classes.php');
00016 
00017 // Load file I/O handler
00018 require($cfg->readConfig('base_path') . 'inc/file_io.php');
00019 
00020 // Load database layer
00021 require($cfg->readConfig('base_path') . 'inc/database.php');
00022 
00023 // Set default application
00024 FrameworkConfiguration::getInstance()->setConfigEntry('default_application', 'ship-simu');
00025 $application = 'ship-simu';
00026 
00027 // Load more includes
00028 require($cfg->readConfig('base_path') . 'application/ship-simu/loader.php');
00029 
00030 // Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen
00031 // jetzt die Personalliste wiederherstellen
00032 try {
00033         $personell = SimulatorPersonell::createSimulatorPersonellByID('SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98');
00034 } catch (InvalidIDFormatException $e) {
00035         die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
00036                 $e->getMessage()
00037         ));
00038 } catch (InvalidArrayCountException $e) {
00039         die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
00040                 $e->getMessage()
00041         ));
00042 } catch (NullPointerException $e) {
00043         die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
00044                 $e->getMessage()
00045         ));
00046 } catch (NoObjectException $e) {
00047         die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
00048                 $e->getMessage()
00049         ));
00050 } catch (MissingMethodException $e) {
00051         die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
00052                 $e->getMessage()
00053         ));
00054 } catch (FileIsEmptyException $e) {
00055         die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
00056                 $e->getMessage()
00057         ));
00058 } catch (FilePointerNotOpenedException $e) {
00059         die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
00060                 $e->getMessage()
00061         ));
00062 } catch (InvalidArrayCountException $e) {
00063         die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
00064                 $e->getMessage()
00065         ));
00066 } catch (InvalidMD5ChecksumException $e) {
00067         die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
00068                 $e->getMessage()
00069         ));
00070 } catch (InvalidDataLengthException $e) {
00071         die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
00072                 $e->getMessage()
00073         ));
00074 } catch (InvalidSimulatorIDException $e) {
00075         die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
00076                 $e->getMessage()
00077         ));
00078 } catch (MismatchingCompressorsException $e) {
00079         die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
00080                 $e->getMessage()
00081         ));
00082 } catch (ContainerItemIsNullException $e) {
00083         die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
00084                 $e->getMessage()
00085         ));
00086 } catch (ContainerItemIsNoArrayException $e) {
00087         die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
00088                 $e->getMessage()
00089         ));
00090 } catch (ContainerMaybeDamagedException $e) {
00091         die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
00092                 $e->getMessage()
00093         ));
00094 }
00095 
00096 // Personal-Objekt debuggen
00097 if (defined('DEBUG_PERSONELL_OBJ')) {
00098         echo sprintf("The personal object looks like this:<br />
00099 <pre>%s</pre>\n",
00100                 print_r($personell, true)
00101         );
00102 }
00103 
00104 // Erstmal bis hier hin
00105 exit();
00106 
00107 // Etwas zum Testen...
00108 try {
00109         $personell = SimulatorPersonell::createSimulatorPersonell(20);
00110 } catch (NullPointerException $e) {
00111         die(sprintf("[Main:] Personal list not created for following reason: <span class=\"exception_reason\">%s</span><br />\n",
00112                 $e->getMessage()
00113         ));
00114 } catch (NoObjectException $e) {
00115         die(sprintf("[Main:] Personal list not created for following reason: <span class=\"exception_reason\">%s</span><br />\n",
00116                 $e->getMessage()
00117         ));
00118 } catch (MissingMethodException $e) {
00119         die(sprintf("[Main:] Personal list not created for following reason: <span class=\"exception_reason\">%s</span><br />\n",
00120                 $e->getMessage()
00121         ));
00122 }
00123 
00124 // Personal-Objekt debuggen
00125 if (defined('DEBUG_PERSONELL_OBJ')) {
00126         echo sprintf("The personal object looks like this:<br />
00127 <pre>%s</pre>\n",
00128                 print_r($personell, true)
00129         );
00130 }
00131 
00132 // Try to save the object (for testing purposes)
00133 try {
00134         $personell->saveObjectToDatabase();
00135 } catch (NullPointerException $e) {
00136         die(sprintf("[Main:] Object not saved for following reason: <span class=\"exception_reason\">%s</span><br />\n",
00137                 $e->getMessage()
00138         ));
00139 } catch (NoObjectException $e) {
00140         die(sprintf("[Main:] Object not saved for following reason: <span class=\"exception_reason\">%s</span><br />\n",
00141                 $e->getMessage()
00142         ));
00143 } catch (InvalidObjectException $e) {
00144         die(sprintf("[Main:] Object not saved for following reason: <span class=\"exception_reason\">%s</span><br />\n",
00145                 $e->getMessage()
00146         ));
00147 } catch (MissingMethodException $e) {
00148         die(sprintf("[Main:] Object not saved for following reason: <span class=\"exception_reason\">%s</span><br />\n",
00149                 $e->getMessage()
00150         ));
00151 } catch (UnsupportedLimitationPartException $e) {
00152         die(sprintf("[Main:] Object not saved for following reason: <span class=\"exception_reason\">%s</span><br />\n",
00153                 $e->getMessage()
00154         ));
00155 } catch (InvalidArrayCountException $e) {
00156         die(sprintf("[Main:] Object not saved for following reason: <span class=\"exception_reason\">%s</span><br />\n",
00157                 $e->getMessage()
00158         ));
00159 }
00160 
00161 //
00162 ?>

Generated on Mon Dec 8 01:06:46 2008 for Ship-Simulator by  doxygen 1.5.6