You are here

protected function LocationTestCase::reorderLocations in Location 7.3

Same name and namespace in other branches
  1. 6.3 tests/location_testcase.php \LocationTestCase::reorderLocations()
  2. 7.5 tests/location_testcase.php \LocationTestCase::reorderLocations()
  3. 7.4 tests/location_testcase.php \LocationTestCase::reorderLocations()

Order locations in a node by LID for testing repeatability purposes.

2 calls to LocationTestCase::reorderLocations()
CowInstanceTest::testCOWConservation in tests/cow.test
CowInstanceTest::testNodeRevisionCOW in tests/cow.test

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;
  }
}