/** * Generate adapter stub * * @param int $cartTotalPrice Cart total price * @param string $checkoutCurrency Checkout currency * @param string $i18nOutput Output from each translation * * @return \PHPUnit_Framework_MockObject_MockObject */ public function generateFacadeStub($cartTotalPrice = 400, $checkoutCurrency = 'EUR', $i18nOutput = '') { $stubFacade = $this->getMockBuilder('\\Thelia\\Coupon\\BaseFacade')->disableOriginalConstructor()->getMock(); $address = new Address(); $address->setCountryId(10); $stubFacade->expects($this->any())->method('getDeliveryAddress')->will($this->returnValue($address)); $stubFacade->expects($this->any())->method('getConditionEvaluator')->will($this->returnValue(new ConditionEvaluator())); $stubTranslator = $this->getMockBuilder('\\Thelia\\Core\\Translation\\Translator')->disableOriginalConstructor()->getMock(); $stubTranslator->expects($this->any())->method('trans')->will($this->returnValue($i18nOutput)); $stubFacade->expects($this->any())->method('getTranslator')->will($this->returnValue($stubTranslator)); $lang = new Lang(); $lang->setDateFormat("d/m/Y"); $stubSession = $this->getMockBuilder('\\Thelia\\Core\\HttpFoundation\\Session\\Session')->disableOriginalConstructor()->getMock(); $stubSession->expects($this->any())->method('getLang')->will($this->returnValue($lang)); $stubRequest = $this->getMockBuilder('\\Thelia\\Core\\HttpFoundation\\Request')->disableOriginalConstructor()->getMock(); $stubRequest->expects($this->any())->method('getSession')->will($this->returnValue($stubSession)); $stubFacade->expects($this->any())->method('getRequest')->will($this->returnValue($stubRequest)); return $stubFacade; }