/** * Check the Rules serialization module */ public function testBuildFail() { $stubTranslator = $this->getMockBuilder('\\Thelia\\Core\\Translation\\Translator')->disableOriginalConstructor()->getMock(); /** @var FacadeInterface $stubFacade */ $stubFacade = $this->getMockBuilder('\\Thelia\\Coupon\\BaseFacade')->disableOriginalConstructor()->getMock(); $stubFacade->expects($this->any())->method('getTranslator')->will($this->returnValue($stubTranslator)); $stubFacade->expects($this->any())->method('getConditionEvaluator')->will($this->returnValue(new ConditionEvaluator())); $currencies = CurrencyQuery::create(); $currencies = $currencies->find(); $stubFacade->expects($this->any())->method('getAvailableCurrencies')->will($this->returnValue($currencies)); $stubContainer = $this->getMockBuilder('\\Symfony\\Component\\DependencyInjection\\Container')->disableOriginalConstructor()->getMock(); $stubContainer->expects($this->any())->method('get')->will($this->returnValue(new MatchForTotalAmount($stubFacade))); $stubContainer->expects($this->any())->method('has')->will($this->returnValueMap(array('unset.service', false))); $stubFacade->expects($this->any())->method('getContainer')->will($this->returnValue($stubContainer)); $condition1 = new MatchForTotalAmount($stubFacade); $operators = array(MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR, MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL); $values = array(MatchForTotalAmount::CART_TOTAL => 40.0, MatchForTotalAmount::CART_CURRENCY => 'EUR'); $condition1->setValidatorsFromForm($operators, $values); $conditionFactory = new ConditionFactory($stubContainer); $conditionManager1 = $conditionFactory->build('unset.service', $operators, $values); $expected = false; $actual = $conditionManager1; $this->assertEquals($expected, $actual); }