Open Journal Systems
3.3.0
AbstractUriTemplateTest.php
1
<?php
2
3
namespace
Guzzle\Tests\Parsers\UriTemplate
;
4
5
abstract
class
AbstractUriTemplateTest
extends
\Guzzle\Tests\GuzzleTestCase
6
{
10
public
function
templateProvider
()
11
{
12
$t = array();
13
$params = array(
14
'var'
=>
'value'
,
15
'hello'
=>
'Hello World!'
,
16
'empty'
=>
''
,
17
'path'
=>
'/foo/bar'
,
18
'x'
=>
'1024'
,
19
'y'
=>
'768'
,
20
'null'
=>
null
,
21
'list'
=> array(
'red'
,
'green'
,
'blue'
),
22
'keys'
=> array(
23
"semi"
=>
';'
,
24
"dot"
=>
'.'
,
25
"comma"
=>
','
26
),
27
'empty_keys'
=> array(),
28
);
29
30
return
array_map(
function
($t) use ($params) {
31
$t[] = $params;
32
return
$t;
33
}, array(
34
array(
'foo'
,
'foo'
),
35
array(
'{var}'
,
'value'
),
36
array(
'{hello}'
,
'Hello%20World%21'
),
37
array(
'{+var}'
,
'value'
),
38
array(
'{+hello}'
,
'Hello%20World!'
),
39
array(
'{+path}/here'
,
'/foo/bar/here'
),
40
array(
'here?ref={+path}'
,
'here?ref=/foo/bar'
),
41
array(
'X{#var}'
,
'X#value'
),
42
array(
'X{#hello}'
,
'X#Hello%20World!'
),
43
array(
'map?{x,y}'
,
'map?1024,768'
),
44
array(
'{x,hello,y}'
,
'1024,Hello%20World%21,768'
),
45
array(
'{+x,hello,y}'
,
'1024,Hello%20World!,768'
),
46
array(
'{+path,x}/here'
,
'/foo/bar,1024/here'
),
47
array(
'{#x,hello,y}'
,
'#1024,Hello%20World!,768'
),
48
array(
'{#path,x}/here'
,
'#/foo/bar,1024/here'
),
49
array(
'X{.var}'
,
'X.value'
),
50
array(
'X{.x,y}'
,
'X.1024.768'
),
51
array(
'{/var}'
,
'/value'
),
52
array(
'{/var,x}/here'
,
'/value/1024/here'
),
53
array(
'{;x,y}'
,
';x=1024;y=768'
),
54
array(
'{;x,y,empty}'
,
';x=1024;y=768;empty'
),
55
array(
'{?x,y}'
,
'?x=1024&y=768'
),
56
array(
'{?x,y,empty}'
,
'?x=1024&y=768&empty='
),
57
array(
'?fixed=yes{&x}'
,
'?fixed=yes&x=1024'
),
58
array(
'{&x,y,empty}'
,
'&x=1024&y=768&empty='
),
59
array(
'{var:3}'
,
'val'
),
60
array(
'{var:30}'
,
'value'
),
61
array(
'{list}'
,
'red,green,blue'
),
62
array(
'{list*}'
,
'red,green,blue'
),
63
array(
'{keys}'
,
'semi,%3B,dot,.,comma,%2C'
),
64
array(
'{keys*}'
,
'semi=%3B,dot=.,comma=%2C'
),
65
array(
'{+path:6}/here'
,
'/foo/b/here'
),
66
array(
'{+list}'
,
'red,green,blue'
),
67
array(
'{+list*}'
,
'red,green,blue'
),
68
array(
'{+keys}'
,
'semi,;,dot,.,comma,,'
),
69
array(
'{+keys*}'
,
'semi=;,dot=.,comma=,'
),
70
array(
'{#path:6}/here'
,
'#/foo/b/here'
),
71
array(
'{#list}'
,
'#red,green,blue'
),
72
array(
'{#list*}'
,
'#red,green,blue'
),
73
array(
'{#keys}'
,
'#semi,;,dot,.,comma,,'
),
74
array(
'{#keys*}'
,
'#semi=;,dot=.,comma=,'
),
75
array(
'X{.var:3}'
,
'X.val'
),
76
array(
'X{.list}'
,
'X.red,green,blue'
),
77
array(
'X{.list*}'
,
'X.red.green.blue'
),
78
array(
'X{.keys}'
,
'X.semi,%3B,dot,.,comma,%2C'
),
79
array(
'X{.keys*}'
,
'X.semi=%3B.dot=..comma=%2C'
),
80
array(
'{/var:1,var}'
,
'/v/value'
),
81
array(
'{/list}'
,
'/red,green,blue'
),
82
array(
'{/list*}'
,
'/red/green/blue'
),
83
array(
'{/list*,path:4}'
,
'/red/green/blue/%2Ffoo'
),
84
array(
'{/keys}'
,
'/semi,%3B,dot,.,comma,%2C'
),
85
array(
'{/keys*}'
,
'/semi=%3B/dot=./comma=%2C'
),
86
array(
'{;hello:5}'
,
';hello=Hello'
),
87
array(
'{;list}'
,
';list=red,green,blue'
),
88
array(
'{;list*}'
,
';list=red;list=green;list=blue'
),
89
array(
'{;keys}'
,
';keys=semi,%3B,dot,.,comma,%2C'
),
90
array(
'{;keys*}'
,
';semi=%3B;dot=.;comma=%2C'
),
91
array(
'{?var:3}'
,
'?var=val'
),
92
array(
'{?list}'
,
'?list=red,green,blue'
),
93
array(
'{?list*}'
,
'?list=red&list=green&list=blue'
),
94
array(
'{?keys}'
,
'?keys=semi,%3B,dot,.,comma,%2C'
),
95
array(
'{?keys*}'
,
'?semi=%3B&dot=.&comma=%2C'
),
96
array(
'{&var:3}'
,
'&var=val'
),
97
array(
'{&list}'
,
'&list=red,green,blue'
),
98
array(
'{&list*}'
,
'&list=red&list=green&list=blue'
),
99
array(
'{&keys}'
,
'&keys=semi,%3B,dot,.,comma,%2C'
),
100
array(
'{&keys*}'
,
'&semi=%3B&dot=.&comma=%2C'
),
101
array(
'{.null}'
,
''
),
102
array(
'{.null,var}'
,
'.value'
),
103
array(
'X{.empty_keys*}'
,
'X'
),
104
array(
'X{.empty_keys}'
,
'X'
),
105
// Test that missing expansions are skipped
106
array(
'test{&missing*}'
,
'test'
),
107
// Test that multiple expansions can be set
108
array(
'http://{var}/{var:2}{?keys*}'
,
'http://value/va?semi=%3B&dot=.&comma=%2C'
),
109
// Test more complex query string stuff
110
array(
'http://www.test.com{+path}{?var,keys*}'
,
'http://www.test.com/foo/bar?var=value&semi=%3B&dot=.&comma=%2C'
)
111
));
112
}
113
}
Guzzle\Tests\Parsers\UriTemplate\AbstractUriTemplateTest\templateProvider
templateProvider()
Definition:
AbstractUriTemplateTest.php:10
Guzzle\Tests\GuzzleTestCase
Definition:
GuzzleTestCase.php:22
Guzzle\Tests\Parsers\UriTemplate\AbstractUriTemplateTest
Definition:
AbstractUriTemplateTest.php:5
Guzzle\Tests\Parsers\UriTemplate
Definition:
AbstractUriTemplateTest.php:3
plugins
paymethod
paypal
lib
vendor
guzzle
guzzle
tests
Guzzle
Tests
Parser
UriTemplate
AbstractUriTemplateTest.php
Generated on Fri Aug 28 2020 14:50:33 for Open Journal Systems by
1.8.17