You are here

public function PaymentReferenceBaseTest::testBuildPaymentViewWithoutPaymentWithOutDefaultValue in Payment 8.2

@covers ::buildPaymentView

File

tests/src/Unit/Element/PaymentReferenceBaseTest.php, line 692

Class

PaymentReferenceBaseTest
@coversDefaultClass \Drupal\payment\Element\PaymentReferenceBase

Namespace

Drupal\Tests\payment\Unit\Element

Code

public function testBuildPaymentViewWithoutPaymentWithOutDefaultValue() {
  $element = array(
    '#default_value' => NULL,
    '#available_payment_id' => mt_rand(),
  );
  $form_state = $this
    ->createMock(FormStateInterface::class);
  $this->paymentStorage
    ->expects($this
    ->once())
    ->method('load')
    ->with($element['#available_payment_id']);
  $method = new \ReflectionMethod($this->sut, 'buildPaymentView');
  $method
    ->setAccessible(TRUE);
  $build = $method
    ->invoke($this->sut, $element, $form_state);
  $this
    ->assertSame([], $build);
}