You are here

public function NumericTest::testRenderItem in Views XML Backend 8

Same name in this branch
  1. 8 tests/src/Unit/Plugin/views/filter/NumericTest.php \Drupal\Tests\views_xml_backend\Unit\Plugin\views\filter\NumericTest::testRenderItem()
  2. 8 tests/src/Unit/Plugin/views/sort/NumericTest.php \Drupal\Tests\views_xml_backend\Unit\Plugin\views\sort\NumericTest::testRenderItem()

@covers ::query

File

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

Class

NumericTest
@coversDefaultClass \Drupal\views_xml_backend\Plugin\views\sort\Numeric @group views_xml_backend

Namespace

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

Code

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