예제 #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
파일: RequestTest.php 프로젝트: minond/http
 /**
  * @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());
 }