/** * @covers ::submitConfigurationForm */ public function testSubmitConfigurationFormWithFilter() { $message_text = $this->randomMachineName(); $message_format = $this->randomMachineName(); $this->moduleHandler->expects($this->once())->method('moduleExists')->with('filter')->willReturn(TRUE); $form = array('message' => array('#parents' => array('foo', 'bar', 'message'))); $form_state = $this->getMock(FormStateInterface::class); $form_state->expects($this->atLeastOnce())->method('getValues')->willReturn(array('foo' => array('bar' => array('message' => array('value' => $message_text, 'format' => $message_format))))); $this->sut->submitConfigurationForm($form, $form_state); $this->assertSame($message_text, $this->sut->getMessageText()); $this->assertSame($message_format, $this->sut->getMessageTextFormat()); }
/** * {@inheritdoc} */ public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { parent::submitConfigurationForm($form, $form_state); $this->getExecutePaymentStatusSelector($form_state)->submitSelectorForm($form['plugin_form']['execute']['execute_status'], $form_state); $this->getCapturePaymentStatusSelector($form_state)->submitSelectorForm($form['plugin_form']['capture']['plugin_form']['capture_status'], $form_state); $this->getRefundPaymentStatusSelector($form_state)->submitSelectorForm($form['plugin_form']['refund']['plugin_form']['refund_status'], $form_state); $parents = $form['plugin_form']['brand_label']['#parents']; array_pop($parents); $values = $form_state->getValues(); $values = NestedArray::getValue($values, $parents); $this->setExecuteStatusId($this->getExecutePaymentStatusSelector($form_state)->getSelectedPlugin()->getPluginId()); $this->setCapture($values['capture']['capture']); $this->setCaptureStatusId($this->getCapturePaymentStatusSelector($form_state)->getSelectedPlugin()->getPluginId()); $this->setRefund($values['refund']['refund']); $this->setRefundStatusId($this->getRefundPaymentStatusSelector($form_state)->getSelectedPlugin()->getPluginId()); $this->setBrandLabel($values['brand_label']); }