/**
  * Initialize the fixture.
  *
  * @return null
  */
 protected function setUp()
 {
     parent::setUp();
     oxRegistry::get("oxSeoEncoder")->setPrefix('oxid');
     oxRegistry::get("oxSeoEncoder")->setSeparator();
     oxTestModules::cleanUp();
     oxTestModules::addFunction("oxutils", "seoIsActive", "{return true;}");
 }
Ejemplo n.º 2
0
 /**
  * Tear down the fixture.
  *
  * @return null
  */
 protected function tearDown()
 {
     modOxView::reset();
     // restoring
     $this->getConfig()->getActiveShop()->oxshops__oxseoactive = new oxField($this->_iSeoMode, oxField::T_RAW);
     oxRegistry::getUtils()->seoIsActive(true);
     oxTestModules::cleanUp();
     parent::tearDown();
 }
Ejemplo n.º 3
0
 public function testIsSsl_SslMode_WithDifferentParams()
 {
     oxTestModules::addFunction("oxUtilsServer", "getServerVar", '{ if ( $aA[0] == "HTTPS" ) { return 1; } else { return array(); } }');
     $oConfig = $this->getMock('oxconfig', array('getConfigParam'));
     $oConfig->expects($this->at(0))->method('getConfigParam')->with($this->equalTo('sSSLShopURL'))->will($this->returnValue('https://eshop'));
     $this->assertTrue($oConfig->isSsl());
     oxTestModules::cleanUp();
     oxTestModules::addFunction("oxUtilsServer", "getServerVar", '{ if ( $aA[0] == "HTTPS" ) { return "on"; } else { return array(); } }');
     $this->assertTrue($oConfig->isSsl());
 }
 public function run(PHPUnit_Framework_TestResult $result = null)
 {
     if (!self::$_aInitialDbChecksum) {
         self::initializeDbChecksum();
     }
     $result = parent::run($result);
     oxTestModules::cleanUp();
     return $result;
 }
Ejemplo n.º 5
0
 public function testDecodeUrl()
 {
     oxTestModules::addFunction('oxSeoDecoder', 'parseStdUrl', create_function('$u', 'return array();'));
     $oD = oxNew('oxSeoDecoder');
     $this->assertSame(false, $oD->decodeUrl($this->getConfig()->getShopURL() . 'Uragarana/'));
     $iShopId = $this->getConfig()->getBaseShopId();
     try {
         $oDb = oxDb::getDb();
         $oDb->Execute('insert into oxseo (oxobjectid, oxident, oxshopid, oxlang, oxstdurl, oxseourl, oxtype) values ("aa", "' . md5('uragarana/') . '", "' . $iShopId . '", 1, "std", "uragarana/", "oxarticle")');
         $this->assertEquals(array('lang' => 1), $oD->decodeUrl('Uragarana/'));
     } catch (Exception $e) {
     }
     oxTestModules::cleanUp();
     $oDb->Execute("delete from oxseo where oxstdurl='std'");
     if ($e) {
         throw $e;
     }
 }
Ejemplo n.º 6
0
 /**
  * Executed after test is down
  *
  */
 protected function tearDown()
 {
     $this->cleanUpDatabase();
     modDb::getInstance()->modAttach(modDb::getInstance()->getRealInstance());
     oxTestsStaticCleaner::clean('oxUtilsObject', '_aInstanceCache');
     oxTestsStaticCleaner::clean('oxArticle', '_aLoadedParents');
     modInstances::cleanup();
     oxTestModules::cleanUp();
     modOxid::globalCleanup();
     modDB::getInstance()->cleanup();
     $this->getSession()->cleanup();
     $this->getConfig()->cleanup();
     $_SERVER = $this->_aBackup['_SERVER'];
     $_POST = $this->_aBackup['_POST'];
     $_GET = $this->_aBackup['_GET'];
     $_SESSION = $this->_aBackup['_SESSION'];
     $_COOKIE = $this->_aBackup['_COOKIE'];
     $this->_resetRegistry();
     oxUtilsObject::resetClassInstances();
     oxUtilsObject::resetModuleVars();
     parent::tearDown();
 }
Ejemplo n.º 7
0
 public function testSetCharsetSetOutputFormatSendHeaders()
 {
     $utils = $this->getMock('oxUtils', array('setHeader'));
     $utils->expects($this->once())->method('setHeader')->with($this->equalTo('Content-Type: text/html; charset=asd'));
     oxTestModules::cleanUp();
     oxTestModules::addModuleObject('oxUtils', $utils);
     $oOutput = oxNew('oxOutput');
     $oOutput->setCharset('asd');
     $oOutput->sendHeaders();
     $utils = $this->getMock('oxUtils', array('setHeader'));
     $utils->expects($this->once())->method('setHeader')->with($this->equalTo('Content-Type: application/json; charset=asdd'));
     oxTestModules::cleanUp();
     oxTestModules::addModuleObject('oxUtils', $utils);
     $oOutput = oxNew('oxOutput');
     $oOutput->setCharset('asdd');
     $oOutput->setOutputFormat(oxOutput::OUTPUT_FORMAT_JSON);
     $oOutput->sendHeaders();
     $utils = $this->getMock('oxUtils', array('setHeader'));
     $utils->expects($this->once())->method('setHeader')->with($this->equalTo('Content-Type: text/html; charset=asdd'));
     oxTestModules::cleanUp();
     oxTestModules::addModuleObject('oxUtils', $utils);
     $oOutput = oxNew('oxOutput');
     $oOutput->setCharset('asdd');
     $oOutput->setOutputFormat(oxOutput::OUTPUT_FORMAT_HTML);
     $oOutput->sendHeaders();
 }