public function testAddExtension() { $factory = $this->getMockBuilder('Oro\\Component\\ConfigExpression\\ExpressionFactory')->disableOriginalConstructor()->getMock(); $this->language->setFactory($factory); $extension = $this->getMock('Oro\\Component\\ConfigExpression\\Extension\\ExtensionInterface'); $factory->expects($this->once())->method('addExtension')->with($this->identicalTo($extension)); $this->language->addExtension($extension); }
/** * @dataProvider configurationForEvaluateDataProvider */ public function testAssembleWithEvaluateResult($yaml, $context, $expected) { $language = new ConfigExpressions(); $configuration = Yaml::parse($yaml); $this->assertEquals($expected, $language->evaluate($configuration, $context)); $expr = $language->getExpression($configuration); $normalizedConfiguration = $expr->toArray(); $this->assertEquals($expected, $language->evaluate($normalizedConfiguration, $context)); }
/** * @param Email $email * @param array $expr * * @return bool */ protected function isExprApplicable(Email $email, array $expr) { return (bool) $this->configExpressions->evaluate($expr, $email); }