Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $this->trueConditionExpression = $this->prophesize(ConditionExpressionInterface::class);
     $this->trueConditionExpression->execute()->willReturn(TRUE);
     $this->trueConditionExpression->executeWithState(Argument::type(RulesStateInterface::class))->willReturn(TRUE);
     $this->falseConditionExpression = $this->prophesize(ConditionExpressionInterface::class);
     $this->falseConditionExpression->execute()->willReturn(FALSE);
     $this->falseConditionExpression->executeWithState(Argument::type(RulesStateInterface::class))->willReturn(FALSE);
     $this->testActionExpression = $this->prophesize(ActionExpressionInterface::class);
     $this->expressionManager = $this->prophesize(ExpressionManagerInterface::class);
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $context_config = ContextConfig::create();
     foreach ($form_state->getValue('context') as $context_name => $value) {
         if ($form_state->get("context_{$context_name}") == 'selector') {
             $context_config->map($context_name, $value['setting']);
         } else {
             $context_config->setValue($context_name, $value['setting']);
         }
     }
     $configuration = $context_config->toArray();
     $configuration['condition_id'] = $form_state->getValue('condition');
     $this->conditionExpression->setConfiguration($configuration);
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     // Nothing todo as long as the first step is not completed.
     if (!$form_state->get('condition_id')) {
         return;
     }
     $context_config = ContextConfig::create();
     foreach ($form_state->getValue('context') as $context_name => $value) {
         if ($form_state->get("context_{$context_name}") == 'selector') {
             $context_config->map($context_name, $value['setting']);
         } else {
             $context_config->setValue($context_name, $value['setting']);
         }
     }
     $configuration = $context_config->toArray();
     $configuration['condition_id'] = $form_state->get('condition_id');
     $this->conditionExpression->setConfiguration($configuration);
 }