You are here

public function DisplayValueWidgetOrderProcessorTest::testUseActualDisplayValue in Facets 8

Tests that sorting uses the display value.

File

tests/src/Unit/Plugin/processor/DisplayValueWidgetOrderProcessorTest.php, line 92

Class

DisplayValueWidgetOrderProcessorTest
Unit test for processor.

Namespace

Drupal\Tests\facets\Unit\Plugin\processor

Code

public function testUseActualDisplayValue() {
  $facet = new Facet([], 'facets_facet');
  $original = [
    new Result($facet, 'bb_test', 'Test AA', 10),
    new Result($facet, 'aa_test', 'Test BB', 10),
  ];
  $sorted_results = $this->processor
    ->sortResults($original[0], $original[1]);
  $this
    ->assertEquals(-1, $sorted_results);
  $sorted_results = $this->processor
    ->sortResults($original[1], $original[0]);
  $this
    ->assertEquals(1, $sorted_results);
}