You are here

public function SortArrayTest::testSortByWeightProperty 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::testSortByWeightProperty()

Tests SortArray::sortByWeightProperty() input against expected output.

@dataProvider providerSortByWeightProperty @covers ::sortByWeightProperty @covers ::sortByKeyInt

Parameters

array $a: The first input array for the SortArray::sortByWeightProperty() method.

array $b: The second input array for the SortArray::sortByWeightProperty().

integer $expected: The expected output from calling the method.

File

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

Class

SortArrayTest
Tests the SortArray component.

Namespace

Drupal\Tests\Component\Utility

Code

public function testSortByWeightProperty($a, $b, $expected) {
  $result = SortArray::sortByWeightProperty($a, $b);
  $this
    ->assertBothNegativePositiveOrZero($expected, $result);
}