You are here

public function SortArrayTest::providerSortByWeightAndName in Modules weight 8.2

Same name and namespace in other branches
  1. 8 tests/src/Unit/Utility/SortArrayTest.php \Drupal\Tests\modules_weight\Unit\Utility\SortArrayTest::providerSortByWeightAndName()

Data provider for testSortByWeightAndName().

Return value

array An array of arrays, each containing:

See also

testSortByWeightAndName()

File

tests/src/Unit/Utility/SortArrayTest.php, line 48

Class

SortArrayTest
Tests the SortArray class methods.

Namespace

Drupal\Tests\modules_weight\Unit\Utility

Code

public function providerSortByWeightAndName() {
  $tests['same weight different name 1'] = [
    -1,
    [
      'name' => 'Admin Toolbar',
      'weight' => 1,
    ],
    [
      'name' => 'Asana',
      'weight' => 1,
    ],
  ];
  $tests['same weight different name 2'] = [
    1,
    [
      'name' => 'Asana',
      'weight' => 1,
    ],
    [
      'name' => 'Admin Toolbar',
      'weight' => 1,
    ],
  ];
  $tests['different weight 1'] = [
    -1,
    [
      'name' => 'Asana',
      'weight' => -15,
    ],
    [
      'name' => 'Admin Toolbar',
      'weight' => 8,
    ],
  ];
  $tests['different weight 2'] = [
    1,
    [
      'name' => 'Asana',
      'weight' => 51,
    ],
    [
      'name' => 'Admin Toolbar',
      'weight' => -10,
    ],
  ];
  $tests['with no weight 1'] = [
    -1,
    [
      'name' => 'Asana',
    ],
    [
      'name' => 'Admin Toolbar',
      'weight' => 8,
    ],
  ];
  $tests['with no weight 2'] = [
    1,
    [
      'name' => 'Asana',
      'weight' => 51,
    ],
    [
      'name' => 'Admin Toolbar',
    ],
  ];
  return $tests;
}