Ejemplo n.º 1
0
 /**
  * @covers Helper_Modules::_getModulesAnalize
  */
 public function testGetModulesAnalizeTwo()
 {
     modConfig::setParameter("start", true);
     oxTestModules::addFunction('moduleManager', 'getModuleContentClass', '{ return true; }');
     oxTestModules::addFunction('moduleManagerAnalize', 'setAnalize', '{ return true; }');
     $oTestObj = $this->getProxyClass('Helper_Modules');
     $this->assertNull($oTestObj->UNITgetModulesAnalize());
 }
Ejemplo n.º 2
0
 /**
  * sysreq::Render() test case
  *
  * @return null
  */
 public function testRender()
 {
     oxTestModules::addFunction('oxUtils', 'showMessageAndExit', '{ return "Access denied !"; }');
     oxTestModules::addFunction('oxuser', 'loadAdminUser', '{ $this->oxuser__oxrights = new oxField( "justadmin" ); }');
     // testing..
     $oView = oxNew('systeminfo');
     $this->assertEquals("Access denied !", $oView->render());
 }
Ejemplo n.º 3
0
 /**
  * Initialize the fixture.
  *
  * @return null
  */
 protected function setUp()
 {
     parent::setUp();
     $this->getConfig();
     $this->getSession();
     oxTestModules::addFunction('oxutils', 'setseoact', '{oxRegistry::getUtils()->_blSeoIsActive = $aA[0];}');
     oxNew('oxutils')->setseoact(false);
 }
Ejemplo n.º 4
0
 /**
  * Article_Userdef::Render() test case
  *
  * @return null
  */
 public function testRender()
 {
     $this->setRequestParameter("oxid", "testId");
     oxTestModules::addFunction('oxarticle', 'isDerived', '{ return true; }');
     // testing..
     $oView = oxNew('Article_Userdef');
     $this->assertEquals('article_userdef.tpl', $oView->render());
     $this->assertTrue($oView->getViewDataElement('readonly'));
 }
Ejemplo n.º 5
0
 /**
  * Testing Wrapping::getCardList()
  *
  * @return null
  */
 public function testGetCardList()
 {
     oxTestModules::addFunction('oxwrapping', 'getWrappingList', '{ return "getCardList"; }');
     $oViewConfig = $this->getMock("oxViewConfig", array("getShowGiftWrapping"));
     $oViewConfig->expects($this->once())->method('getShowGiftWrapping')->will($this->returnValue(true));
     $oView = $this->getMock("Wrapping", array("getViewConfig"), array(), '', false);
     $oView->expects($this->once())->method('getViewConfig')->will($this->returnValue($oViewConfig));
     $this->assertEquals("getCardList", $oView->getCardList());
 }
Ejemplo n.º 6
0
 /**
  * oxScLoginRegister::confirmRegistration() test case
  *
  * @return null
  */
 public function testConfirmRegistration()
 {
     oxTestModules::addFunction("oxuser", "loadUserByUpdateId", "{return true;}");
     oxTestModules::addFunction("oxuser", "setUpdateKey", "{return true;}");
     oxTestModules::addFunction("oxuser", "save", "{return true;}");
     $oView = $this->getMock("register", array("getUpdateId"));
     $oView->expects($this->once())->method('getUpdateId')->will($this->returnValue("testUpdateId"));
     $this->assertEquals('register?confirmstate=1', $oView->confirmRegistration());
 }
Ejemplo n.º 7
0
 public function testGetChannel()
 {
     oxTestModules::addFunction('oxrssfeed', 'setChannel', '{$this->_aChannel = $aA[0];}');
     $o = $this->getProxyClass("rss");
     $oRss = oxNew("oxRssFeed");
     $oRss->setChannel('asd');
     $o->setNonPublicVar("_oRss", $oRss);
     $this->assertEquals('asd', $o->getChannel());
 }
