/** * @dataProvider providerHasOutOfStockItems */ public function testHasOutOfStockArticles($sProductId, $iBasketItemAmount, $iStockAmount, $iStockEmptyLevel, $blExpectedResult) { $oBasket = $this->_createBasket($sProductId, $iBasketItemAmount, $iStockAmount); $oBasketValidator = new oePayPalOutOfStockValidator(); $oBasketValidator->setBasket($oBasket); $oBasketValidator->setEmptyStockLevel($iStockEmptyLevel); $this->assertEquals($blExpectedResult, $oBasketValidator->hasOutOfStockArticles()); }
/** * Returns transaction mode. * * @param oxBasket $oBasket * * @return string */ protected function _getTransactionMode($oBasket) { $sTransactionMode = $this->getPayPalConfig()->getTransactionMode(); if ($sTransactionMode == "Automatic") { $oOutOfStockValidator = new oePayPalOutOfStockValidator(); $oOutOfStockValidator->setBasket($oBasket); $oOutOfStockValidator->setEmptyStockLevel($this->getPayPalConfig()->getEmptyStockLevel()); $sTransactionMode = $oOutOfStockValidator->hasOutOfStockArticles() ? "Authorization" : "Sale"; return $sTransactionMode; } return $sTransactionMode; }