You are here

public function SortsFieldTest::testSetters in Search API sorts 8

Tests getters and setters.

File

tests/src/Unit/SortsFieldTest.php, line 40

Class

SortsFieldTest
Tests the sorts field.

Namespace

Drupal\Tests\search_api_sorts\Unit

Code

public function testSetters() {
  $field = new SortsField('donkey');
  $field
    ->setOrder('owl');
  $this
    ->assertEquals('asc', $field
    ->getOrder());
  $field
    ->setOrder('desc');
  $this
    ->assertEquals('desc', $field
    ->getOrder());
  $field
    ->setOrder('asc');
  $this
    ->assertEquals('asc', $field
    ->getOrder());
  $this
    ->assertEquals('donkey', $field
    ->getFieldName());
  $field
    ->setFieldName('owl');
  $this
    ->assertEquals('owl', $field
    ->getFieldName());
}