You are here

public function SortArrayTest::providerSortByTitleElement in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php \Drupal\Tests\Component\Utility\SortArrayTest::providerSortByTitleElement()

Data provider for SortArray::sortByTitleElement().

Return value

array An array of tests, matching the parameter inputs for testSortByTitleElement.

See also

\Drupal\Tests\Component\Utility\SortArrayTest::testSortByTitleElement()

File

core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php, line 202
Contains \Drupal\Tests\Component\Utility\SortArrayTest.

Class

SortArrayTest
Tests the SortArray component.

Namespace

Drupal\Tests\Component\Utility

Code

public function providerSortByTitleElement() {
  $tests = array();

  // Titles set and equal.
  $tests[] = array(
    array(
      'title' => 'test',
    ),
    array(
      'title' => 'test',
    ),
    0,
  );

  // Title $a not set.
  $tests[] = array(
    array(),
    array(
      'title' => 'test',
    ),
    -4,
  );

  // Title $b not set.
  $tests[] = array(
    array(
      'title' => 'test',
    ),
    array(),
    4,
  );

  // Titles set but not equal.
  $tests[] = array(
    array(
      'title' => 'test',
    ),
    array(
      'title' => 'testing',
    ),
    -1,
  );

  // Titles set but not equal.
  $tests[] = array(
    array(
      'title' => 'testing',
    ),
    array(
      'title' => 'test',
    ),
    1,
  );
  return $tests;
}