Esempio n. 1
0
 /**
  * @dataProvider routeProvider
  * @param        Wildcard $route
  * @param        string   $path
  * @param        integer  $offset
  * @param        array    $params
  * @param        boolean  $skipAssembling
  */
 public function testAssembling(Wildcard $route, $path, $offset, array $params = null, $skipAssembling = false)
 {
     if ($params === null || $skipAssembling) {
         // Data which will not match are not tested for assembling.
         return;
     }
     $result = $route->assemble($params);
     if ($offset !== null) {
         $this->assertEquals($offset, strpos($path, $result, $offset));
     } else {
         $this->assertEquals($path, $result);
     }
 }
Esempio n. 2
0
 public function testGetAssembledParams()
 {
     $route = new Wildcard();
     $route->assemble(array('foo' => 'bar'));
     $this->assertEquals(array('foo'), $route->getAssembledParams());
 }
Esempio n. 3
0
 public function testEncodedDecode()
 {
     // every character
     $in = '%61%62%63%64%65%66%67%68%69%6a%6b%6c%6d%6e%6f%70%71%72%73%74%75%76%77%78%79%7a%41%42%43%44%45%46%47%48%49%4a%4b%4c%4d%4e%4f%50%51%52%53%54%55%56%57%58%59%5a%30%31%32%33%34%35%36%37%38%39%60%2d%3d%5b%5d%5c%3b%27%2c%2e%2f%7e%21%40%23%24%25%5e%26%2a%28%29%5f%2b%7b%7d%7c%3a%22%3c%3e%3f';
     $out = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789`-=[]\\;\',./~!@#$%^&*()_+{}|:"<>?';
     $request = new Request();
     $request->setUri('http://example.com/foo/' . $in);
     $route = new Wildcard();
     $match = $route->match($request);
     $this->assertSame($out, $match->getParam('foo'));
 }