/** * 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; }
/** * @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()); }