示例#1
0
文件: Router.php 项目: minond/restful
 /**
  * parse the model id from the uri
  * @return string
  */
 public function getModelId()
 {
     if ($this->modelid === false) {
         preg_match($this->pattern, $this->request->getUri(), $matches);
         $this->modelid = isset($matches['id']) ? $matches['id'] : null;
     }
     return $this->modelid;
 }
示例#2
0
 /**
  * @backupGlobals enabled
  */
 public function testGlobalImportethodReadsExpectedValues()
 {
     $args = $_REQUEST = ['testing' => 'true'];
     $params = new PublicObject($args);
     $_SERVER['REQUEST_URI'] = '/index?test';
     $uri = '/index';
     $port = $_SERVER['SERVER_PORT'] = '8080';
     $method = $_SERVER['REQUEST_METHOD'] = Verb::POST;
     $req = new Request();
     $req->importFromGlobals();
     $this->assertEquals($params, $req->getParameters());
     $this->assertEquals($uri, $req->getUri());
     $this->assertEquals($port, $req->getPort());
     $this->assertEquals($method, $req->getMethod());
 }