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

Public Member Functions

 case_getParameters ()
 
 case_kitname ()
 
 case_dispatch_already_routed ()
 
 case_dispatch_auto_route ()
 
 case_dispatch_return ()
 
- Public Member Functions inherited from Hoa\Test\Unit\Suite
 __construct ()
 
 getTestedClassName ()
 
 getTestedClassNamespace ()
 
 beforeTestMethod ($methodName)
 

Detailed Description

Class .

Test suite of the abstract dispatcher.

Definition at line 50 of file Dispatcher.php.

Member Function Documentation

Hoa\Dispatcher\Test\Unit\Dispatcher::case_dispatch_already_routed ( )

Definition at line 76 of file Dispatcher.php.

77  {
78  $this
79  ->given(
80  $dispatcher = new \Mock\Hoa\Dispatcher(),
81  $parameters = $dispatcher->getParameters(),
82  $routedRule = null,
83  $routedRouter = null,
84  $routedView = null,
85  $routedParameters = null,
86  $this->calling($dispatcher)->resolve = function ($rule, $router, $view) use (
87  &$routedRule,
88  &$routedRouter,
89  &$routedView,
90  &$routedParameters
91  ) {
92 
93  $routedRule = $rule;
94  $routedRouter = $router;
95  $routedView = $view;
96  $routedParameters = $this->getParameters();
97 
98  return;
99  },
100  $router = new Router\Cli(),
101  $router->get('a', '(?<foo>fooo) (?<bar>baar)'),
102  $router->route('fooo baar')
103  )
104  ->when($dispatcher->dispatch($router))
105  ->then
106  ->array($routedRule)
107  ->object($routedRouter)
108  ->isIdenticalTo($router)
109  ->variable($routedView)
110  ->isNull()
111  ->object($routedParameters)
112  ->isInstanceOf('Hoa\Core\Parameter')
113 
114  ->object($dispatcher->getParameters())
115  ->isIdenticalTo($parameters)
116  ->object($parameters)
117  ->isNotIdenticalTo($routedParameters)
118  ->string($routedParameters->getParameter('variables.foo'))
119  ->isEqualTo('fooo')
120  ->string($routedParameters->getParameter('variables.bar'))
121  ->isEqualTo('baar');
122  }
$dispatcher
Definition: Hoa.php:98
getParameters()
Definition: Core.php:266

Here is the call graph for this function:

Hoa\Dispatcher\Test\Unit\Dispatcher::case_dispatch_auto_route ( )

Definition at line 124 of file Dispatcher.php.

125  {
126  $this
127  ->given(
128  $dispatcher = new \Mock\Hoa\Dispatcher(),
129  $parameters = $dispatcher->getParameters(),
130  $routedRule = null,
131  $routedRouter = null,
132  $routedView = null,
133  $routedParameters = null,
134  $this->calling($dispatcher)->resolve = function ($rule, $router, $view) use (
135  &$routedRule,
136  &$routedRouter,
137  &$routedView,
138  &$routedParameters
139  ) {
140 
141  $routedRule = $rule;
142  $routedRouter = $router;
143  $routedView = $view;
144  $routedParameters = $this->getParameters();
145 
146  return;
147  },
148  $router = new Router\Cli(),
149  $router->get('a', '(?<foo>fooo) (?<bar>baar)'),
150  $router->route('fooo baar'),
151  $theRule = $router->getTheRule(),
152 
153  $router = new \Mock\Hoa\Router(),
154  $this->calling($router)->getTheRule[0] = $theRule,
155  $this->calling($router)->getTheRule[1] = null,
156  $this->calling($router)->route = null
157  )
158  ->when($dispatcher->dispatch($router))
159  ->then
160  ->array($routedRule)
161  ->object($routedRouter)
162  ->isIdenticalTo($router)
163  ->variable($routedView)
164  ->isNull()
165  ->object($routedParameters)
166  ->isInstanceOf('Hoa\Core\Parameter')
167 
168  ->object($dispatcher->getParameters())
169  ->isIdenticalTo($parameters)
170  ->object($parameters)
171  ->isNotIdenticalTo($routedParameters)
172  ->string($routedParameters->getParameter('variables.foo'))
173  ->isEqualTo('fooo')
174  ->string($routedParameters->getParameter('variables.bar'))
175  ->isEqualTo('baar');
176  }
$dispatcher
Definition: Hoa.php:98
getParameters()
Definition: Core.php:266

Here is the call graph for this function:

Hoa\Dispatcher\Test\Unit\Dispatcher::case_dispatch_return ( )

Definition at line 178 of file Dispatcher.php.

179  {
180  $this
181  ->given(
182  $dispatcher = new \Mock\Hoa\Dispatcher(),
183  $this->calling($dispatcher)->resolve = 42,
184 
185  $router = new Router\Cli(),
186  $router->get('a', '(?<foo>foo) (?<bar>bar)'),
187  $router->route('foo bar')
188  )
189  ->when($result = $dispatcher->dispatch($router))
190  ->then
191  ->integer($result)
192  ->isEqualTo(42);
193  }
$dispatcher
Definition: Hoa.php:98

Here is the call graph for this function:

Hoa\Dispatcher\Test\Unit\Dispatcher::case_getParameters ( )

Definition at line 52 of file Dispatcher.php.

53  {
54  $this
55  ->given($dispatcher = new \Mock\Hoa\Dispatcher())
56  ->when($result = $dispatcher->getParameters())
57  ->then
58  ->object($result)
59  ->isInstanceOf('Hoa\Core\Parameter');
60  }
$dispatcher
Definition: Hoa.php:98
Hoa\Dispatcher\Test\Unit\Dispatcher::case_kitname ( )

Definition at line 62 of file Dispatcher.php.

63  {
64  $this
65  ->given($dispatcher = new \Mock\Hoa\Dispatcher())
66  ->when($result = $dispatcher->setKitName('foo'))
67  ->then
68  ->string($result)
69  ->isEqualTo('Hoa\Dispatcher\Kit')
70 
71  ->when($result = $dispatcher->getKitName())
72  ->string($result)
73  ->isEqualTo('foo');
74  }
$dispatcher
Definition: Hoa.php:98

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