function SortArrayTest::assertBothNegativePositiveOrZero
Same name in other branches
- 9 core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php \Drupal\Tests\Component\Utility\SortArrayTest::assertBothNegativePositiveOrZero()
- 10 core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php \Drupal\Tests\Component\Utility\SortArrayTest::assertBothNegativePositiveOrZero()
- 11.x core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php \Drupal\Tests\Component\Utility\SortArrayTest::assertBothNegativePositiveOrZero()
Asserts that numbers are either both negative, both positive or both zero.
The exact values returned by comparison functions differ between PHP versions and are considered an "implementation detail".
Parameters
int $expected: Expected comparison function return value.
int $result: Actual comparison function return value.
4 calls to SortArrayTest::assertBothNegativePositiveOrZero()
- SortArrayTest::testSortByTitleElement in core/
tests/ Drupal/ Tests/ Component/ Utility/ SortArrayTest.php - Tests SortArray::sortByTitleElement() input against expected output.
- SortArrayTest::testSortByTitleProperty in core/
tests/ Drupal/ Tests/ Component/ Utility/ SortArrayTest.php - Tests SortArray::sortByTitleProperty() input against expected output.
- SortArrayTest::testSortByWeightElement in core/
tests/ Drupal/ Tests/ Component/ Utility/ SortArrayTest.php - Tests SortArray::sortByWeightElement() input against expected output.
- SortArrayTest::testSortByWeightProperty in core/
tests/ Drupal/ Tests/ Component/ Utility/ SortArrayTest.php - Tests SortArray::sortByWeightProperty() input against expected output.
File
-
core/
tests/ Drupal/ Tests/ Component/ Utility/ SortArrayTest.php, line 321
Class
- SortArrayTest
- Tests the SortArray component.
Namespace
Drupal\Tests\Component\UtilityCode
protected function assertBothNegativePositiveOrZero($expected, $result) {
$this->assertIsNumeric($expected);
$this->assertIsNumeric($result);
$this->assertTrue($expected < 0 && $result < 0 || $expected > 0 && $result > 0 || $expected === 0 && $result === 0, 'Numbers are either both negative, both positive or both zero.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.