Ejemplo n.º 8
0
 /**
  * DeliverySet_Users::Render() test case
  *
  * @return null
  */
 public function testRender()
 {
     oxTestModules::addFunction("oxdeliveryset", "isDerived", "{return true;}");
     $this->setRequestParameter("oxid", "testId");
     // testing..
     $oView = oxNew('DeliverySet_Users');
     $this->assertEquals('deliveryset_users.tpl', $oView->render());
     $aViewData = $oView->getViewData();
     $this->assertTrue(isset($aViewData['readonly']));
 }
Ejemplo n.º 9
0
 /**
  * Manufacturer_Seo::Save() test case
  *
  * @return null
  */
 public function testSave()
 {
     oxTestModules::addFunction('oxbase', 'load', '{ return true; }');
     oxTestModules::addFunction('oxbase', 'save', '{ return true; }');
     $this->setRequestParameter("oxid", "testId");
     // testing..
     $oView = $this->getMock("Manufacturer_Seo", array("getEditObjectId"));
     $oView->expects($this->atLeastOnce())->method('getEditObjectId')->will($this->returnValue(123));
     $this->assertNull($oView->save());
 }
 /**
  * Lets run the render method.
  */
 public function testRender()
 {
     oxTestModules::addFunction('oxUtils', 'redirect', '{throw new Exception("REDIRECT");}');
     $oView = new bz_barzahlen_thankyou();
     try {
         $oView->render();
     } catch (Exception $e) {
         $this->assertEquals("REDIRECT", $e->getMessage());
     }
 }
Ejemplo n.º 11
0
 /**
  * User_Address::DelAddress() test case
  *
  * @return null
  */
 public function testDelAddress()
 {
     oxTestModules::addFunction('oxaddress', 'delete', '{ return true; }');
     $this->setRequestParameter("oxid", "testId");
     $this->setRequestParameter("editval", array("oxaddress__oxid" => "testOxId"));
     // testing..
     $oView = $this->getMock("User_Address", array("_allowAdminEdit"));
     $oView->expects($this->at(0))->method('_allowAdminEdit')->with($this->equalTo("testId"))->will($this->returnValue(true));
     $oView->delAddress();
 }
 public function testGetContentLoadByIdentLangChange()
 {
     $sShopId = $this->getTestConfig()->getShopEdition() == 'EE' ? '1' : 'oxbaseshop';
     $aParams['ident'] = 'oxsecurityinfo';
     $oSmarty = $this->getMock("smarty", array("fetch"));
     $oSmarty->expects($this->once())->method('fetch')->with($this->equalTo('ox:oxsecurityinfooxcontent1' . $sShopId))->will($this->returnValue('testvalue'));
     $message = "Content not found! check ident(" . $aParams['ident'] . ") !";
     oxTestModules::addFunction('oxLang', 'getBaseLanguage', '{return 1;}');
     $this->assertEquals('testvalue', smarty_function_oxcontent($aParams, $oSmarty), $message);
 }
Ejemplo n.º 13
0
 /**
  * Tools::Render() test case
  *
  * @return null
  */
 public function testRenderDemoshop()
 {
     oxTestModules::addFunction('oxUtils', 'showMessageAndExit', '{ return "Access denied !"; }');
     $oConfig = $this->getMock("oxConfig", array("isDemoShop"));
     $oConfig->expects($this->once())->method('isDemoShop')->will($this->returnValue(true));
     // testing..
     $oView = $this->getMock("Tools", array("getConfig"), array(), '', false);
     $oView->expects($this->once())->method('getConfig')->will($this->returnValue($oConfig));
     $this->assertEquals("Access denied !", $oView->render());
 }
Ejemplo n.º 14
0
 public function testToBasketReturnsNull()
 {
     /** @var oxcmp_basket|PHPUnit_Framework_MockObject_MockObject $o */
     $o = $this->getMock('oxcmp_basket', array('_getItems'));
     $o->expects($this->once())->method('_getItems')->will($this->returnValue(false));
     oxTestModules::addFunction('oxUtils', 'isSearchEngine', '{return true;}');
     $this->assertSame(null, $o->tobasket());
     oxTestModules::addFunction('oxUtils', 'isSearchEngine', '{return false;}');
     $this->assertSame(null, $o->tobasket());
 }
