/**
  * 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();
     $stubFacade->expects($this->any())->method('getCartTotalPrice')->will($this->returnValue($cartTotalPrice));
     $stubFacade->expects($this->any())->method('getCheckoutCurrency')->will($this->returnValue($checkoutCurrency));
     $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));
     $category1 = new Category();
     $category1->setId(10);
     $category2 = new Category();
     $category2->setId(20);
     $category3 = new Category();
     $category3->setId(30);
     $product1 = new Product();
     $product1->setId(10)->addCategory($category1)->addCategory($category2);
     $product2 = new Product();
     $product2->setId(20)->addCategory($category3);
     $cartItem1Stub = $this->getMockBuilder('\\Thelia\\Model\\CartItem')->disableOriginalConstructor()->getMock();
     $cartItem1Stub->expects($this->any())->method('getProduct')->will($this->returnValue($product1));
     $cartItem1Stub->expects($this->any())->method('getQuantity')->will($this->returnValue(1));
     $cartItem2Stub = $this->getMockBuilder('\\Thelia\\Model\\CartItem')->disableOriginalConstructor()->getMock();
     $cartItem2Stub->expects($this->any())->method('getProduct')->will($this->returnValue($product2));
     $cartItem2Stub->expects($this->any())->method('getQuantity')->will($this->returnValue(2));
     $cartStub = $this->getMockBuilder('\\Thelia\\Model\\Cart')->disableOriginalConstructor()->getMock();
     $cartStub->expects($this->any())->method('getCartItems')->will($this->returnValue([$cartItem1Stub, $cartItem2Stub]));
     $stubFacade->expects($this->any())->method('getCart')->will($this->returnValue($cartStub));
     return $stubFacade;
 }
 public function generateNoMatchingCart(\PHPUnit_Framework_MockObject_MockObject $stubFacade)
 {
     $product2 = new Product();
     $product2->setId(30);
     $cartItem2Stub = $this->getMockBuilder('\\Thelia\\Model\\CartItem')->disableOriginalConstructor()->getMock();
     $cartItem2Stub->expects($this->any())->method('getProduct')->will($this->returnValue($product2));
     $cartItem2Stub->expects($this->any())->method('getQuantity')->will($this->returnValue(2));
     $cartStub = $this->getMockBuilder('\\Thelia\\Model\\Cart')->disableOriginalConstructor()->getMock();
     $cartStub->expects($this->any())->method('getCartItems')->will($this->returnValue([$cartItem2Stub]));
     $stubFacade->expects($this->any())->method('getCart')->will($this->returnValue($cartStub));
 }