+++ /dev/null
-<?php
-/**
- * An TestUnit template engine class for XML templates
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2011 - 2014 Cruncher Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.shipsimu.org
- * @todo This template engine does not make use of setTemplateType()
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class XmlCruncherTestUnitTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
-
- // Init sub nodes
- $this->setSubNodes(array(
- 'meta-data',
- 'global-project-identifier',
- 'test-unit-created',
- 'cipher',
- 'cipher-function',
- 'cipher-name',
- 'unprocessed-data',
- 'encrypted-message',
- 'cruncher-key-list',
- 'cruncher-key',
- 'key-id',
- 'key-value'
- ));
- }
-
- /**
- * Creates an instance of the class TemplateEngine and prepares it for usage
- *
- * @return $templateInstance An instance of TemplateEngine
- * @throws BasePathIsEmptyException If the provided $templateBasePath is empty
- * @throws InvalidBasePathStringException If $templateBasePath is no string
- * @throws BasePathIsNoDirectoryException If $templateBasePath is no
- * directory or not found
- * @throws BasePathReadProtectedException If $templateBasePath is
- * read-protected
- */
- public static final function createXmlCruncherTestUnitTemplateEngine () {
- // Get a new instance
- $templateInstance = new XmlCruncherTestUnitTemplateEngine();
-
- // Init template instance
- $templateInstance->initXmlTemplateEngine('cruncher', 'test_unit');
-
- // Return the prepared instance
- return $templateInstance;
- }
-
- /**
- * Currently not used
- *
- * @param $resource XML parser resource (currently ignored)
- * @param $characters Characters to handle
- * @return void
- */
- public function characterHandler ($resource, $characters) {
- // Trim all spaces away
- $characters = trim($characters);
-
- // Is this string empty?
- if (empty($characters)) {
- // Then skip it silently
- return;
- } // END - if
-
- // Assign the found characters to variable and use the last entry from
- // stack as the name
- parent::assignVariable($this->getStackInstance()->getNamed('cruncher_test_unit'), $characters);
- }
-
- /**
- * Getter for cache file (FQFN)
- *
- * @return $fqfn Full-qualified file name of the menu cache
- */
- public function getCruncherTestUnitCacheFqfn () {
- $this->partialStub('Please implement this method.');
- }
-
- /**
- * Starts the test-unit
- *
- * @return void
- */
- protected function startTestUnit () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('cruncher_test_unit', 'cruncher-test-unit');
- }
-
- /**
- * Starts the meta-data
- *
- * @return void
- */
- protected function startMetaData () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('cruncher_test_unit', 'meta-data');
- }
-
- /**
- * Starts the global-project-identifier
- *
- * @return void
- */
- protected function startGlobalProjectIdentifier () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('cruncher_test_unit', 'global-project-identifier');
- }
-
- /**
- * Finishes the global-project-identifier
- *
- * @return void
- */
- protected function finishGlobalProjectIdentifier () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('cruncher_test_unit');
- }
-
- /**
- * Starts the test-unit-created
- *
- * @return void
- */
- protected function startTestUnitCreated () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('cruncher_test_unit', 'test-unit-created');
- }
-
- /**
- * Finishes the test-unit-created
- *
- * @return void
- */
- protected function finishTestUnitCreated () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('cruncher_test_unit');
- }
-
- /**
- * Starts the cipher
- *
- * @return void
- */
- protected function startCipher () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('cruncher_test_unit', 'cipher');
- }
-
- /**
- * Starts the cipher-function
- *
- * @return void
- */
- protected function startCipherFunction () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('cruncher_test_unit', 'cipher-function');
- }
-
- /**
- * Finishes the cipher-function
- *
- * @return void
- */
- protected function finishCipherFunction () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('cruncher_test_unit');
- }
-
- /**
- * Starts the cipher-name
- *
- * @return void
- */
- protected function startCipherName () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('cruncher_test_unit', 'cipher-name');
- }
-
- /**
- * Finishes the cipher-name
- *
- * @return void
- */
- protected function finishCipherName () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('cruncher_test_unit');
- }
-
- /**
- * Finishes the cipher
- *
- * @return void
- */
- protected function finishCipher () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('cruncher_test_unit');
- }
-
- /**
- * Finishes the meta-data
- *
- * @return void
- */
- protected function finishMetaData () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('cruncher_test_unit');
- }
-
- /**
- * Starts the unprocessed-data
- *
- * @return void
- */
- protected function startUnprocessedData () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('cruncher_test_unit', 'unprocessed-data');
- }
-
- /**
- * Starts the encrypted-message
- *
- * @return void
- */
- protected function startEncryptedMessage () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('cruncher_test_unit', 'encrypted-message');
- }
-
- /**
- * Finishes the encrypted-message
- *
- * @return void
- */
- protected function finishEncryptedMessage () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('cruncher_test_unit');
- }
-
- /**
- * Starts the cruncher-key-list
- *
- * @param $keyCount Count of keys in this test unit
- * @return void
- * @todo Handle $keyCount
- */
- protected function startCruncherKeyList ($keyCount) {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('cruncher_test_unit', 'cruncher-key-list');
- }
-
- /**
- * Starts the cruncher-key
- *
- * @return void
- */
- protected function startCruncherKey () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('cruncher_test_unit', 'cruncher-key');
- }
-
- /**
- * Starts the key-id
- *
- * @return void
- */
- protected function startKeyId () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('cruncher_test_unit', 'key-id');
- }
-
- /**
- * Finishes the key-id
- *
- * @return void
- */
- protected function finishKeyId () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('cruncher_test_unit');
- }
-
- /**
- * Starts the key-value
- *
- * @return void
- */
- protected function startKeyValue () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('cruncher_test_unit', 'key-value');
- }
-
- /**
- * Finishes the key-value
- *
- * @return void
- */
- protected function finishKeyValue () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('cruncher_test_unit');
- }
-
- /**
- * Finishes the cruncher-key
- *
- * @return void
- */
- protected function finishCruncherKey () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('cruncher_test_unit');
- }
-
- /**
- * Finishes the cruncher-key-list
- *
- * @return void
- */
- protected function finishCruncherKeyList () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('cruncher_test_unit');
- }
-
- /**
- * Finishes the unprocessed-data
- *
- * @return void
- */
- protected function finishUnprocessedData () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('cruncher_test_unit');
- }
-
- /**
- * Finishes the test-unit
- *
- * @return void
- */
- protected function finishTestUnit () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('cruncher_test_unit');
- }
-}
-
-// [EOF]
-?>