Several fixes for older tests
authorRoland Häder <roland@mxchange.org>
Mon, 7 Apr 2008 12:02:08 +0000 (12:02 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 7 Apr 2008 12:02:08 +0000 (12:02 +0000)
20 files changed:
.gitattributes
application/ship-simu/init.php
application/ship-simu/interfaces/class_ItemIsTradeable.php [deleted file]
application/ship-simu/main/class_Merchant.php
application/ship-simu/main/companies/class_ShippingCompany.php
application/ship-simu/main/drives/motor/class_Motor.php
application/ship-simu/main/structures/extended/cabines/class_BaseCabin.php
application/ship-simu/main/structures/extended/cabines/ship/class_EconomyCabin.php
application/ship-simu/main/structures/extended/cabines/ship/class_LowCabin.php
application/ship-simu/main/structures/extended/cabines/ship/class_LuxuryCabin.php
application/ship-simu/main/structures/extended/cabines/ship/class_PremierCabin.php
application/ship-simu/main/structures/extended/class_BaseUpperStructure.php
application/ship-simu/main/structures/extended/decks/cargo/class_CarDeck.php
application/ship-simu/main/structures/extended/decks/cargo/class_TrainDeck.php
application/ship-simu/main/structures/extended/decks/cargo/class_TruckDeck.php
application/ship-simu/main/structures/extended/upper/class_Bridge.php
inc/classes/main/database/classes/class_LocalFileDatabase.php
tests/old/contract-test.php
tests/old/loader-test.php
tests/old/personell-test.php

index 2e52a4b067b62c76b38eba6965d69b4c88803a13..c0302a5538f0108c212ef648177ac0f4a5573bd7 100644 (file)
@@ -48,7 +48,6 @@ application/ship-simu/interfaces/class_ConstructableShip.php -text
 application/ship-simu/interfaces/class_ConstructableShipPart.php -text
 application/ship-simu/interfaces/class_ContractPartner.php -text
 application/ship-simu/interfaces/class_Customer.php -text
-application/ship-simu/interfaces/class_ItemIsTradeable.php -text
 application/ship-simu/interfaces/class_Personellizer.php -text
 application/ship-simu/interfaces/class_SignableContract.php -text
 application/ship-simu/loader.php -text
index b8f232b7f9906e6ac201d611e58ed2b965756cdf..789420f37fb002452107c885d0b6219879748303 100644 (file)
@@ -8,7 +8,7 @@
  * You can prevent adding this application to the selector by uncommenting the
  * following line:
  *
- * if ((isset($this)) && (is_object($this)) && ($this->isSameClass("ApplicationSelector"))) { return; }
+ * if ((isset($this)) && (is_object($this)) && ($this->isClass("ApplicationSelector"))) { return; }
  *
  * isset() is required to prevent a warning and is_object() is highly required
  * when the application itself is requested in URL (hint: index.php?app=your_app)
diff --git a/application/ship-simu/interfaces/class_ItemIsTradeable.php b/application/ship-simu/interfaces/class_ItemIsTradeable.php
deleted file mode 100644 (file)
index e792622..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-/**
- * An interface for tradeable items
- *
- * @author             Roland Haeder <webmaster@ship-simu.org>
- * @version            0.0.0
- * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
- *
- * 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/>.
- */
-interface ItemIsTradeable extends FrameworkInterface {
-       /**
-        * Is this item (=object) tradeable?
-        *
-        * @return      boolean true  = is a tradeable object,
-        *                                      false = is not tradeable
-        */
-       function isTradeable ();
-}
-
-// [EOF]
-?>
index 3a2b892bd816576e1de3fc48215a9a2007493efc..c40f23678dd6ab69c9270b98a19bdfc34bf001df 100644 (file)
@@ -142,7 +142,7 @@ class Merchant extends BaseFrameworkSystem {
        }
 
        // Add new item to merchant's price list
-       public function addItemToPriceList (ItemIsTradeable $itemInstance, $price) {
+       public function addItemToPriceList (TradeableItem $itemInstance, $price) {
                // Secure pricing
                $price = (float) $price;
 
@@ -167,7 +167,7 @@ class Merchant extends BaseFrameworkSystem {
        }
 
        // Get a price from the merchant's list
-       public final function getPriceFromList (ItemIsTradeable $itemInstance) {
+       public final function getPriceFromList (TradeableItem $itemInstance) {
                $price = 0;
 
                // Iterate throw whole list
index 18c0e747a69156965e76c284b398d574be9a514f..d8c042550b275b9e701d0ad5b0b1c9ee0f1175b5 100644 (file)
@@ -367,7 +367,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                        } elseif (!is_object($shipyard)) {
                                // Not an object! ;-(
                                throw new NoObjectException($shipyard, self::EXCEPTION_IS_NO_OBJECT);
-                       } elseif (!$shipyard->isSameClass("Shipyard")) {
+                       } elseif (!$shipyard->isClass("Shipyard")) {
                                // Nope, so throw exception
                                throw new ClassMismatchException(array($shipyard->__toString(), "Shipyard"), self::EXCEPTION_CLASSES_NOT_MATCHING);
                        }
@@ -463,7 +463,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                        } elseif (!is_object($shipyard)) {
                                // Not an object! ;-(
                                throw new NoObjectException($shipyard, self::EXCEPTION_IS_NO_OBJECT);
-                       } elseif (!$shipyard->isSameClass("Shipyard")) {
+                       } elseif (!$shipyard->isClass("Shipyard")) {
                                // Class is not a shipyard
                                throw new ClassMismatchException(array($shipyard->__toString(), "Shipyard"), self::EXCEPTION_CLASSES_NOT_MATCHING);
                        }
@@ -538,7 +538,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                        } elseif (!is_object($shipyard)) {
                                // Not an object! ;-(
                                throw new NoObjectException($shipyard, self::EXCEPTION_IS_NO_OBJECT);
-                       } elseif (!$shipyard->isSameClass("Shipyard")) {
+                       } elseif (!$shipyard->isClass("Shipyard")) {
                                // Class is not a shipyard
                                throw new ClassMismatchException(array($shipyard->__toString(), "Shipyard"), self::EXCEPTION_CLASSES_NOT_MATCHING);
                        }
@@ -646,7 +646,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                } elseif (!is_object($contractInstance)) {
                        // Not an object! ;-(
                        throw new NoObjectException($contractInstance, self::EXCEPTION_IS_NO_OBJECT);
-               } elseif (!$contractInstance->isSameClass('WorksContract')) {
+               } elseif (!$contractInstance->isClass('WorksContract')) {
                        // Is not a merchant
                        throw new ClassMismatchException(array($contractInstance->__toString(), "WorksContract"), self::EXCEPTION_CLASSES_NOT_MATCHING);
                }
index eb3ac291f22e87a921760801c4717487b2810a52..9e347a849a38ada7bab07e29a8da16afdaae9bb4 100644 (file)
@@ -21,7 +21,7 @@
  * 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 Motor extends BaseDrive implements ItemIsTradeable, ConstructableShipPart {
+class Motor extends BaseDrive implements TradeableItem, ConstructableShipPart {
        // Constructor
        private function __construct() {
                // Call parent constructor
index 0831a3bfed74096e75d576079a147e0b22a5c2da..d0090311c72c001bb40b66200c198574237eabad 100644 (file)
@@ -51,7 +51,7 @@ class BaseCabin extends BaseCabinStructure {
 
        // Is this a cabin?
        public final function isCabin () {
-               return ($this->isSameClass("BaseCabin"));
+               return ($this->isClass("BaseCabin"));
        }
 
        /**
index 851c69e491af667b6e88ae31ca630b957f02e109..d95cc979cdaa43716ceed87f557281d57188570a 100644 (file)
@@ -21,7 +21,7 @@
  * 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 EconomyCabin extends BaseCabin implements ItemIsTradeable, ConstructableShipPart {
+class EconomyCabin extends BaseCabin implements TradeableItem, ConstructableShipPart {
        // Konstruktor
        private function __construct () {
                // Call parent constructor
index bef1817b3780dd2aa2db82df89a315dc64c79be7..7767ea38d922075e35cf8806bae072458c8fa3b8 100644 (file)
@@ -21,7 +21,7 @@
  * 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 LowCabin extends BaseCabin implements ItemIsTradeable, ConstructableShipPart {
+class LowCabin extends BaseCabin implements TradeableItem, ConstructableShipPart {
        // Konstruktor
        private function __construct () {
                // Call parent constructor
index 4b330ffa35b0d445b988dd7d23f67402164f7f98..6b1e5805fbf15e0cfcec07bf52520832c0e83633 100644 (file)
@@ -21,7 +21,7 @@
  * 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 LuxuryCabin extends BaseCabin implements ItemIsTradeable, ConstructableShipPart {
+class LuxuryCabin extends BaseCabin implements TradeableItem, ConstructableShipPart {
        // Konstruktor
        private function __construct () {
                // Call parent constructor
index 92ca60b7baa5d1b607e58da6b91a4f856c629adf..3daabdabfd67db9dda3faa84d379b0e5ac6b5ea0 100644 (file)
@@ -21,7 +21,7 @@
  * 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 PremierCabin extends BaseCabin implements ItemIsTradeable, ConstructableShipPart {
+class PremierCabin extends BaseCabin implements TradeableItem, ConstructableShipPart {
        // Konstruktor
        private function __construct () {
                // Call parent constructor
index e52a1249de839c5a45e85645775fe7862532cd0a..c930fee06c9cb37d8f51b88658e94475e9879eab 100644 (file)
@@ -47,23 +47,6 @@ class BaseUpperStructure extends BaseStructure {
        function constructor ($class) {
                $this->__construct($class);
        }
-
-       /**
-        * Stub!
-        */
-       public function saveObjectToDatabase () {
-               $this->getDebugInstance()->output(sprintf("[%s:] Stub <strong>%s</strong> erreicht.",
-                       $this->__toString(),
-                       __FUNCTION__
-               ));
-       }
-
-       /**
-        * Limits this object with an ObjectLimits instance
-        */
-       public function limitObject (ObjectLimits $limitInstance) {
-               ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
-       }
 }
 
 // [EOF]
index 1dcc45709e02a449bb154ef32b5e99322d22ce9f..61aaee0e20173299a2d496fa12222f4b4c959d5d 100644 (file)
@@ -21,7 +21,7 @@
  * 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 CarDeck extends BaseDeck implements ItemIsTradeable, ConstructableShipPart {
+class CarDeck extends BaseDeck implements TradeableItem, ConstructableShipPart {
        // Konstruktor
        private function __construct () {
                // Call parent constructor
index d63d17388724ed7167e7a0dcc08edb9418092bf2..06f132a97430db21748b99fa677406553dd105f6 100644 (file)
@@ -21,7 +21,7 @@
  * 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 TrainDeck extends BaseDeck implements ItemIsTradeable, ConstructableShipPart {
+class TrainDeck extends BaseDeck implements TradeableItem, ConstructableShipPart {
        // Konstruktor
        private function __construct () {
                // Call parent constructor
index 112c282453583df641adaf3e8e364e7ba1ad0ef5..ccbe596810d1d741d1ee6896442a180df4b7e91f 100644 (file)
@@ -22,7 +22,7 @@
  * 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 TruckDeck extends BaseDeck implements ItemIsTradeable, ConstructableShipPart {
+class TruckDeck extends BaseDeck implements TradeableItem, ConstructableShipPart {
        // Konstruktor
        private function __construct () {
                // Call parent constructor
index 995b7a2d4d231796fd7d300b3e416a680707e984..ec71072b447233a0b72e50c7421cb4d77239962b 100644 (file)
@@ -21,7 +21,7 @@
  * 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 Bridge extends BaseUpperStructure implements ItemIsTradeable, ConstructableShipPart {
+class Bridge extends BaseUpperStructure implements TradeableItem, ConstructableShipPart {
        // Constructor
        private function __construct () {
                // Call parent constructor
index ea4a8e19e49db057d7385fb2c677fe0092aa7391..1734064864640c77dba01534e96753ccd7ae7474 100644 (file)
@@ -352,6 +352,15 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                return $this->lastContents;
        }
 
+       /**
+        * Getter for file extension
+        *
+        * @return      $fileExtension  The array with elements 'header' and 'data'.
+        */
+       public final function getFileExtension () {
+               return $this->fileExtension;
+       }
+
        /**
         * Get cached (last fetched) data from the local file database
         *
index db00cedc731f96f8d9e92d469e2dfb237e35875c..607c8879dd81515ebc37e1b0f06219107f03d827 100644 (file)
@@ -2,8 +2,11 @@
 // Change directory
 @chdir("../..");
 
+// Set testing mode (no starter.php will be loaded!)
+define('TEST_MODE', true);
+
 // Load config file
-require(dirname(dirname(__FILE__)) . "/inc/config.php");
+require(dirname(dirname(dirname(__FILE__))) . "/inc/config.php");
 
 // Load all include files
 require(PATH . "inc/includes.php");
@@ -11,11 +14,18 @@ require(PATH . "inc/includes.php");
 // Load all game classes
 require(PATH . "inc/classes.php");
 
+// Load file I/O handler
+require(PATH . "inc/file_io.php");
+
+// Load database layer
+require(PATH . "inc/database.php");
+
 // Set default application
 FrameworkConfiguration::getInstance()->setConfigEntry("default_application", "ship-simu");
+$application = "ship-simu";
 
-// Set testing mode (no starter.php will be loaded!)
-define('TEST_MODE', true);
+// Load more includes
+require(PATH . "application/ship-simu/loader.php");
 
 // Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen
 // jetzt die Personalliste wiederherstellen
index 80b75c5a5a20bd78f69e61650f67288806979a3b..130f696123d48b65421521f869334689e7f1030b 100644 (file)
@@ -2,8 +2,11 @@
 // Change directory
 @chdir("../..");
 
+// Set testing mode (no starter.php will be loaded!)
+define('TEST_MODE', true);
+
 // Load config file
-require(dirname(dirname(__FILE__)) . "/inc/config.php");
+require(dirname(dirname(dirname(__FILE__))) . "/inc/config.php");
 
 // Load all include files
 require(PATH . "inc/includes.php");
@@ -11,11 +14,18 @@ require(PATH . "inc/includes.php");
 // Load all game classes
 require(PATH . "inc/classes.php");
 
+// Load file I/O handler
+require(PATH . "inc/file_io.php");
+
+// Load database layer
+require(PATH . "inc/database.php");
+
 // Set default application
 FrameworkConfiguration::getInstance()->setConfigEntry("default_application", "ship-simu");
+$application = "ship-simu";
 
-// Set testing mode (no starter.php will be loaded!)
-define('TEST_MODE', true);
+// Load more includes
+require(PATH . "application/ship-simu/loader.php");
 
 // Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen
 // jetzt die Personalliste wiederherstellen
index c28823797a0d955303c99fe7ba646fdc5605ee10..4fc139b2525de5c1cc6f81f619ddddd3b9d7a6a2 100644 (file)
@@ -2,8 +2,11 @@
 // Change directory
 @chdir("../..");
 
+// Set testing mode (no starter.php will be loaded!)
+define('TEST_MODE', true);
+
 // Load config file
-require(dirname(dirname(__FILE__)) . "/inc/config.php");
+require(dirname(dirname(dirname(__FILE__))) . "/inc/config.php");
 
 // Load all include files
 require(PATH . "inc/includes.php");
@@ -11,11 +14,18 @@ require(PATH . "inc/includes.php");
 // Load all game classes
 require(PATH . "inc/classes.php");
 
+// Load file I/O handler
+require(PATH . "inc/file_io.php");
+
+// Load database layer
+require(PATH . "inc/database.php");
+
 // Set default application
 FrameworkConfiguration::getInstance()->setConfigEntry("default_application", "ship-simu");
+$application = "ship-simu";
 
-// Set testing mode (no starter.php will be loaded!)
-define('TEST_MODE', true);
+// Load more includes
+require(PATH . "application/ship-simu/loader.php");
 
 // Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen
 // jetzt die Personalliste wiederherstellen