protected function LocationTestCase::reorderLocations in Location 7.3
Same name and namespace in other branches
- 6.3 tests/location_testcase.php \LocationTestCase::reorderLocations()
- 7.5 tests/location_testcase.php \LocationTestCase::reorderLocations()
- 7.4 tests/location_testcase.php \LocationTestCase::reorderLocations()
Order locations in a node by LID for testing repeatability purposes.
2 calls to LocationTestCase::reorderLocations()
File
- tests/
location_testcase.test, line 124 - Common functions for Location tests.
Class
- LocationTestCase
- Class LocationTestCase.
Code
protected function reorderLocations(&$node, $field = 'locations') {
$locations = array();
foreach ($node->{$field} as $location) {
if ($location['lid']) {
$locations[$location['lid']] = $location;
}
}
ksort($locations);
$node->{$field} = array();
foreach ($locations as $location) {
$node->{$field}[] = $location;
}
}