コード例 #1
0
 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);
 }
コード例 #2
0
 /**
  * @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));
 }
コード例 #3
0
 /**
  * @param Email $email
  * @param array $expr
  *
  * @return bool
  */
 protected function isExprApplicable(Email $email, array $expr)
 {
     return (bool) $this->configExpressions->evaluate($expr, $email);
 }