Ejemplo n.º 1
0
 public function testFromUriReturnCompleteUriDefinition()
 {
     $uri = UriDefinition::fromUri("foo://bar.baz/qux%2Fnorf/?oops=i_dont_know&what_comes=after");
     $this->assertEquals("foo", $uri->getScheme());
     $this->assertCount(2, $uri->getArguments());
     $this->assertArrayHasKey(0, $uri->getArguments());
     $this->assertEquals("bar.baz", $uri->getArguments()[0]);
     $this->assertArrayHasKey(1, $uri->getArguments());
     $this->assertEquals("qux/norf", $uri->getArguments()[1]);
     $this->assertCount(2, $uri->getOptions());
     $this->assertArrayHasKey("oops", $uri->getOptions());
     $this->assertEquals("i_dont_know", $uri->getOptions()["oops"]);
     $this->assertArrayHasKey("what_comes", $uri->getOptions());
     $this->assertEquals("after", $uri->getOptions()["what_comes"]);
 }
Ejemplo n.º 2
0
 /**
  * @param string $uri
  * @return RouteInterface
  *
  * @see RouteInterface::addDestination
  *
  * Helper for addDestination method, parses $uri into a UriDefinition object and calls addDestination
  */
 public function to(string $uri) : RouteInterface
 {
     return $this->addDestination(UriDefinition::fromUri($uri));
 }