]> git.mxchange.org Git - shipsimu.git/blob - tests/personell-test.php
e6acd10a4706c498edd356fecc25e211a40ac29f
[shipsimu.git] / tests / personell-test.php
1 <?php
2 define('TEST', true);
3 // Change directory
4 @chdir("..");
5
6 // Load config file
7 require(dirname(dirname(__FILE__)) . "/inc/config.php");
8
9 // Load all include files
10 require(PATH . "inc/includes.php");
11
12 // Load all game classes
13 require(PATH . "inc/classes.php");
14
15 // Load more include files
16 $_GET['app'] = "ship-simu";
17 require_once(PATH . "inc/selector.php");
18
19 // Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen
20 // jetzt die Personalliste wiederherstellen
21 try {
22         $test = SimulatorPersonell::createSimulatorPersonellByID("SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98");
23 } catch (InvalidIDFormatException $e) {
24         die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
25                 $e->getMessage()
26         ));
27 } catch (InvalidArrayCountException $e) {
28         die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
29                 $e->getMessage()
30         ));
31 } catch (NullPointerException $e) {
32         die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
33                 $e->getMessage()
34         ));
35 } catch (NoObjectException $e) {
36         die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
37                 $e->getMessage()
38         ));
39 } catch (MissingMethodException $e) {
40         die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
41                 $e->getMessage()
42         ));
43 } catch (FileIsEmptyException $e) {
44         die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
45                 $e->getMessage()
46         ));
47 } catch (FilePointerNotOpenedException $e) {
48         die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
49                 $e->getMessage()
50         ));
51 } catch (InvalidArrayCountException $e) {
52         die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
53                 $e->getMessage()
54         ));
55 } catch (InvalidMD5ChecksumException $e) {
56         die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
57                 $e->getMessage()
58         ));
59 } catch (InvalidDataLengthException $e) {
60         die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
61                 $e->getMessage()
62         ));
63 } catch (InvalidSimulatorIDException $e) {
64         die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
65                 $e->getMessage()
66         ));
67 } catch (MismatchingCompressorsException $e) {
68         die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
69                 $e->getMessage()
70         ));
71 } catch (ContainerItemIsNullException $e) {
72         die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
73                 $e->getMessage()
74         ));
75 } catch (ContainerItemIsNoArrayException $e) {
76         die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
77                 $e->getMessage()
78         ));
79 } catch (ContainerMaybeDamagedException $e) {
80         die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
81                 $e->getMessage()
82         ));
83 }
84
85 // Personal-Objekt debuggen
86 if (defined('DEBUG_PERSONELL_OBJ')) {
87         echo sprintf("Das Personal-Objekt sieht wie folgt aus:<br />
88 <pre>%s</pre>\n",
89                 print_r($test, true)
90         );
91 }
92
93 // Erstmal bis hier hin
94 exit();
95
96 // Etwas zum Testen...
97 try {
98         $test = SimulatorPersonell::createSimulatorPersonell(20);
99 } catch (NullPointerException $e) {
100         die(sprintf("[Main:] Personenliste nicht angelegt. Grund: <strong>%s</strong><br />\n",
101                 $e->getMessage()
102         ));
103 } catch (NoObjectException $e) {
104         die(sprintf("[Main:] Personenliste nicht angelegt. Grund: <strong>%s</strong><br />\n",
105                 $e->getMessage()
106         ));
107 } catch (MissingMethodException $e) {
108         die(sprintf("[Main:] Personenliste nicht angelegt. Grund: <strong>%s</strong><br />\n",
109                 $e->getMessage()
110         ));
111
112
113 // Personal-Objekt debuggen
114 if (defined('DEBUG_PERSONELL_OBJ')) {
115         echo sprintf("Das Personal-Objekt sieht wie folgt aus:<br />
116 <pre>%s</pre>\n",
117                 print_r($test, true)
118         );
119 }
120
121 // Try to save the object (for testing purposes)
122 try {
123         $test->saveObjectToDatabase();
124 } catch (NullPointerException $e) {
125         die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
126                 $e->getMessage()
127         ));
128 } catch (NoObjectException $e) {
129         die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
130                 $e->getMessage()
131         ));
132 } catch (InvalidObjectException $e) {
133         die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
134                 $e->getMessage()
135         ));
136 } catch (MissingMethodException $e) {
137         die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
138                 $e->getMessage()
139         ));
140 } catch (UnsupportedLimitationPartException $e) {
141         die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
142                 $e->getMessage()
143         ));
144 } catch (GetterNotFoundException $e) {
145         die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
146                 $e->getMessage()
147         ));
148 } catch (NoArrayCreatedException $e) {
149         die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
150                 $e->getMessage()
151         ));
152 } catch (InvalidArrayCountException $e) {
153         die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
154                 $e->getMessage()
155         ));
156 }
157
158 //
159 ?>