Hoa central
Public Member Functions | Protected Member Functions | List of all members
Hoa\Dispatcher\Test\Unit\ClassMethod Class Reference
Inheritance diagram for Hoa\Dispatcher\Test\Unit\ClassMethod:

Public Member Functions

 case_callable_in_rule_pattern ()
 
 case_callable_in_rule_definition ()
 
 case_asynchronous ()
 
 case_class_not_found ()
 
 case_method_not_found ()
 
 case_kit_dnew ()
 
 case_an_argument_is_missing ()
 
 case_an_optional_argument_is_missing ()
 
 dispatchedMethod ($test, $foo, $bar)
 
 dispatchedMethodAsync ($test, $foo, $bar)
 
 dispatchedMethodOptional ($test, $foo, $bar=null)
 
 dispatchedMethodWithKit ($test, $_this)
 
- Public Member Functions inherited from Hoa\Test\Unit\Suite
 __construct ()
 
 getTestedClassName ()
 
 getTestedClassNamespace ()
 
 beforeTestMethod ($methodName)
 

Protected Member Functions

 route (Router $router, $uri, Array $extraVariables=[])
 

Detailed Description

Class .

Test suite of the class/method dispatcher.

Definition at line 51 of file ClassMethod.php.

Member Function Documentation

Hoa\Dispatcher\Test\Unit\ClassMethod::case_an_argument_is_missing ( )

Definition at line 200 of file ClassMethod.php.

201  {
202  $this
203  ->given(
204  $router = new MockRouter(),
205  $router->get(
206  'a',
207  '(?<foo>foo)',
208  __CLASS__,
209  'dispatchedMethod'
210  ),
211  $this->route($router, 'foo'),
212 
213  $dispatcher = new LUT\ClassMethod(),
214  $dispatcher->getParameters()->setParameters([
215  'synchronous.call' => '(:call:U:)',
216  'synchronous.able' => '(:able:)'
217  ])
218  )
219  ->exception(function () use ($dispatcher, $router) {
220 
221  $dispatcher->dispatch($router);
222  })
223  ->isInstanceOf('Hoa\Dispatcher\Exception');
224  }
route(Router $router, $uri, Array $extraVariables=[])
$dispatcher
Definition: Hoa.php:98

Here is the call graph for this function:

Hoa\Dispatcher\Test\Unit\ClassMethod::case_an_optional_argument_is_missing ( )

Definition at line 226 of file ClassMethod.php.

227  {
228  $this
229  ->given(
230  $router = new MockRouter(),
231  $router->get(
232  'a',
233  '(?<foo>foo)',
234  __CLASS__,
235  'dispatchedMethodOptional'
236  ),
237  $this->route($router, 'foo'),
238 
239  $dispatcher = new LUT\ClassMethod(),
240  $dispatcher->getParameters()->setParameters([
241  'synchronous.call' => '(:call:U:)',
242  'synchronous.able' => '(:able:)'
243  ])
244  )
245  ->when($dispatcher->dispatch($router));
246  }
route(Router $router, $uri, Array $extraVariables=[])
$dispatcher
Definition: Hoa.php:98

Here is the call graph for this function:

Hoa\Dispatcher\Test\Unit\ClassMethod::case_asynchronous ( )

Definition at line 101 of file ClassMethod.php.

102  {
103  $this
104  ->given(
105  $router = new MockRouter(),
106  $router->get(
107  'a',
108  '(?<foo>foo) (?<bar>bar)',
109  __CLASS__,
110  'dispatchedMethod'
111  ),
112  $router->asynchronous = true,
113  $this->route($router, 'foo bar'),
114 
115  $dispatcher = new LUT\ClassMethod(),
116  $dispatcher->getParameters()->setParameters([
117  'asynchronous.call' => '(:call:U:)',
118  'asynchronous.able' => '(:able:)Async'
119  ])
120  )
121  ->when($dispatcher->dispatch($router));
122  }
route(Router $router, $uri, Array $extraVariables=[])
$dispatcher
Definition: Hoa.php:98

Here is the call graph for this function:

Hoa\Dispatcher\Test\Unit\ClassMethod::case_callable_in_rule_definition ( )

Definition at line 79 of file ClassMethod.php.

80  {
81  $this
82  ->given(
83  $router = new MockRouter(),
84  $router->get(
85  'a',
86  '(?<foo>foo) (?<bar>bar)',
87  __CLASS__,
88  'dispatchedMethod'
89  ),
90  $this->route($router, 'foo bar'),
91 
92  $dispatcher = new LUT\ClassMethod(),
93  $dispatcher->getParameters()->setParameters([
94  'synchronous.call' => '(:call:U:)',
95  'synchronous.able' => '(:able:)'
96  ])
97  )
98  ->when($dispatcher->dispatch($router));
99  }
route(Router $router, $uri, Array $extraVariables=[])
$dispatcher
Definition: Hoa.php:98

Here is the call graph for this function:

Hoa\Dispatcher\Test\Unit\ClassMethod::case_callable_in_rule_pattern ( )

Definition at line 53 of file ClassMethod.php.

54  {
55  $this
56  ->given(
57  $router = new MockRouter(),
58  $router->get(
59  'a',
60  '(?<_call>' . preg_quote(__CLASS__) . ') ' .
61  '(?<_able>dispatchedMethod) ' .
62  '(?<foo>foo) ' .
63  '(?<bar>bar)'
64  ),
65  $this->route(
66  $router,
67  __CLASS__ . ' dispatchedMethod foo bar'
68  ),
69 
70  $dispatcher = new LUT\ClassMethod(),
71  $dispatcher->getParameters()->setParameters([
72  'synchronous.call' => '(:call:U:)',
73  'synchronous.able' => '(:able:)'
74  ])
75  )
76  ->when($dispatcher->dispatch($router));
77  }
route(Router $router, $uri, Array $extraVariables=[])
$dispatcher
Definition: Hoa.php:98