Ejemplo n.º 15
0
 /**
  * Category_List::Init() test case
  *
  * @return null
  */
 public function testInit()
 {
     oxTestModules::addFunction("oxUtilsServer", "getOxCookie", "{return array(1);}");
     oxTestModules::addFunction("oxUtils", "checkAccessRights", "{return true;}");
     $oSess = $this->getMock('oxsession', array('checkSessionChallenge'));
     $oSess->expects($this->any())->method('checkSessionChallenge')->will($this->returnValue(true));
     $oView = $this->getMock($this->getProxyClassName('Category_List'), array('getSession'));
     $oView->expects($this->any())->method('getSession')->will($this->returnValue($oSess));
     $oView->init();
     $this->assertEquals(array("oxcategories" => array("oxrootid" => "desc", "oxleft" => "asc")), $oView->getListSorting());
 }
Ejemplo n.º 16
0
 /**
  * News_Main::Render() test case
  *
  * @return null
  */
 public function testRender()
 {
     oxTestModules::addFunction('oxnewsletter', 'prepare', '{}');
     $this->setRequestParameter("oxid", "testId");
     // testing..
     $oView = oxNew('Newsletter_Preview');
     $this->assertEquals('newsletter_preview.tpl', $oView->render());
     $aViewData = $oView->getViewData();
     $this->assertTrue(isset($aViewData['edit']));
     $this->assertTrue($aViewData['edit'] instanceof oxnewsletter);
 }
Ejemplo n.º 17
0
 public function testGetTagPageUrl()
 {
     oxTestModules::addFunction("oxutilsserver", "getServerVar", "{ \$aArgs = func_get_args(); if ( \$aArgs[0] === 'HTTP_HOST' ) { return '" . $this->getConfig()->getShopUrl() . "'; } elseif ( \$aArgs[0] === 'SCRIPT_NAME' ) { return ''; } else { return \$_SERVER[\$aArgs[0]]; } }");
     $sUrl = $this->getConfig()->getShopUrl(oxRegistry::getLang()->getBaseLanguage());
     $sTag = $this->getTestConfig()->getShopEdition() == 'EE' ? 'hingucker' : 'erste';
     $sAltTag = $this->getTestConfig()->getShopEdition() == 'EE' ? 'grilltonne' : 'authentisches';
     $oSeoEncoderTag = oxNew('oxSeoEncoderTag');
     $this->assertEquals($sUrl . "tag/{$sTag}/16/", $oSeoEncoderTag->getTagPageUrl($sTag, 15));
     $this->assertEquals($sUrl . "tag/{$sTag}/16/", $oSeoEncoderTag->getTagPageUrl($sTag, 15));
     $this->assertEquals($sUrl . "tag/{$sAltTag}/14/", $oSeoEncoderTag->getTagPageUrl($sAltTag, 13));
 }
Ejemplo n.º 18
0
 /**
  * Attribute_List::Init() test case
  *
  * @return null
  */
 public function testInit()
 {
     oxTestModules::addFunction("oxUtilsServer", "getOxCookie", "{return array(1);}");
     oxTestModules::addFunction("oxUtils", "checkAccessRights", "{return true;}");
     $oSess = $this->getMock('oxsession', array('checkSessionChallenge'));
     $oSess->expects($this->any())->method('checkSessionChallenge')->will($this->returnValue(true));
     $oView = $this->getMock($this->getProxyClassName('Attribute_List'), array('getSession'));
     $oView->expects($this->any())->method('getSession')->will($this->returnValue($oSess));
     $oView->init();
     $this->assertEquals("oxattribute", $oView->getNonPublicVar("_sListClass"));
 }
 /**
  * VoucherSerie_Groups::Render() test case
  *
  * @return null
  */
 public function testRender()
 {
     $this->setRequestParameter("oxid", "testId");
     oxTestModules::addFunction('oxvoucherserie', 'isDerived', '{ return true; }');
     // testing..
     $oView = oxNew('VoucherSerie_Groups');
     $this->assertEquals('voucherserie_groups.tpl', $oView->render());
     $aViewData = $oView->getViewData();
     $this->assertTrue(isset($aViewData['edit']));
     $this->assertTrue($aViewData['edit'] instanceof oxvoucherserie);
 }
