18 $this->assertEquals($expansion, $uri->expand($template, $params));
28 array(
'value' =>
'var',
'modifier' =>
'*')
33 '{?keys,var,val}', array(
36 array(
'value' =>
'keys',
'modifier' =>
''),
37 array(
'value' =>
'var',
'modifier' =>
''),
38 array(
'value' =>
'val',
'modifier' =>
'')
43 '{+x,hello,y}', array(
46 array(
'value' =>
'x',
'modifier' =>
''),
47 array(
'value' =>
'hello',
'modifier' =>
''),
48 array(
'value' =>
'y',
'modifier' =>
'')
63 $class = new \ReflectionClass($template);
64 $method = $class->getMethod(
'parseExpression');
65 $method->setAccessible(
true);
67 $exp = substr($exp, 1, -1);
68 $this->assertEquals($data, $method->invokeArgs($template, array($exp)));
78 $result = $template->expand(
'http://example.com{+path}{/segments}{?query,data*,foo*}', array(
80 'segments' => array(
'one',
'two'),
83 'more' => array(
'fun',
'ice cream')
94 $this->assertEquals(
'http://example.com/foo/bar/one,two?query=test&more%5B0%5D=fun&more%5B1%5D=ice%20cream&baz%5Bbar%5D=fizz&baz%5Btest%5D=buzz&bam=boo', $result);
103 $template->setRegex(
'/<\$(.+)>/');
104 $this->assertSame(
'/foo', $template->expand(
'/<$a>', array(
'a' =>
'foo')));