You are here

function RedirectUnitTest::testSortRecursive in Redirect 7

Same name and namespace in other branches
  1. 7.2 redirect.test \RedirectUnitTest::testSortRecursive()

Test redirect_sort_recursive().

File

./redirect.test, line 117
Unit tests for the redirect module.

Class

RedirectUnitTest

Code

function testSortRecursive() {
  $test_cases = array(
    array(
      'input' => array(
        'b' => 'aa',
        'c' => array(
          'c2' => 'aa',
          'c1' => 'aa',
        ),
        'a' => 'aa',
      ),
      'expected' => array(
        'a' => 'aa',
        'b' => 'aa',
        'c' => array(
          'c1' => 'aa',
          'c2' => 'aa',
        ),
      ),
      'callback' => 'ksort',
    ),
  );
  foreach ($test_cases as $index => $test_case) {
    $output = $test_case['input'];
    redirect_sort_recursive($output, $test_case['callback']);
    $this
      ->assertIdentical($output, $test_case['expected']);
  }
}