Example #1
0
 /**
  * @expectedException RuntimeException
  * @expectedExceptionMessageRegExp /Server/i
  */
 public function testListenInvalidResponse()
 {
     $dispatcher = new SimpleDispatcher();
     $dispatcher->mount('test', function () {
     });
     $server = new Server();
     $server->setDispatcher($dispatcher);
     $server->listen();
 }
Example #2
0
 /**
  * @dataProvider flowProvider
  */
 public function testDispatchFlow($flow, $return, $expected)
 {
     $dispatcher = new SimpleDispatcher();
     $dispatcher->mount('foo', function () {
         $this->flow();
     });
     $dispatcher->mount('bar', function () use($flow, $return) {
         $flow and $this->flow();
         return $return ? 'bar' : null;
     });
     $dispatcher->mount('xyz', function () {
         return 1.33;
     });
     $result = $dispatcher->dispatch(new Request());
     $this->assertEquals($expected, $result);
 }