diff --git a/libraries/src/MVC/Controller/ApiController.php b/libraries/src/MVC/Controller/ApiController.php index 65aba3c038928..abde8bf5c7890 100644 --- a/libraries/src/MVC/Controller/ApiController.php +++ b/libraries/src/MVC/Controller/ApiController.php @@ -301,8 +301,6 @@ public function delete($id = null) if ($model->getError() !== false) { throw new \RuntimeException($model->getError(), 500); } - - throw new \RuntimeException(Text::_('JLIB_APPLICATION_ERROR_DELETE'), 500); } $this->app->setHeader('status', 204); diff --git a/tests/System/integration/api/com_contact/Contacts.cy.js b/tests/System/integration/api/com_contact/Contacts.cy.js index edf5dc4e29563..02ede312d367f 100644 --- a/tests/System/integration/api/com_contact/Contacts.cy.js +++ b/tests/System/integration/api/com_contact/Contacts.cy.js @@ -42,7 +42,13 @@ describe('Test that contacts API endpoint', () => { it('can delete a contact', () => { cy.db_createContact({ name: 'automated test contact', published: -2 }) - .then((contact) => cy.api_delete(`/contacts/${contact.id}`)); + .then((contact) => cy.api_delete(`/contacts/${contact.id}`)) + .then((result) => expect(result.status).to.eq(204)); + }); + + it('check correct response for delete a not existent contact', () => { + cy.api_delete('/contacts/9999') + .then((result) => expect(result.status).to.eq(204)); }); it('can submit a contact form', () => {