/** * Manage the input. */ public function manageInput() { $method = filter_input(INPUT_SERVER, 'REQUEST_METHOD'); //TODO - violating DRY $input = $this->getInput(); //create if ($method === 'POST') { if (!empty($input)) { $this->persistenceModel->createRow($input); } } //read if ($method === 'GET') { } //update if ($method === 'PUT') { if (!empty($input)) { $this->persistenceModel->updateRow($input); } } //delete if ($method === 'DELETE') { $this->persistenceModel->deleteRow(); } $this->persistenceModel->output = $this->urlModel->main($this->table); }
public function testMainRouteWithTableAndKey() { $this->urlModel->base = 'foo'; $this->assertEquals('foo/bar/baz', $this->urlModel->main('bar', 'baz')); }