From ed529b039f3acfb8f03e8d7910c5d05485ee04c7 Mon Sep 17 00:00:00 2001 From: robertblank Date: Tue, 26 Jun 2018 14:58:59 +0200 Subject: [PATCH 1/2] OXDEV-1051 Fix expected Payolution agreement link in test --- .../application/controllers/fcPayonePaymentViewTest.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/unit/fcPayOne/extend/application/controllers/fcPayonePaymentViewTest.php b/tests/unit/fcPayOne/extend/application/controllers/fcPayonePaymentViewTest.php index 448c6c15..e9544de7 100644 --- a/tests/unit/fcPayOne/extend/application/controllers/fcPayonePaymentViewTest.php +++ b/tests/unit/fcPayOne/extend/application/controllers/fcPayonePaymentViewTest.php @@ -3547,6 +3547,8 @@ public function test_fcpoGetUserValue_Coverage() */ public function test_fcpoGetPayolutionAgreementLink_Coverage() { + $sCompanyName = 'someCompany'; + $oMockLang = $this->getMock('oxLang', array( 'getLanguageAbbr' )); @@ -3561,9 +3563,9 @@ public function test_fcpoGetPayolutionAgreementLink_Coverage() $oMockConfig ->expects($this->any()) ->method('getConfigParam') - ->will($this->returnValue('someCompany')); + ->will($this->returnValue($sCompanyName)); - $sExpect = 'https://payment.payolution.com/payolution-payment/infoport/dataprivacydeclaration?mId=&lang=someAbbr&territory=DE'; + $sExpect = 'https://payment.payolution.com/payolution-payment/infoport/dataprivacydeclaration?mId=' . base64_encode($sCompanyName) . '&lang=someAbbr&territory=DE'; $oTestObject = $this->getMock('fcPayOnePaymentView', array( 'fcpoGetTargetCountry', From 6c725a2ac4d85e29b3627d99d5ce3619c51fbe7f Mon Sep 17 00:00:00 2001 From: robertblank Date: Tue, 26 Jun 2018 15:00:53 +0200 Subject: [PATCH 2/2] OXDEV-1051 Fix stack of returned objects for getFactoryObject in test --- .../controllers/fcPayOneOrderViewTest.php | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/tests/unit/fcPayOne/extend/application/controllers/fcPayOneOrderViewTest.php b/tests/unit/fcPayOne/extend/application/controllers/fcPayOneOrderViewTest.php index 637453b0..ee57d1d4 100644 --- a/tests/unit/fcPayOne/extend/application/controllers/fcPayOneOrderViewTest.php +++ b/tests/unit/fcPayOne/extend/application/controllers/fcPayOneOrderViewTest.php @@ -630,14 +630,28 @@ public function test__handlePayPalExpressCall_Coverage() $oMockRequest = $this->getMock('fcporequest', array('sendRequestGenericPayment')); $oMockRequest->expects($this->any())->method('sendRequestGenericPayment')->will($this->returnValue($aMockOutput)); - - $oHelper = $this->getMock('fcpohelper', array('fcpoGetSessionVariable', 'fcpoDeleteSessionVariable', 'getFactoryObject', 'fcpoGetSession')); + + $oMockOrder = $this->getMock('oxOrder', array('load', 'fcpoGetIdByUserName')); + $oMockOrder->expects($this->any())->method('fcpoGetIdByUserName')->will($this->returnValue('someUserId')); + $oMockOrder->expects($this->any())->method('load')->will($this->returnValue(true)); + + $oHelper = $this->getMock('fcpohelper', array('fcpoGetSessionVariable', 'fcpoDeleteSessionVariable', 'fcpoGetSession')); $oHelper->expects($this->any())->method('fcpoGetSessionVariable')->will($this->returnValue('someValue')); $oHelper->expects($this->any())->method('fcpoDeleteSessionVariable')->will($this->returnValue(true)); - $oHelper->expects($this->any())->method('getFactoryObject')->will($this->onConsecutiveCalls($oMockRequest, $oMockOxDeliverySet)); + $oHelper->expects($this->any())->method('getFactoryObject')->will( + $this->onConsecutiveCalls( + $oMockRequest, + oxNew(oxubase::class), + $oMockOrder, + $oMockUserObject, + $oMockOrder, + $oMockOrder, + $oMockOrder, + $oMockOxDeliverySet + ) + ); $oHelper->expects($this->any())->method('fcpoGetSession')->will($this->returnValue($oMockSession)); - - + $this->invokeSetAttribute($oTestObject, '_oFcpoHelper', $oHelper); $mResponse = $mExpect = $this->invokeMethod($oTestObject, '_handlePayPalExpressCall');