/** * Clean-up oxarticles table + parent::tearDown() */ protected function tearDown() { $configFile = new ConfigFile(OX_BASE_PATH . 'config.inc.php'); Registry::set('oxConfigFile', $configFile); $this->cleanUpTable('oxarticles'); parent::tearDown(); }
/** * Standard set up method. Calls parent first. */ public function setUp() { parent::setUp(); $configFile = Registry::get("oxConfigFile"); $configFile->setVar('sShopDir', realpath(__DIR__ . '/TestData')); Registry::set('oxConfigFile', $configFile); $this->environment = new Environment(); }
/** * Testing oxcmp_shop::render() */ public function testRenderNoActiveShop() { $oView = $this->getMock("oxView", array("getClassName")); $oView->expects($this->once())->method('getClassName')->will($this->returnValue("test")); $oShop = oxNew('oxShop'); $oShop->oxshops__oxactive = new oxField(0); $oUtils = $this->getMock('oxUtils', array('showOfflinePage')); $oUtils->expects($this->once())->method('showOfflinePage'); Registry::set('oxUtils', $oUtils); $oConfig = $this->getMock("oxConfig", array("getConfigParam", "getActiveView", "getActiveShop")); $oConfig->expects($this->once())->method('getActiveView')->will($this->returnValue($oView)); $oConfig->expects($this->any())->method('getConfigParam')->will($this->returnValue(false)); $oConfig->expects($this->once())->method('getActiveShop')->will($this->returnValue($oShop)); $oCmp = $this->getMock("oxcmp_shop", array("getConfig", "isAdmin"), array(), '', false); $oCmp->expects($this->once())->method('getConfig')->will($this->returnValue($oConfig)); $oCmp->expects($this->once())->method('isAdmin')->will($this->returnValue(false)); $oCmp->render(); }
public function testGetDbThrowsDatabaseNotConfiguredException() { /** @var ConfigFile $configFileBackup Backup of the configFile as stored in Registry. This object must be restored */ $configFileBackup = Registry::get('oxConfigFile'); $configFile = $this->getBlankConfigFile(); $configFile->setVar('dbHost', '<'); Registry::set('oxConfigFile', $configFile); $this->setProtectedClassProperty(oxDb::getInstance(), 'db', null); $this->setExpectedException('OxidEsales\\EshopCommunity\\Core\\Exception\\DatabaseNotConfiguredException'); try { oxDb::getDb(); } catch (DatabaseNotConfiguredException $exception) { /** Restore original configFile object */ Registry::set('oxConfigFile', $configFileBackup); throw $exception; } }
if (defined('E_DEPRECATED')) { //E_DEPRECATED is disabled particularly for PHP 5.3 as some 3rd party modules still uses deprecated functionality error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED); } else { error_reporting(E_ALL ^ E_NOTICE); } if (!defined('OX_BASE_PATH')) { define('OX_BASE_PATH', __DIR__ . DIRECTORY_SEPARATOR); } // custom functions file if (file_exists(OX_BASE_PATH . 'modules/functions.php')) { include_once OX_BASE_PATH . 'modules/functions.php'; } // Generic utility method file including autoloading definition require_once OX_BASE_PATH . 'oxfunctions.php'; // Make actions if there are eShop configuration problems showErrorIfConfigIsMissing(); redirectIfShopNotConfigured(); // Composer autoloader. registerComposerAutoload(); //init config.inc.php file reader $oConfigFile = new ConfigFile(OX_BASE_PATH . "config.inc.php"); Registry::set("oxConfigFile", $oConfigFile); registerVirtualNamespaceAutoLoad(); registerShopAutoLoad(); registerModuleAutoload(); //sets default PHP ini params ini_set('session.name', 'sid'); ini_set('session.use_cookies', 0); ini_set('session.use_trans_sid', 0); ini_set('url_rewriter.tags', '');
public function testGetKeys() { Registry::set("testKey", "testVal"); $this->assertTrue(in_array(strtolower("testKey"), Registry::getKeys())); }