Skip to content
Permalink
Browse files

Merge branch 'b-6.x-fixpayoneunits' into b-6.x

  • Loading branch information
Sieg committed Nov 14, 2019
2 parents b562823 + a61e594 commit 2f651908903cbab4c90fde0c1a624e57392e8e41
Showing with 28 additions and 23 deletions.
  1. +28 −23 tests/Unit/Application/Controller/ViewConfigTest.php
@@ -72,7 +72,7 @@ public function testGetHomeLinkEng()
*
* @return array
*/
public function testGetHomeLinkDataProvider()
public function getHomeLinkDataProvider()
{
$sShopUrl = $this->getConfig()->getShopUrl();
@@ -98,7 +98,7 @@ public function testGetHomeLinkDataProvider()
* @param int $iDefaultBrowserLanguage default browser language
* @param string $sExpectedUrl expected URL
*
* @dataProvider testGetHomeLinkDataProvider
* @dataProvider getHomeLinkDataProvider
*/
public function testGetHomeLink($iDefaultShopLanguage, $iDefaultBrowserLanguage, $sExpectedUrl)
{
@@ -142,14 +142,15 @@ public function testGetHomeLinkPe()
*/
public function testGetShowWishlist()
{
$oCfg = $this->getMock(\OxidEsales\Eshop\Core\Config::class, array('getConfigParam'));
$oCfg = $this->createPartialMock(\OxidEsales\Eshop\Core\Config::class, array('getConfigParam'));
$oCfg->expects($this->once())
->method('getConfigParam')
->with($this->equalTo('bl_showWishlist'))
->will($this->returnValue('lalala'));
Registry::set(Config::class, $oCfg);
$oVC = oxNew(\OxidEsales\Eshop\Core\ViewConfig::class);
Registry::set(Config::class, $oCfg);
$this->assertEquals('lalala', $oVC->getShowWishlist());
}
@@ -158,17 +159,21 @@ public function testGetShowWishlist()
*/
public function testGetShowCompareList()
{
$oView = $this->getMock(\OxidEsales\Eshop\Core\Controller\BaseController::class, array('getIsOrderStep'));
$oView->expects($this->once())->method('getIsOrderStep')->will($this->returnValue(true));
$oView = $this->createPartialMock(\OxidEsales\Eshop\Core\Controller\BaseController::class, array('getIsOrderStep'));
$oView->expects($this->any())->method('getIsOrderStep')->will($this->returnValue(true));
$oCfg = $this->getMock(\OxidEsales\Eshop\Core\Config::class, array('getConfigParam', 'getActiveView'));
$oCfg->expects($this->at(0))->method('getConfigParam')->with($this->equalTo('bl_showCompareList'))->will($this->returnValue(true));
$oCfg->expects($this->at(1))->method('getConfigParam')->with($this->equalTo('blDisableNavBars'))->will($this->returnValue(true));
$oCfg->expects($this->at(2))->method('getActiveView')->will($this->returnValue($oView));
$oCfg = $this->createPartialMock(\OxidEsales\Eshop\Core\Config::class, array('getConfigParam', 'getActiveView'));
$oCfg->expects($this->any())
->method('getConfigParam')
->will($this->returnValueMap([
['bl_showCompareList', true],
['blDisableNavBars', true]
]));
$oCfg->expects($this->any())->method('getActiveView')->will($this->returnValue($oView));
Registry::set(Config::class, $oCfg);
$oVC = $this->createPartialMock(ViewConfig::class, []);
$oVC = oxNew(\OxidEsales\Eshop\Core\ViewConfig::class);
Registry::set(\OxidEsales\Eshop\Core\Config::class, $oCfg);
$this->assertFalse($oVC->getShowCompareList());
}
@@ -177,15 +182,15 @@ public function testGetShowCompareList()
*/
public function testGetShowListmania()
{
$oCfg = $this->getMock(\OxidEsales\Eshop\Core\Config::class, array('getConfigParam'));
$oCfg = $this->createPartialMock(\OxidEsales\Eshop\Core\Config::class, array('getConfigParam'));
$oCfg->expects($this->once())
->method('getConfigParam')
->with($this->equalTo('bl_showListmania'))
->will($this->returnValue('lalala'));
Registry::set(Config::class, $oCfg);
$oVC = oxNew(\OxidEsales\Eshop\Core\ViewConfig::class);
Registry::set(Config::class, $oCfg);
$this->assertEquals('lalala', $oVC->getShowListmania());
}
@@ -194,15 +199,15 @@ public function testGetShowListmania()
*/
public function testGetShowVouchers()
{
$oCfg = $this->getMock(\OxidEsales\Eshop\Core\Config::class, array('getConfigParam'));
$oCfg = $this->createPartialMock(\OxidEsales\Eshop\Core\Config::class, array('getConfigParam'));
$oCfg->expects($this->once())
->method('getConfigParam')
->with($this->equalTo('bl_showVouchers'))
->will($this->returnValue('lalala'));
Registry::set(Config::class, $oCfg);
$oVC = oxNew(\OxidEsales\Eshop\Core\ViewConfig::class);
Registry::set(Config::class, $oCfg);
$this->assertEquals('lalala', $oVC->getShowVouchers());
}
@@ -211,15 +216,15 @@ public function testGetShowVouchers()
*/
public function testGetShowGiftWrapping()
{
$oCfg = $this->getMock(\OxidEsales\Eshop\Core\Config::class, array('getConfigParam'));
$oCfg = $this->createPartialMock(\OxidEsales\Eshop\Core\Config::class, array('getConfigParam'));
$oCfg->expects($this->once())
->method('getConfigParam')
->with($this->equalTo('bl_showGiftWrapping'))
->will($this->returnValue('lalala'));
Registry::set(Config::class, $oCfg);
$oVC = oxNew(\OxidEsales\Eshop\Core\ViewConfig::class);
Registry::set(Config::class, $oCfg);
$this->assertEquals('lalala', $oVC->getShowGiftWrapping());
}
@@ -853,12 +858,12 @@ public function testGetTopActiveClassName()
public function testIsFunctionalityEnabled()
{
$oConfig = $this->getMock(\OxidEsales\Eshop\Core\Config::class, array("getConfigParam"));
$oConfig = $this->createPartialMock(\OxidEsales\Eshop\Core\Config::class, array("getConfigParam"));
$oConfig->expects($this->once())->method("getConfigParam")->with($this->equalTo('bl_showWishlist'))->will($this->returnValue("will"));
Registry::set(Config::class, $oConfig);
$oViewConfig = oxNew(ViewConfig::class);
Registry::set(Config::class, $oConfig);
$this->assertTrue($oViewConfig->isFunctionalityEnabled('bl_showWishlist'));
}

0 comments on commit 2f65190

Please sign in to comment.
You can’t perform that action at this time.