Ejemplo n.º 20
0
 /**
  * Discount_Articles::Render() test case
  *
  * @return null
  */
 public function testRender()
 {
     oxTestModules::addFunction("oxdiscount", "isDerived", "{return true;}");
     $this->setRequestParameter("oxid", "testId");
     // testing..
     $oView = oxNew('Discount_Articles');
     $this->assertEquals('discount_articles.tpl', $oView->render());
     $aViewData = $oView->getViewData();
     $this->assertTrue(isset($aViewData['edit']));
     $this->assertTrue(isset($aViewData['readonly']));
     $this->assertTrue($aViewData['edit'] instanceof oxdiscount);
 }
Ejemplo n.º 21
0
 public function testGetBasket()
 {
     oxTestModules::addFunction('oxUtilsServer', 'getServerVar', '{ if ( $aA[0] == "HTTP_HOST") { return "shop.com/"; } else { return "test.php";} }');
     /** @var oxSession $mySession */
     $mySession = oxRegistry::getSession();
     $oBasket = oxNew('oxBasket');
     //$this->getSession()->setVariable( 'basket', $oBasket );
     $mySession->setBasket($oBasket);
     $oThankyou = $this->getProxyClass('thankyou');
     $oThankyou->init();
     $this->assertEquals($oBasket, $oThankyou->getBasket());
 }
Ejemplo n.º 22
0
 /**
  * VoucherSerie_List::DeleteEntry() test case
  *
  * @return null
  */
 public function testDeleteEntry()
 {
     oxTestModules::addFunction("oxUtilsServer", "getOxCookie", "{return array(1);}");
     oxTestModules::addFunction("oxUtils", "checkAccessRights", "{return true;}");
     oxTestModules::addFunction('oxvoucherserie', 'load', '{ return true; }');
     oxTestModules::addFunction('oxvoucherserie', 'deleteVoucherList', '{ return true; }');
     $oSess = $this->getMock('oxsession', array('checkSessionChallenge'));
     $oSess->expects($this->any())->method('checkSessionChallenge')->will($this->returnValue(true));
     $oView = $this->getMock($this->getProxyClassName('VoucherSerie_List'), array('getSession'));
     $oView->expects($this->any())->method('getSession')->will($this->returnValue($oSess));
     $oView->deleteEntry();
 }
Ejemplo n.º 23
0
 /**
  * Test send mail
  *
  * @return null
  */
 public function testSave()
 {
     oxTestModules::addFunction('oxemail', 'sendContactMail', '{return true;}');
     $aParams['oxuser__oxusername'] = '******';
     $aParams['oxuser__oxfname'] = 'first name';
     $aParams['oxuser__oxlname'] = 'last name';
     $this->setRequestParameter('editval', $aParams);
     $this->setRequestParameter('c_subject', "testSubject");
     $oObj = $this->getProxyClass("Contact");
     $oObj->send();
     $this->assertEquals(1, $oObj->getNonPublicVar('_blContactSendStatus'));
 }
Ejemplo n.º 24
0
 /**
  * user_remark::testDelete() test case
  *
  * @return null
  */
 public function testDelete()
 {
     oxTestModules::addFunction('oxremark', 'delete', '{ throw new Exception( "delete" ); }');
     try {
         $oView = oxNew('user_remark');
         $oView->delete();
     } catch (Exception $oExcp) {
         $this->assertEquals("delete", $oExcp->getMessage(), "Error in user_remark::delete()");
         return;
     }
     $this->fail("Error in user_remark::delete()");
 }
