You are here

public function MarkupTest::testRenderItem in Views XML Backend 8

@covers ::render_item

File

tests/src/Unit/Plugin/views/field/MarkupTest.php, line 27
Contains \Drupal\Tests\views_xml_backend\Unit\Plugin\views\field\MarkupTest.

Class

MarkupTest
@coversDefaultClass \Drupal\views_xml_backend\Plugin\views\field\Markup @group views_xml_backend

Namespace

Drupal\Tests\views_xml_backend\Unit\Plugin\views\field

Code

public function testRenderItem() {
  $account = $this
    ->prophesize(AccountProxyInterface::class);
  $renderer = $this
    ->prophesize(RendererInterface::class);
  $renderer
    ->renderPlain(Argument::type('array'))
    ->will(function (array $args) {
    return $args[0]['#text'];
  });
  $plugin = new Markup([], '', [], $account
    ->reveal(), $renderer
    ->reveal());
  $options = [
    'format' => 'my_format',
  ];
  $plugin
    ->init($this
    ->getMockedView(), $this
    ->getMockedDisplay(), $options);
  $this
    ->assertSame('foo', $plugin
    ->render_item(0, [
    'value' => 'foo',
  ]));
}