/** * 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 testUpdateRow() { $this->markTestSkipped('To test in real environment, edit this test'); //query class, e.g. UsersQuery $query = \Propel\Runtime\ActiveQuery\ModelCriteria::class; $this->persistenceModel->query = $this->createMock($query); $this->persistenceModel->ormModel->method('save')->willReturn($this->persistenceModel->key); $this->assertEquals($this->persistenceModel->key, $this->persistenceModel->updateRow([])); }