function SortArrayTest::providerSortByTitleElement

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php \Drupal\Tests\Component\Utility\SortArrayTest::providerSortByTitleElement()
  2. 10 core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php \Drupal\Tests\Component\Utility\SortArrayTest::providerSortByTitleElement()
  3. 11.x 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 197

Class

SortArrayTest
Tests the SortArray component.

Namespace

Drupal\Tests\Component\Utility

Code

public function providerSortByTitleElement() {
    $tests = [];
    // Titles set and equal.
    $tests[] = [
        [
            'title' => 'test',
        ],
        [
            'title' => 'test',
        ],
        0,
    ];
    // Title $a not set.
    $tests[] = [
        [],
        [
            'title' => 'test',
        ],
        -4,
    ];
    // Title $b not set.
    $tests[] = [
        [
            'title' => 'test',
        ],
        [],
        4,
    ];
    // Titles set but not equal.
    $tests[] = [
        [
            'title' => 'test',
        ],
        [
            'title' => 'testing',
        ],
        -1,
    ];
    // Titles set but not equal.
    $tests[] = [
        [
            'title' => 'testing',
        ],
        [
            'title' => 'test',
        ],
        1,
    ];
    return $tests;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.