You are here

public function RawValueWidgetOrderProcessorTest::testSorting in Facets 8

Tests sorting.

File

tests/src/Unit/Plugin/processor/RawValueWidgetOrderProcessorTest.php, line 54

Class

RawValueWidgetOrderProcessorTest
Unit test for processor.

Namespace

Drupal\Tests\facets\Unit\Plugin\processor

Code

public function testSorting() {
  $sort_value = $this->processor
    ->sortResults($this->originalResults[0], $this->originalResults[1]);
  $this
    ->assertEquals(1, $sort_value);
  $sort_value = $this->processor
    ->sortResults($this->originalResults[1], $this->originalResults[2]);
  $this
    ->assertEquals(1, $sort_value);
  $sort_value = $this->processor
    ->sortResults($this->originalResults[2], $this->originalResults[3]);
  $this
    ->assertEquals(-1, $sort_value);
  $sort_value = $this->processor
    ->sortResults($this->originalResults[3], $this->originalResults[4]);
  $this
    ->assertEquals(-1, $sort_value);
  $sort_value = $this->processor
    ->sortResults($this->originalResults[4], $this->originalResults[5]);
  $this
    ->assertEquals(-1, $sort_value);
  $sort_value = $this->processor
    ->sortResults($this->originalResults[5], $this->originalResults[6]);
  $this
    ->assertEquals(1, $sort_value);
  $sort_value = $this->processor
    ->sortResults($this->originalResults[3], $this->originalResults[3]);
  $this
    ->assertEquals(0, $sort_value);
}