From 243934eb16b793ebd8cb0e43a968e17175ec5a75 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 7 Apr 2008 12:02:08 +0000 Subject: [PATCH] Several fixes for older tests --- .gitattributes | 1 - application/ship-simu/init.php | 2 +- .../interfaces/class_ItemIsTradeable.php | 35 ------------------- application/ship-simu/main/class_Merchant.php | 4 +-- .../main/companies/class_ShippingCompany.php | 8 ++--- .../main/drives/motor/class_Motor.php | 2 +- .../extended/cabines/class_BaseCabin.php | 2 +- .../cabines/ship/class_EconomyCabin.php | 2 +- .../extended/cabines/ship/class_LowCabin.php | 2 +- .../cabines/ship/class_LuxuryCabin.php | 2 +- .../cabines/ship/class_PremierCabin.php | 2 +- .../extended/class_BaseUpperStructure.php | 17 --------- .../extended/decks/cargo/class_CarDeck.php | 2 +- .../extended/decks/cargo/class_TrainDeck.php | 2 +- .../extended/decks/cargo/class_TruckDeck.php | 2 +- .../extended/upper/class_Bridge.php | 2 +- .../classes/class_LocalFileDatabase.php | 9 +++++ tests/old/contract-test.php | 16 +++++++-- tests/old/loader-test.php | 16 +++++++-- tests/old/personell-test.php | 16 +++++++-- 20 files changed, 65 insertions(+), 79 deletions(-) delete mode 100644 application/ship-simu/interfaces/class_ItemIsTradeable.php diff --git a/.gitattributes b/.gitattributes index 2e52a4b..c0302a5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/application/ship-simu/init.php b/application/ship-simu/init.php index b8f232b..789420f 100644 --- a/application/ship-simu/init.php +++ b/application/ship-simu/init.php @@ -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 index e792622..0000000 --- a/application/ship-simu/interfaces/class_ItemIsTradeable.php +++ /dev/null @@ -1,35 +0,0 @@ - - * @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 . - */ -interface ItemIsTradeable extends FrameworkInterface { - /** - * Is this item (=object) tradeable? - * - * @return boolean true = is a tradeable object, - * false = is not tradeable - */ - function isTradeable (); -} - -// [EOF] -?> diff --git a/application/ship-simu/main/class_Merchant.php b/application/ship-simu/main/class_Merchant.php index 3a2b892..c40f236 100644 --- a/application/ship-simu/main/class_Merchant.php +++ b/application/ship-simu/main/class_Merchant.php @@ -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 diff --git a/application/ship-simu/main/companies/class_ShippingCompany.php b/application/ship-simu/main/companies/class_ShippingCompany.php index 18c0e74..d8c0425 100644 --- a/application/ship-simu/main/companies/class_ShippingCompany.php +++ b/application/ship-simu/main/companies/class_ShippingCompany.php @@ -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); } diff --git a/application/ship-simu/main/drives/motor/class_Motor.php b/application/ship-simu/main/drives/motor/class_Motor.php index eb3ac29..9e347a8 100644 --- a/application/ship-simu/main/drives/motor/class_Motor.php +++ b/application/ship-simu/main/drives/motor/class_Motor.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class Motor extends BaseDrive implements ItemIsTradeable, ConstructableShipPart { +class Motor extends BaseDrive implements TradeableItem, ConstructableShipPart { // Constructor private function __construct() { // Call parent constructor diff --git a/application/ship-simu/main/structures/extended/cabines/class_BaseCabin.php b/application/ship-simu/main/structures/extended/cabines/class_BaseCabin.php index 0831a3b..d009031 100644 --- a/application/ship-simu/main/structures/extended/cabines/class_BaseCabin.php +++ b/application/ship-simu/main/structures/extended/cabines/class_BaseCabin.php @@ -51,7 +51,7 @@ class BaseCabin extends BaseCabinStructure { // Is this a cabin? public final function isCabin () { - return ($this->isSameClass("BaseCabin")); + return ($this->isClass("BaseCabin")); } /** diff --git a/application/ship-simu/main/structures/extended/cabines/ship/class_EconomyCabin.php b/application/ship-simu/main/structures/extended/cabines/ship/class_EconomyCabin.php index 851c69e..d95cc97 100644 --- a/application/ship-simu/main/structures/extended/cabines/ship/class_EconomyCabin.php +++ b/application/ship-simu/main/structures/extended/cabines/ship/class_EconomyCabin.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class EconomyCabin extends BaseCabin implements ItemIsTradeable, ConstructableShipPart { +class EconomyCabin extends BaseCabin implements TradeableItem, ConstructableShipPart { // Konstruktor private function __construct () { // Call parent constructor diff --git a/application/ship-simu/main/structures/extended/cabines/ship/class_LowCabin.php b/application/ship-simu/main/structures/extended/cabines/ship/class_LowCabin.php index bef1817..7767ea3 100644 --- a/application/ship-simu/main/structures/extended/cabines/ship/class_LowCabin.php +++ b/application/ship-simu/main/structures/extended/cabines/ship/class_LowCabin.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class LowCabin extends BaseCabin implements ItemIsTradeable, ConstructableShipPart { +class LowCabin extends BaseCabin implements TradeableItem, ConstructableShipPart { // Konstruktor private function __construct () { // Call parent constructor diff --git a/application/ship-simu/main/structures/extended/cabines/ship/class_LuxuryCabin.php b/application/ship-simu/main/structures/extended/cabines/ship/class_LuxuryCabin.php index 4b330ff..6b1e580 100644 --- a/application/ship-simu/main/structures/extended/cabines/ship/class_LuxuryCabin.php +++ b/application/ship-simu/main/structures/extended/cabines/ship/class_LuxuryCabin.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class LuxuryCabin extends BaseCabin implements ItemIsTradeable, ConstructableShipPart { +class LuxuryCabin extends BaseCabin implements TradeableItem, ConstructableShipPart { // Konstruktor private function __construct () { // Call parent constructor diff --git a/application/ship-simu/main/structures/extended/cabines/ship/class_PremierCabin.php b/application/ship-simu/main/structures/extended/cabines/ship/class_PremierCabin.php index 92ca60b..3daabda 100644 --- a/application/ship-simu/main/structures/extended/cabines/ship/class_PremierCabin.php +++ b/application/ship-simu/main/structures/extended/cabines/ship/class_PremierCabin.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class PremierCabin extends BaseCabin implements ItemIsTradeable, ConstructableShipPart { +class PremierCabin extends BaseCabin implements TradeableItem, ConstructableShipPart { // Konstruktor private function __construct () { // Call parent constructor diff --git a/application/ship-simu/main/structures/extended/class_BaseUpperStructure.php b/application/ship-simu/main/structures/extended/class_BaseUpperStructure.php index e52a124..c930fee 100644 --- a/application/ship-simu/main/structures/extended/class_BaseUpperStructure.php +++ b/application/ship-simu/main/structures/extended/class_BaseUpperStructure.php @@ -47,23 +47,6 @@ class BaseUpperStructure extends BaseStructure { function constructor ($class) { $this->__construct($class); } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } } // [EOF] diff --git a/application/ship-simu/main/structures/extended/decks/cargo/class_CarDeck.php b/application/ship-simu/main/structures/extended/decks/cargo/class_CarDeck.php index 1dcc457..61aaee0 100644 --- a/application/ship-simu/main/structures/extended/decks/cargo/class_CarDeck.php +++ b/application/ship-simu/main/structures/extended/decks/cargo/class_CarDeck.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class CarDeck extends BaseDeck implements ItemIsTradeable, ConstructableShipPart { +class CarDeck extends BaseDeck implements TradeableItem, ConstructableShipPart { // Konstruktor private function __construct () { // Call parent constructor diff --git a/application/ship-simu/main/structures/extended/decks/cargo/class_TrainDeck.php b/application/ship-simu/main/structures/extended/decks/cargo/class_TrainDeck.php index d63d173..06f132a 100644 --- a/application/ship-simu/main/structures/extended/decks/cargo/class_TrainDeck.php +++ b/application/ship-simu/main/structures/extended/decks/cargo/class_TrainDeck.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class TrainDeck extends BaseDeck implements ItemIsTradeable, ConstructableShipPart { +class TrainDeck extends BaseDeck implements TradeableItem, ConstructableShipPart { // Konstruktor private function __construct () { // Call parent constructor diff --git a/application/ship-simu/main/structures/extended/decks/cargo/class_TruckDeck.php b/application/ship-simu/main/structures/extended/decks/cargo/class_TruckDeck.php index 112c282..ccbe596 100644 --- a/application/ship-simu/main/structures/extended/decks/cargo/class_TruckDeck.php +++ b/application/ship-simu/main/structures/extended/decks/cargo/class_TruckDeck.php @@ -22,7 +22,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class TruckDeck extends BaseDeck implements ItemIsTradeable, ConstructableShipPart { +class TruckDeck extends BaseDeck implements TradeableItem, ConstructableShipPart { // Konstruktor private function __construct () { // Call parent constructor diff --git a/application/ship-simu/main/structures/extended/upper/class_Bridge.php b/application/ship-simu/main/structures/extended/upper/class_Bridge.php index 995b7a2..ec71072 100644 --- a/application/ship-simu/main/structures/extended/upper/class_Bridge.php +++ b/application/ship-simu/main/structures/extended/upper/class_Bridge.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class Bridge extends BaseUpperStructure implements ItemIsTradeable, ConstructableShipPart { +class Bridge extends BaseUpperStructure implements TradeableItem, ConstructableShipPart { // Constructor private function __construct () { // Call parent constructor diff --git a/inc/classes/main/database/classes/class_LocalFileDatabase.php b/inc/classes/main/database/classes/class_LocalFileDatabase.php index ea4a8e1..1734064 100644 --- a/inc/classes/main/database/classes/class_LocalFileDatabase.php +++ b/inc/classes/main/database/classes/class_LocalFileDatabase.php @@ -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 * diff --git a/tests/old/contract-test.php b/tests/old/contract-test.php index db00ced..607c887 100644 --- a/tests/old/contract-test.php +++ b/tests/old/contract-test.php @@ -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 diff --git a/tests/old/loader-test.php b/tests/old/loader-test.php index 80b75c5..130f696 100644 --- a/tests/old/loader-test.php +++ b/tests/old/loader-test.php @@ -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 diff --git a/tests/old/personell-test.php b/tests/old/personell-test.php index c288237..4fc139b 100644 --- a/tests/old/personell-test.php +++ b/tests/old/personell-test.php @@ -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 -- 2.30.2