You are here

public function PaymentStatusFormTest::testSave in Payment 8.2

@covers ::save

File

tests/src/Unit/Entity/PaymentStatus/PaymentStatusFormTest.php, line 292

Class

PaymentStatusFormTest
@coversDefaultClass \Drupal\payment\Entity\PaymentStatus\PaymentStatusForm

Namespace

Drupal\Tests\payment\Unit\Entity\PaymentStatus

Code

public function testSave() {
  $form_state = $this
    ->createMock(FormStateInterface::class);
  $form_state
    ->expects($this
    ->once())
    ->method('setRedirect')
    ->with('entity.payment_status.collection');

  /** @var \Drupal\payment\Entity\PaymentStatus\PaymentStatusForm|\PHPUnit\Framework\MockObject\MockObject $form */
  $form = $this
    ->getMockBuilder(PaymentStatusForm::class)
    ->setConstructorArgs(array(
    $this->stringTranslation,
    $this->paymentStatusStorage,
    $this->pluginSelectorManager,
    $this->paymentStatusPluginType
      ->reveal(),
  ))
    ->setMethods(array(
    'copyFormValuesToEntity',
  ))
    ->getMock();
  $form
    ->setEntity($this->paymentStatus);
  $form
    ->setMessenger($this->messenger);
  $this->paymentStatus
    ->expects($this
    ->once())
    ->method('save');
  $form
    ->save([], $form_state);
}