You are here

public function PaymentMethodLabelTest::testRender in Payment 8.2

@covers ::render

File

tests/src/Unit/Plugin/views/field/PaymentMethodLabelTest.php, line 79

Class

PaymentMethodLabelTest
@coversDefaultClass \Drupal\payment\Plugin\views\field\PaymentMethodLabel

Namespace

Drupal\Tests\payment\Unit\Plugin\views\field

Code

public function testRender() {
  $plugin_id = $this
    ->randomMachineName();
  $plugin_label = $this
    ->randomMachineName();
  $plugin_definition = [
    'label' => $plugin_label,
  ];
  $this->paymentMethodManager
    ->expects($this
    ->atLeastOnce())
    ->method('getDefinition')
    ->with($plugin_id)
    ->willReturn($plugin_definition);
  $result_row = new ResultRow();
  $result_row->{$this->sut->field_alias} = $plugin_id;
  $this
    ->assertSame($plugin_label, $this->sut
    ->render($result_row));
}