3 require_once 'CiviTest/CiviUnitTestCase.php';
6 * Class CRM_Core_MenuTest
8 class CRM_Core_MenuTest
extends CiviUnitTestCase
{
10 public function pathArguments() {
11 $cases = array(); // array(0 => string $input, 1 => array $expectedOutput)
12 //$cases[] = array(NULL, array());
13 //$cases[] = array('', array());
14 //$cases[] = array('freestanding', array('freestanding' => NULL));
15 $cases[] = array('addSequence=1', array('addSequence' => '1'));
16 $cases[] = array('attachUpload=1', array('attachUpload' => '1'));
17 $cases[] = array('mode=256', array('mode' => '256'));
18 $cases[] = array('mode=256,addSequence=1,attachUpload=1', array('mode' => '256', 'addSequence' => '1', 'attachUpload' => 1));
19 $cases[] = array('mode=256,urlToSession=a:b:c:d', array(
21 'urlToSession' => array(
22 array('urlVar' => 'a', 'sessionVar' => 'b', 'type' => 'c', 'default' => 'd'),
25 $cases[] = array('mode=256,urlToSession=a:b:c:d;z:y:x:w', array(
27 'urlToSession' => array(
28 array('urlVar' => 'a', 'sessionVar' => 'b', 'type' => 'c', 'default' => 'd'),
29 array('urlVar' => 'z', 'sessionVar' => 'y', 'type' => 'x', 'default' => 'w'),
32 $cases[] = array('url=whiz!;.:#=%/|+bang?', array('url' => 'whiz!;.:#=%/|+bang?'));
38 * @param $expectedArray
39 * @dataProvider pathArguments
41 public function testGetArrayForPathArgs($inputString, $expectedArray) {
42 $actual = CRM_Core_Menu
::getArrayForPathArgs($inputString);
43 $this->assertEquals($expectedArray, $actual);