MantisBT: master 3610ae50

Author Committer Branch Timestamp Parent
dregad dregad master 2023-08-17 12:03 master 485c0d84
Affected Issues  0030415: REST API: Add API to Get / Delete / Update versions
Changeset

Exception when version to delete does not exist

The initial implementation of VersionDeleteCommand did not throw an
exception when given a non-existing version number, causing the REST API
to succeed with HTTP 204 (version deleted) when it should in fact have
failed.

The Command now throws a ClientException, resulting in the API returning
a 404 (not found) in this situation.

Note: the version_exists() call before retrieving the project id with
version_get_field() is not necessary, as the latter already perform this
check (via version_cache_row()).

PHPUnit test has been updated accordingly.

Fixes 0030415

mod - core/commands/VersionDeleteCommand.php Diff File
mod - tests/rest/RestProjectVersionTest.php Diff File