-
Notifications
You must be signed in to change notification settings - Fork 719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add missing PHPUnit tests to Travis CI #1540
Conversation
@vboctor I need some help with this one. One of the REST tests is still failing (RestIssueAddTest::testCreateIssueWithTags) and I do not know how to fix that. I do not understand why the issue body is returned as NULL, when as far as I can tell we're executing the same command as in other test cases (e.g. testCreateIssueWithVersionObjectId), and the body is set correctly in that case. Also, I had to comment out some of the assertions in testCreateIssueWithTagIdNotFound and testCreateIssueNoSummary, because the REST API returns a 404 as expected, but I have no way of retrieving the created issue so I have nothing to compare against. |
@vboctor awating your feedback on this |
@dregad This is probably caused by a bug in the |
@vboctor that was it indeed ! Thanks for pointing me in the right direction. The code in IssueAddCommand is accessing $t_tag['id'] without first checking that the key exists, so when a tag is provided only by name, PHP throws a NOTICE causing the API to return an invalid JSON response (there is an HTML error message appended to it). I logged https://mantisbt.org/bugs/view.php?id=25997 to track the bug. You have not responded to the other issue I am facing
IMO, this is a design flaw of the API's current implementation, which first creates the issue, then creates/attaches tags to it as a separate, second step. |
Would it be the correct approach, to execute in IssueAddCommand::validate(), the same checks on tags to attach, as in mci_tag_set_for_issue() ? If yes, in the interest of avoiding duplication, this code should be moved to a function; any advice on where to put it ? |
9435c1a
to
aee455a
Compare
This is now ready to merge (after #1542). |
Fixes #25961
Fixes #25961
With previous configuration, IssueUpdateTest::testUpdateWithRareFields was not executed.
When creating an issue with non-default status/resolution, check that a single entry is created. Fixes #25962
Dynamically generate an API token for the administrator user to execute the REST API test suite.
Code copied from MantisCoreBase suite. TODO: check if code duplication can be avoided
Update before_script to create 3 version records. This is used by REST tests.
Prior to this, the tests were written to use harcoded version numbers and ids taken from mantisbt.org database. Now we retrieve versions from the database; there must be at least 3 defined versions for the test project.
The assertion is now conditional, based on how $g_allow_no_category is set. This option defaults to OFF, but Travis builds set it to ON to avoid skipping tests in SOAP suite.
Prior to this, date order was set to a hardcoded timestamp. This caused testAddVersion to fail if there were any existing Version records in the database having a more recent date order more recent. To fix the problem, the DATE_ORDER constant has been replaced by a $date_order class property, set to current date/time when the test suite starts.
The following tests have been removed, as they are now covered by the new testCreateIssueWithTagInvalid: - testCreateIssueWithTagNameNotFound - testCreateIssueWithTagIdNotFound
In addition to string (json), it can also be array or object.
The tag should be created together with the issue.
The tag should be attached to the issue.
This also fixes and improves RestIssueAddTest, which were not correct but nobody noticed since they were never executed. Merge PR #1540
Travis CI builds are not executing all of the defined PHPUnit test suites : IssueHistoryTest and REST tests are not executed.
This PR makes changes to both the PHPUnit scripts and the Travis configuration, to ensure all tests are run and we don't have skipped tests either.