ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
FastRoute\RouteParser\StdTest Class Reference
+ Inheritance diagram for FastRoute\RouteParser\StdTest:
+ Collaboration diagram for FastRoute\RouteParser\StdTest:

Public Member Functions

 testParse ($routeString, $expectedRouteDatas)
 provideTestParse More...
 
 testParseError ($routeString, $expectedExceptionMessage)
 provideTestParseError More...
 
 provideTestParse ()
 
 provideTestParseError ()
 

Detailed Description

Definition at line 7 of file StdTest.php.

Member Function Documentation

◆ provideTestParse()

FastRoute\RouteParser\StdTest::provideTestParse ( )

Definition at line 25 of file StdTest.php.

26  {
27  return [
28  [
29  '/test',
30  [
31  ['/test'],
32  ]
33  ],
34  [
35  '/test/{param}',
36  [
37  ['/test/', ['param', '[^/]+']],
38  ]
39  ],
40  [
41  '/te{ param }st',
42  [
43  ['/te', ['param', '[^/]+'], 'st']
44  ]
45  ],
46  [
47  '/test/{param1}/test2/{param2}',
48  [
49  ['/test/', ['param1', '[^/]+'], '/test2/', ['param2', '[^/]+']]
50  ]
51  ],
52  [
53  '/test/{param:\d+}',
54  [
55  ['/test/', ['param', '\d+']]
56  ]
57  ],
58  [
59  '/test/{ param : \d{1,9} }',
60  [
61  ['/test/', ['param', '\d{1,9}']]
62  ]
63  ],
64  [
65  '/test[opt]',
66  [
67  ['/test'],
68  ['/testopt'],
69  ]
70  ],
71  [
72  '/test[/{param}]',
73  [
74  ['/test'],
75  ['/test/', ['param', '[^/]+']],
76  ]
77  ],
78  [
79  '/{param}[opt]',
80  [
81  ['/', ['param', '[^/]+']],
82  ['/', ['param', '[^/]+'], 'opt']
83  ]
84  ],
85  [
86  '/test[/{name}[/{id:[0-9]+}]]',
87  [
88  ['/test'],
89  ['/test/', ['name', '[^/]+']],
90  ['/test/', ['name', '[^/]+'], '/', ['id', '[0-9]+']],
91  ]
92  ],
93  [
94  '',
95  [
96  [''],
97  ]
98  ],
99  [
100  '[test]',
101  [
102  [''],
103  ['test'],
104  ]
105  ],
106  [
107  '/{foo-bar}',
108  [
109  ['/', ['foo-bar', '[^/]+']]
110  ]
111  ],
112  [
113  '/{_foo:.*}',
114  [
115  ['/', ['_foo', '.*']]
116  ]
117  ],
118  ];
119  }

◆ provideTestParseError()

FastRoute\RouteParser\StdTest::provideTestParseError ( )

Definition at line 121 of file StdTest.php.

122  {
123  return [
124  [
125  '/test[opt',
126  "Number of opening '[' and closing ']' does not match"
127  ],
128  [
129  '/test[opt[opt2]',
130  "Number of opening '[' and closing ']' does not match"
131  ],
132  [
133  '/testopt]',
134  "Number of opening '[' and closing ']' does not match"
135  ],
136  [
137  '/test[]',
138  'Empty optional part'
139  ],
140  [
141  '/test[[opt]]',
142  'Empty optional part'
143  ],
144  [
145  '[[test]]',
146  'Empty optional part'
147  ],
148  [
149  '/test[/opt]/required',
150  'Optional segments can only occur at the end of a route'
151  ],
152  ];
153  }

◆ testParse()

FastRoute\RouteParser\StdTest::testParse (   $routeString,
  $expectedRouteDatas 
)

provideTestParse

Definition at line 10 of file StdTest.php.

References $parser.

11  {
12  $parser = new Std();
13  $routeDatas = $parser->parse($routeString);
14  $this->assertSame($expectedRouteDatas, $routeDatas);
15  }
$parser
Definition: BPMN2Parser.php:23

◆ testParseError()

FastRoute\RouteParser\StdTest::testParseError (   $routeString,
  $expectedExceptionMessage 
)

provideTestParseError

Definition at line 18 of file StdTest.php.

References $parser.

19  {
20  $parser = new Std();
21  $this->setExpectedException('FastRoute\\BadRouteException', $expectedExceptionMessage);
22  $parser->parse($routeString);
23  }
$parser
Definition: BPMN2Parser.php:23

The documentation for this class was generated from the following file: