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 2e52a4b..c0302a5 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 b8f232b..789420f 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 3a2b892..c40f236 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 18c0e74..d8c0425 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 eb3ac29..9e347a8 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 0831a3b..d009031 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 851c69e..d95cc97 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 bef1817..7767ea3 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 4b330ff..6b1e580 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 92ca60b..3daabda 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 e52a124..c930fee 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 1dcc457..61aaee0 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 d63d173..06f132a 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 112c282..ccbe596 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 995b7a2..ec71072 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 ea4a8e1..1734064 100644 (file)
@@ -353,6 +353,15 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
        }
 
        /**
+        * 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
         *
         * @param               $uniqueID               The ID number for looking up the data
index db00ced..607c887 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 80b75c5..130f696 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 c288237..4fc139b 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