]> git.mxchange.org Git - hub.git/blob - application/hub/main/template/producer/test_units/class_XmlCruncherTestUnitTemplateEngine.php
Forgot this ... :(
[hub.git] / application / hub / main / template / producer / test_units / class_XmlCruncherTestUnitTemplateEngine.php
1 <?php
2 /**
3  * An TestUnit template engine class for XML templates
4  *
5  * @author              Roland Haeder <webmaster@ship-simu.org>
6  * @version             0.0.0
7  * @copyright   Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
8  * @license             GNU GPL 3.0 or any newer version
9  * @link                http://www.ship-simu.org
10  * @todo                This template engine does not make use of setTemplateType()
11  *
12  * This program is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation, either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <http://www.gnu.org/licenses/>.
24  */
25 class XmlCruncherTestUnitTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
26         /**
27          * Protected constructor
28          *
29          * @return      void
30          */
31         protected function __construct () {
32                 // Call parent constructor
33                 parent::__construct(__CLASS__);
34
35                 // Init sub nodes
36                 $this->subNodes = array(
37                         'meta-data',
38                         'global-project-identifier',
39                         'test-unit-created',
40                         'cipher',
41                         'cipher-function',
42                         'cipher-name',
43                         'unprocessed-data',
44                         'encrypted-message',
45                         'cruncher-key-list',
46                         'cruncher-key',
47                         'key-id',
48                         'key-value'
49                 );
50         }
51
52         /**
53          * Creates an instance of the class TemplateEngine and prepares it for usage
54          *
55          * @return      $templateInstance               An instance of TemplateEngine
56          * @throws      BasePathIsEmptyException                If the provided $templateBasePath is empty
57          * @throws      InvalidBasePathStringException  If $templateBasePath is no string
58          * @throws      BasePathIsNoDirectoryException  If $templateBasePath is no
59          *                                                                                      directory or not found
60          * @throws      BasePathReadProtectedException  If $templateBasePath is
61          *                                                                                      read-protected
62          */
63         public static final function createXmlCruncherTestUnitTemplateEngine () {
64                 // Get a new instance
65                 $templateInstance = new XmlCruncherTestUnitTemplateEngine();
66
67                 // Init template instance
68                 $templateInstance->initXmlTemplateEngine('cruncher', 'test_unit');
69
70                 // Return the prepared instance
71                 return $templateInstance;
72         }
73
74         /**
75          * Load a specified cruncher_test_unit template into the engine
76          *
77          * @param       $template       The cruncher_test_unit template we shall load which is
78          *                                              located in 'cruncher_test_unit' by default
79          * @return      void
80          */
81         public function loadCruncherTestUnitTemplate ($template) {
82                 // Set template type
83                 $this->setTemplateType($this->getConfigInstance()->getConfigEntry('cruncher_test_unit_template_type'));
84
85                 // Load the special template
86                 $this->loadTemplate($template);
87         }
88
89         /**
90          * Currently not used
91          *
92          * @param       $resource               XML parser resource (currently ignored)
93          * @param       $characters             Characters to handle
94          * @return      void
95          */
96         public function characterHandler ($resource, $characters) {
97                 // Trim all spaces away
98                 $characters = trim($characters);
99
100                 // Is this string empty?
101                 if (empty($characters)) {
102                         // Then skip it silently
103                         return false;
104                 } // END - if
105
106                 // Assign the found characters to variable and use the last entry from
107                 // stack as the name
108                 parent::assignVariable($this->getStackerInstance()->getNamed('cruncher_test_unit'), $characters);
109         }
110
111         /**
112          * Getter for cache file (FQFN)
113          *
114          * @return      $fqfn   Full-qualified file name of the menu cache
115          */
116         public function getCruncherTestUnitCacheFqfn () {
117                 $this->partialStub('Please implement this method.');
118         }
119
120         /**
121          * Starts the test-unit
122          *
123          * @return      void
124          */
125         private function startCruncherTestUnit () {
126                 // Push the node name on the stacker
127                 $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'cruncher-test-unit');
128         }
129
130         /**
131          * Starts the meta-data
132          *
133          * @return      void
134          */
135         private function startMetaData () {
136                 // Push the node name on the stacker
137                 $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'meta-data');
138         }
139
140         /**
141          * Starts the global-project-identifier
142          *
143          * @return      void
144          */
145         private function startGlobalProjectIdentifier () {
146                 // Push the node name on the stacker
147                 $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'global-project-identifier');
148         }
149
150         /**
151          * Finishes the global-project-identifier
152          *
153          * @return      void
154          */
155         private function finishGlobalProjectIdentifier () {
156                 // Pop the last entry
157                 $this->getStackerInstance()->popNamed('cruncher_test_unit');
158         }
159
160         /**
161          * Starts the test-unit-created
162          *
163          * @return      void
164          */
165         private function startTestUnitCreated () {
166                 // Push the node name on the stacker
167                 $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'test-unit-created');
168         }
169
170         /**
171          * Finishes the test-unit-created
172          *
173          * @return      void
174          */
175         private function finishTestUnitCreated () {
176                 // Pop the last entry
177                 $this->getStackerInstance()->popNamed('cruncher_test_unit');
178         }
179
180         /**
181          * Starts the cipher
182          *
183          * @return      void
184          */
185         private function startCipher () {
186                 // Push the node name on the stacker
187                 $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'cipher');
188         }
189
190         /**
191          * Starts the cipher-function
192          *
193          * @return      void
194          */
195         private function startCipherFunction () {
196                 // Push the node name on the stacker
197                 $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'cipher-function');
198         }
199
200         /**
201          * Finishes the cipher-function
202          *
203          * @return      void
204          */
205         private function finishCipherFunction () {
206                 // Pop the last entry
207                 $this->getStackerInstance()->popNamed('cruncher_test_unit');
208         }
209
210         /**
211          * Starts the cipher-name
212          *
213          * @return      void
214          */
215         private function startCipherName () {
216                 // Push the node name on the stacker
217                 $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'cipher-name');
218         }
219
220         /**
221          * Finishes the cipher-name
222          *
223          * @return      void
224          */
225         private function finishCipherName () {
226                 // Pop the last entry
227                 $this->getStackerInstance()->popNamed('cruncher_test_unit');
228         }
229
230         /**
231          * Finishes the cipher
232          *
233          * @return      void
234          */
235         private function finishCipher () {
236                 // Pop the last entry
237                 $this->getStackerInstance()->popNamed('cruncher_test_unit');
238         }
239
240         /**
241          * Finishes the meta-data
242          *
243          * @return      void
244          */
245         private function finishMetaData () {
246                 // Pop the last entry
247                 $this->getStackerInstance()->popNamed('cruncher_test_unit');
248         }
249
250         /**
251          * Starts the unprocessed-data
252          *
253          * @return      void
254          */
255         private function startUnprocessedData () {
256                 // Push the node name on the stacker
257                 $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'unprocessed-data');
258         }
259
260         /**
261          * Starts the encrypted-message
262          *
263          * @return      void
264          */
265         private function startEncryptedMessage () {
266                 // Push the node name on the stacker
267                 $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'encrypted-message');
268         }
269
270         /**
271          * Finishes the encrypted-message
272          *
273          * @return      void
274          */
275         private function finishEncryptedMessage () {
276                 // Pop the last entry
277                 $this->getStackerInstance()->popNamed('cruncher_test_unit');
278         }
279
280         /**
281          * Starts the cruncher-key-list
282          *
283          * @param       $keyCount       Count of keys in this test unit
284          * @return      void
285          * @todo        Handle $keyCount
286          */
287         private function startCruncherKeyList ($keyCount) {
288                 // Push the node name on the stacker
289                 $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'cruncher-key-list');
290         }
291
292         /**
293          * Starts the cruncher-key
294          *
295          * @return      void
296          */
297         private function startCruncherKey () {
298                 // Push the node name on the stacker
299                 $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'cruncher-key');
300         }
301
302         /**
303          * Starts the key-id
304          *
305          * @return      void
306          */
307         private function startKeyId () {
308                 // Push the node name on the stacker
309                 $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'key-id');
310         }
311
312         /**
313          * Finishes the key-id
314          *
315          * @return      void
316          */
317         private function finishKeyId () {
318                 // Pop the last entry
319                 $this->getStackerInstance()->popNamed('cruncher_test_unit');
320         }
321
322         /**
323          * Starts the key-value
324          *
325          * @return      void
326          */
327         private function startKeyValue () {
328                 // Push the node name on the stacker
329                 $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'key-value');
330         }
331
332         /**
333          * Finishes the key-value
334          *
335          * @return      void
336          */
337         private function finishKeyValue () {
338                 // Pop the last entry
339                 $this->getStackerInstance()->popNamed('cruncher_test_unit');
340         }
341
342         /**
343          * Finishes the cruncher-key
344          *
345          * @return      void
346          */
347         private function finishCruncherKey () {
348                 // Pop the last entry
349                 $this->getStackerInstance()->popNamed('cruncher_test_unit');
350         }
351
352         /**
353          * Finishes the cruncher-key-list
354          *
355          * @return      void
356          */
357         private function finishCruncherKeyList () {
358                 // Pop the last entry
359                 $this->getStackerInstance()->popNamed('cruncher_test_unit');
360         }
361
362         /**
363          * Finishes the unprocessed-data
364          *
365          * @return      void
366          */
367         private function finishUnprocessedData () {
368                 // Pop the last entry
369                 $this->getStackerInstance()->popNamed('cruncher_test_unit');
370         }
371
372         /**
373          * Finishes the test-unit
374          *
375          * @return      void
376          */
377         private function finishCruncherTestUnit () {
378                 // Pop the last entry
379                 $this->getStackerInstance()->popNamed('cruncher_test_unit');
380         }
381 }
382
383 // [EOF]
384 ?>