function PathRedirectUnitTest::testCompareArray in Path redirect 6
File
- ./
path_redirect.test, line 79 - Tests for the path_redirect module.
Class
Code
function testCompareArray() {
$haystack = array(
'a' => 'aa',
'b' => 'bb',
'c' => array(
'c1' => 'cc1',
'c2' => 'cc2',
),
);
$cases = array(
array(
'query' => array(
'a' => 'aa',
'b' => 'invalid',
),
'result' => FALSE,
),
array(
'query' => array(
'b' => 'bb',
'b' => 'bb',
),
'result' => TRUE,
),
array(
'query' => array(
'b' => 'bb',
'c' => 'invalid',
),
'result' => FALSE,
),
array(
'query' => array(
'b' => 'bb',
'c' => array(),
),
'result' => TRUE,
),
array(
'query' => array(
'b' => 'bb',
'c' => array(
'invalid',
),
),
'result' => FALSE,
),
array(
'query' => array(
'b' => 'bb',
'c' => array(
'c2' => 'invalid',
),
),
'result' => FALSE,
),
array(
'query' => array(
'b' => 'bb',
'c' => array(
'c2' => 'cc2',
),
),
'result' => TRUE,
),
);
foreach ($cases as $index => $case) {
$this
->assertEqual($case['result'], path_redirect_compare_array($case['query'], $haystack));
}
}