You are here

public function StandardTest::testRenderItem in Views XML Backend 8

@covers ::query

File

tests/src/Unit/Plugin/views/sort/StandardTest.php, line 25
Contains \Drupal\Tests\views_xml_backend\Unit\Plugin\views\sort\StandardTest.

Class

StandardTest
@coversDefaultClass \Drupal\views_xml_backend\Plugin\views\sort\Standard @group views_xml_backend

Namespace

Drupal\Tests\views_xml_backend\Unit\Plugin\views\sort

Code

public function testRenderItem() {
  $plugin = new Standard([], '', []);
  $options = [
    'id' => 'sorter_id',
    'xpath_selector' => 'xpath_query',
  ];
  $plugin
    ->init($this
    ->getMockedView(), $this
    ->getMockedDisplay(), $options);
  $query = $this
    ->prophesize(Xml::class);
  $query
    ->addField('sort_string_sorter_id', 'xpath_query')
    ->shouldBeCalled();
  $query
    ->addSort(Argument::type(StringSorter::class))
    ->shouldBeCalled();
  $plugin->query = $query
    ->reveal();
  $plugin
    ->query();
}