Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function handle(array $configuration, RuleInterface $rule)
 {
     $rule->setPriority((int) $configuration['priority']);
     $rule->setCategory($configuration['category']);
     $rule->setCapabilities($configuration['capabilities']);
     $this->handleConditions($configuration, $rule);
 }
 function it_handle_configuration(RuleInterface $rule)
 {
     $configuration = array('priority' => 1, 'category' => 'browser', 'capabilities' => array('is_bot' => true), 'conditions' => array(array('type' => 'text', 'value' => 'chrome', 'strategy' => 'sequence', 'capabilities' => array('is_modile' => true))));
     $rule->setPriority(Argument::exact($configuration['priority']))->shouldBeCalled();
     $rule->setCategory(Argument::exact($configuration['category']))->shouldBeCalled();
     $rule->setCapabilities(Argument::exact($configuration['capabilities']))->shouldBeCalled();
     $rule->addCondition(Argument::type('DeviceDetectorIO\\DeviceDetector\\Rule\\Condition\\ConditionInterface'))->shouldBeCalled();
     $this->handle($configuration, $rule);
 }