Beispiel #1
0
 public function testAny()
 {
     $handler = function () {
     };
     $refl = new \ReflectionClass($this->router);
     $collector = $refl->getProperty('collector');
     $collector->setAccessible(true);
     $collector = $collector->getValue($this->router);
     $this->assertEmpty($collector->getData()[0]);
     $this->router->any('/foo', $handler);
     $this->assertNotEmpty($collector->getData()[0]);
     $this->assertEquals(['/foo' => $handler], $collector->getData()[0]['GET']);
     $this->assertEquals(['/foo' => $handler], $collector->getData()[0]['POST']);
     $this->assertEquals(['/foo' => $handler], $collector->getData()[0]['PATCH']);
     $this->assertEquals(['/foo' => $handler], $collector->getData()[0]['PUT']);
     $this->assertEquals(['/foo' => $handler], $collector->getData()[0]['DELETE']);
     $this->assertEquals(['/foo' => $handler], $collector->getData()[0]['HEAD']);
     $this->assertEquals(['/foo' => $handler], $collector->getData()[0]['OPTIONS']);
 }
Beispiel #2
0
 /**
  * Proxies to MiddlewarePipe::pipe.
  *
  * @param string $path
  * @param callable $handler
  */
 public function add($path, $handler = null)
 {
     $this->router->add($path, $handler);
 }