Ejemplo n.º 25
0
 /**
  * Category_Order::Render() test case
  *
  * @return null
  */
 public function testRender()
 {
     oxTestModules::addFunction("oxcategory", "isDerived", "{return true;}");
     $this->setRequestParameter("oxid", "testId");
     // testing..
     $oView = oxNew('Category_Order');
     $sTplName = $oView->render();
     // testing view data
     $aViewData = $oView->getViewData();
     $this->assertTrue($aViewData["edit"] instanceof oxCategory);
     $this->assertEquals('category_order.tpl', $sTplName);
 }
Ejemplo n.º 26
0
 /**
  * Content_Main::Saveinnlang() test case
  *
  * @return null
  */
 public function testSaveinnlang()
 {
     oxTestModules::addFunction('oxcontent', 'save', '{ throw new Exception( "save" );}');
     // testing..
     try {
         $oView = oxNew('Content_Main');
         $oView->saveinnlang();
     } catch (Exception $oExcp) {
         $this->assertEquals("save", $oExcp->getMessage(), "Error in Content_Main::Save()");
         return;
     }
     $this->fail("Error in Content_Main::Save()");
 }
Ejemplo n.º 27
0
 /**
  * Article_Review::render() test case
  *
  * @return null
  */
 public function testRender()
 {
     $this->setRequestParameter("oxid", $this->getTestArticleId());
     $this->setRequestParameter("rev_oxid", "_test_i1");
     oxTestModules::addFunction('oxarticle', 'isDerived', '{ return true; }');
     // testing..
     $oView = oxNew('Article_Review');
     $sTplName = $oView->render();
     // testing view data
     $aViewData = $oView->getViewData();
     $this->assertTrue($aViewData["edit"] instanceof oxArticle);
     $this->assertEquals('article_review.tpl', $sTplName);
 }
Ejemplo n.º 28
0
 /**
  * Article_Attribute::Render() test case
  *
  * @return null
  */
 public function testRender()
 {
     oxTestModules::addFunction('oxarticle', 'isDerived', '{ return true; }');
     $this->setRequestParameter("oxid", oxDb::getDb()->getOne("select oxid from oxattribute"));
     // testing..
     $oView = oxNew('Article_Attribute');
     $sTplName = $oView->render();
     // testing view data
     $aViewData = $oView->getViewData();
     $this->assertTrue($aViewData["edit"] instanceof oxArticle);
     $this->assertTrue($aViewData["readonly"]);
     $this->assertEquals('article_attribute.tpl', $sTplName);
 }
 /**
  * Article_Crossselling::Render() test case
  *
  * @return null
  */
 public function testRender()
 {
     oxTestModules::addFunction('oxarticle', 'isDerived', '{ return true; }');
     $this->setRequestParameter("oxid", "1126");
     // testing..
     $oView = oxNew('Article_Crossselling');
     $sTplName = $oView->render();
     // testing view data
     $aViewData = $oView->getViewData();
     $this->assertTrue($aViewData["edit"] instanceof oxArticle);
     $this->assertTrue($aViewData["readonly"]);
     $this->assertEquals('article_crossselling.tpl', $sTplName);
 }
Ejemplo n.º 30
0
 /**
  * VoucherSerie_Main::Save() test case
  *
  * @return null
  */
 public function testSave()
 {
     oxTestModules::addFunction('oxvoucherserie', 'save', '{ throw new Exception( "save" ); }');
     // testing..
     try {
         $oView = oxNew('VoucherSerie_Main');
         $oView->save();
     } catch (Exception $oExcp) {
         $this->assertEquals("save", $oExcp->getMessage(), "error in Wrapping_Main::save()");
         return;
     }
     $this->fail("error in VoucherSerie_Main::save()");
 }