View Issue Details

IDProjectCategoryView StatusLast Update
0017121mantisbtapi soappublic2023-10-31 16:32
Reporterdregad Assigned Todregad  
Status closedResolutionfixed 
Target Version2.26.0Fixed in Version2.26.0 
Summary0017121: phpunit FilterTest fail if there are more than 50 issues in the tracker

I was running the phpunit tests against an existing local DB containing other projects, and got the following:

There were 2 failures:

1) FilterTest::testGetAllProjectsIssues
count(projectIssues) - count(initialIssues)
Failed asserting that 0 matches expected 1.


2) FilterTest::testGetAllProjectsIssueHeaders
count(projectIssues) - count(initialIssues)
Failed asserting that 0 matches expected 1.


After research, the failure is caused by limiting the number of issues returned to 50.

I guess that one way to fix this could be to set ISSUES_TO_RETRIEVE = -1 (FilterTest.php line 33) but that may cause problems due to memory usage if there are many records; another would be to retrieve the last page and compute the difference based on that, however this is not easily done as it is currently not possible to get the page count (see 0008656).

Steps To Reproduce

Run phpunit tests in a system having more than 50 bugs in it.

$ phpunit --bootstrap tests/bootstrap.php tests/soap/FilterTest.php

Additional Information

We never encountered this in TravisCI, because we always start from a fresh database.



related to 0008656 confirmed please provide function that return issue count of current filter 


There are no notes attached to this issue.

Related Changesets

MantisBT: master 8129cd02

2023-02-17 19:05


Details Diff
Skip FilterTests if there are too many issues

Some tests can't be completed if there are more Issues in the database
than the maximum number to retrieve (defined in ISSUES_TO_RETRIEVE
constant), because they compare the number of Issues before/after
executing the test, and both lists contain ISSUES_TO_RETRIEVE Issues.

Mark the test case as skipped if getAllProjectsIssues() or getAllProjectsIssueHeaders() return ISSUES_TO_RETRIEVE or more Issues.

Fixes 0017121
Affected Issues
mod - tests/soap/FilterTest.php Diff File

MantisBT: master 49d6e7d2

2023-02-17 19:29


Details Diff
New bootstrap variable MANTIS_TESTSUITE_MAX_ISSUES

This replaces the FilterTest::ISSUES_TO_RETRIEVE constant, allowing a
developer to adjust the number of issues to retrieve when executing
FilterTest cases.

This avoids skipped tests when using a local database with more Issues
than the default of 50 (which works fine for TravisCI tests, that start
with an empty DB).

This is a follow-up fix for Issue 0017121.
Affected Issues
mod - tests/bootstrap.php.sample Diff File
mod - tests/soap/FilterTest.php Diff File
mod - tests/soap/SoapBase.php Diff File