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'));
19 'mode=256,addSequence=1,attachUpload=1',
20 array('mode' => '256', 'addSequence' => '1', 'attachUpload' => 1),
23 'mode=256,urlToSession=a:b:c:d',
26 'urlToSession' => array(
27 array('urlVar' => 'a', 'sessionVar' => 'b', 'type' => 'c', 'default' => 'd'),
32 'mode=256,urlToSession=a:b:c:d;z:y:x:w',
35 'urlToSession' => array(
36 array('urlVar' => 'a', 'sessionVar' => 'b', 'type' => 'c', 'default' => 'd'),
37 array('urlVar' => 'z', 'sessionVar' => 'y', 'type' => 'x', 'default' => 'w'),
41 $cases[] = array('url=whiz!;.:#=%/|+bang?', array('url' => 'whiz!;.:#=%/|+bang?'));
47 * @param $expectedArray
48 * @dataProvider pathArguments
50 public function testGetArrayForPathArgs($inputString, $expectedArray) {
51 $actual = CRM_Core_Menu
::getArrayForPathArgs($inputString);
52 $this->assertEquals($expectedArray, $actual);