Here is the call graph for this function:

Hoa\Dispatcher\Test\Unit\ClassMethod::case_class_not_found ( )

Definition at line 124 of file ClassMethod.php.

125  {
126  $this
127  ->given(
128  $router = new MockRouter(),
129  $router->get(
130  'a',
131  '(?<foo>foo) (?<bar>bar)',
132  __CLASS__ . '_NOT_FOUND',
133  'dispatchedMethod'
134  ),
135  $this->route($router, 'foo bar'),
136 
137  $dispatcher = new LUT\ClassMethod(),
138  $dispatcher->getParameters()->setParameters([
139  'synchronous.call' => '(:call:U:)',
140  'synchronous.able' => '(:able:)'
141  ])
142  )
143  ->exception(function () use ($dispatcher, $router) {
144 
145  $dispatcher->dispatch($router);
146  })
147  ->isInstanceOf('Hoa\Dispatcher\Exception');
148  }
route(Router $router, $uri, Array $extraVariables=[])
$dispatcher
Definition: Hoa.php:98

Here is the call graph for this function:

Hoa\Dispatcher\Test\Unit\ClassMethod::case_kit_dnew ( )

Definition at line 176 of file ClassMethod.php.

177  {
178  $this
179  ->given(
180  $router = new MockRouter(),
181  $router->get(
182  'a',
183  'foo',
184  __CLASS__,
185  'dispatchedMethodWithKit'
186  ),
187  $this->route($router, 'foo'),
188 
189  $dispatcher = new LUT\ClassMethod(),
190  $dispatcher->getParameters()->setParameters([
191  'synchronous.call' => '(:call:U:)',
192  'synchronous.able' => '(:able:)'
193  ]),
194 
195  $dispatcher->setKitName(__NAMESPACE__ . '\MockKit')
196  )
197  ->when($dispatcher->dispatch($router));
198  }
route(Router $router, $uri, Array $extraVariables=[])
$dispatcher
Definition: Hoa.php:98

Here is the call graph for this function:

Hoa\Dispatcher\Test\Unit\ClassMethod::case_method_not_found ( )

Definition at line 150 of file ClassMethod.php.

151  {
152  $this
153  ->given(
154  $router = new MockRouter(),
155  $router->get(
156  'a',
157  'foo',
158  __CLASS__,
159  'dispatchedMethod_NOT_FOUND'
160  ),
161  $this->route($router, 'foo'),
162 
163  $dispatcher = new LUT\ClassMethod(),
164  $dispatcher->getParameters()->setParameters([
165  'synchronous.call' => '(:call:U:)',
166  'synchronous.able' => '(:able:)'
167  ])
168  )
169  ->exception(function () use ($dispatcher, $router) {
170 
171  $dispatcher->dispatch($router);
172  })
173  ->isInstanceOf('Hoa\Dispatcher\Exception');
174  }
route(Router $router, $uri, Array $extraVariables=[])
$dispatcher
Definition: Hoa.php:98

Here is the call graph for this function:

Hoa\Dispatcher\Test\Unit\ClassMethod::dispatchedMethod (   $test,
  $foo,
  $bar 
)

Definition at line 261 of file ClassMethod.php.

262  {
263  $test
264  ->string($foo)
265  ->isEqualTo('foo')
266  ->string($bar)
267  ->isEqualTo('bar');
268  }

Here is the caller graph for this function:

Hoa\Dispatcher\Test\Unit\ClassMethod::dispatchedMethodAsync (   $test,
  $foo,
  $bar 
)

Definition at line 270 of file ClassMethod.php.

271  {
272  $test
273  ->boolean(true)
274  ->isTrue();
275 
276  return $this->dispatchedMethod($test, $foo, $bar);
277  }

Here is the call graph for this function:

Hoa\Dispatcher\Test\Unit\ClassMethod::dispatchedMethodOptional (   $test,
  $foo,
  $bar = null 
)

Definition at line 279 of file ClassMethod.php.

280  {
281  $test
282  ->string($foo)
283  ->isEqualTo('foo')
284  ->variable($bar)
285  ->isNull();
286  }
Hoa\Dispatcher\Test\Unit\ClassMethod::dispatchedMethodWithKit (   $test,
  $_this 
)

Definition at line 288 of file ClassMethod.php.

289  {
290  $test
291  ->object($_this)
292  ->isInstanceOf(__NAMESPACE__ . '\MockKit')
293  ->boolean($_this->hasBeenConstructed)
294  ->isTrue();
295  }
Hoa\Dispatcher\Test\Unit\ClassMethod::route ( Router  $router,
  $uri,
Array  $extraVariables = [] 
)
protected

Definition at line 248 of file ClassMethod.php.

249  {
250  $router->route($uri);
251  $theRule = &$router->getTheRule();
252  $theRule[$router::RULE_VARIABLES]['test'] = $this;
253 
254  foreach ($extraVariables as $name => $value) {
255  $theRule[$router::RULE_VARIABLES][$name] = $value;
256  }
257 
258  return $router;
259  }

Here is the call graph for this function:

Here is the caller graph for this function:


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