Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: mantisbt/mantisbt
base: d784eb7
...
head fork: mantisbt/mantisbt
compare: 6dd19d2
Checking mergeability… Don't worry, you can still create the pull request.
  • 5 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
Commits on Nov 11, 2011
@rombert rombert SOAP Tests: update to use the new date format 9c0d87b
@rombert rombert VersionTest: make tests run against bugtrackers with existing versions b34c7c9
@rombert rombert SOAP tests: centralise the number of issues to retrieve a1e1347
@rombert rombert SOAP filter tests: allow running when issues already exist
These tests assumed that no issues exist in the target repository,
which is not always true. It is more convenient to run against an
existing repository. Also, the tests are enhanced to retrieve a full
page , a partial page and an empty page.
0d437de
@rombert rombert SOAP Tests: use a more predictable option for the preference test
Since the default value for the language has changed between 1.2 and 
1.3 the user preference test is inconsistent across installations. We
now pick the bugnote_order as a less likely preference to be changed.
6dd19d2
View
58 tests/soap/FilterTest.php
@@ -27,6 +27,9 @@
* Test fixture for filter related webservice method.
*/
class FilterTest extends SoapBase {
+
+ const ISSUES_TO_RETRIEVE = 50;
+
/**
* A test case that tests the following:
* 1. Retrieving all the project's issues
@@ -187,26 +190,49 @@ public function testGetProjectIssuesWithoutCategory() {
* Verifies that after the last page no more issues are being returned
*/
public function testGetIssueHeadersPaged() {
-
- $issue = $this->getIssueToAdd('FilterTest.getIssueHeadersPaged');
- $issueId = $this->client->mc_issue_add($this->userName, $this->password, $issue);
- $this->deleteAfterRun($issueId);
-
- self::assertEquals(1, count($this->client->mc_project_get_issue_headers($this->userName, $this->password, $this->getProjectId(),1, 1 )));
- self::assertEquals(0, count($this->client->mc_project_get_issue_headers($this->userName, $this->password, $this->getProjectId(),2, 1 )));
+
+ $this->doTestGetPages('mc_project_get_issue_headers');
+ }
+
+ private function doTestGetPages( $methodName ) {
+
+ $issueCount;
+ $currentIssues = count($this->getProjectIssues());
+ if ( $currentIssues >= 3) {
+ $issueCount = $currentIssues;
+ } else {
+ // need to add
+
+ $issueCount = 3;
+
+ $toAdd = $issueCount - $currentIssues;
+
+ while ( $toAdd > 0 ) {
+
+ $issue = $this->getIssueToAdd('FilterTest.doTestGatePages.' .$methodName);
+ $issueId = $this->client->mc_issue_add($this->userName, $this->password, $issue);
+ $this->deleteAfterRun($issueId);
+
+ $toAdd--;
+ }
+ }
+
+ $pageSize = $issueCount - 1;
+
+ // first page should be full
+ self::assertEquals($pageSize, count(call_user_func_array(array($this->client, $methodName), array($this->userName, $this->password, $this->getProjectId(), 1, $pageSize ))));
+ // second page should get just one issue, as $pageSize = $issueCount - 1;
+ self::assertEquals(1, count(call_user_func_array(array($this->client, $methodName), array($this->userName, $this->password, $this->getProjectId(), 2, $pageSize ))));
+ // third page should be empty
+ self::assertEquals(0, count(call_user_func_array(array($this->client, $methodName), array($this->userName, $this->password, $this->getProjectId(), 3, $pageSize ))));
}
/**
* Verifies that after the last page no more issues are being returned
*/
public function testGetIssuesPaged() {
-
- $issue = $this->getIssueToAdd('FilterTest.getIssuesPaged');
- $issueId = $this->client->mc_issue_add($this->userName, $this->password, $issue);
- $this->deleteAfterRun($issueId);
-
- self::assertEquals(1, count($this->client->mc_project_get_issues($this->userName, $this->password, $this->getProjectId(),1, 1 )));
- self::assertEquals(0, count($this->client->mc_project_get_issues($this->userName, $this->password, $this->getProjectId(),2, 1 )));
+
+ $this->doTestGetPages('mc_project_get_issues');
}
@@ -221,7 +247,7 @@ private function getProjectIssues() {
$this->password,
$this->getProjectId(),
0,
- 50);
+ self::ISSUES_TO_RETRIEVE);
}
/**
@@ -235,6 +261,6 @@ private function getProjectIssueHeaders() {
$this->password,
$this->getProjectId(),
0,
- 50);
+ self::ISSUES_TO_RETRIEVE);
}
}
View
2  tests/soap/IssueAddTest.php
@@ -213,7 +213,7 @@ public function testCreateIssueWithDueDate() {
$this->skipIfDueDateIsNotEnabled();
- $date = '2015-10-29T12:59:14Z';
+ $date = '2015-10-29T12:59:14+00:00';
$issueToAdd = $this->getIssueToAdd( 'IssueAddTest.testCreateIssueWithDueDate' );
View
2  tests/soap/IssueUpdateTest.php
@@ -290,7 +290,7 @@ public function testUpdateIssueWithHandler() {
public function testUpdateIssueDueDate() {
$this->skipIfDueDateIsNotEnabled();
- $date = '2015-10-29T12:59:14Z';
+ $date = '2015-10-29T12:59:14+00:00';
$issueToAdd = $this->getIssueToAdd( 'IssueUpdateTest.testUpdateIssueDueDate' );
View
6 tests/soap/UserTest.php
@@ -33,9 +33,9 @@ class UserTest extends SoapBase {
*/
public function testGetPreference() {
- $language = $this->client->mc_user_pref_get_pref( $this->userName, $this->password, 0 /*ALL_PROJECTS*/, 'language' );
-
- $this->assertEquals( 'english', $language );
+ $bugnote_order = $this->client->mc_user_pref_get_pref( $this->userName, $this->password, 0 /*ALL_PROJECTS*/, 'bugnote_order' );
+
+ $this->assertEquals( 'ASC', $bugnote_order );
}
}
View
22 tests/soap/VersionTest.php
@@ -44,6 +44,8 @@ private function getTestVersion() {
* Tests creating a new version
*/
public function testAddVersion() {
+
+ $initialVersions = $this->countVersions();
$versionId = $this->client->mc_project_version_add($this->userName, $this->password, $this->getTestVersion() );
@@ -53,7 +55,7 @@ public function testAddVersion() {
$versions = $this->client->mc_project_get_versions( $this->userName, $this->password, $this->getProjectId() );
- $this->assertEquals(1, count($versions));
+ $this->assertEquals(1, count($versions) - $initialVersions);
$version = $versions[0];
@@ -70,6 +72,8 @@ public function testAddVersion() {
* Tests updating a version
*/
public function testUpdateVersion() {
+
+ $initialVersions = $this->countVersions();
$versionId = $this->client->mc_project_version_add($this->userName, $this->password, $this->getTestVersion() );
@@ -84,10 +88,20 @@ public function testUpdateVersion() {
$versions = $this->client->mc_project_get_versions( $this->userName, $this->password, $this->getProjectId() );
- $this->assertEquals(1, count($versions));
+ $this->assertEquals(1, count($versions) - $initialVersions);
- $version = $versions[0];
+ foreach ( $versions as $version ) {
+ if ( $version->id == $versionId ) {
+ $this->assertEquals('1.1', $version->name);
+ return;
+ }
+ }
- $this->assertEquals('1.1', $version->name);
+ self::fail('Did not find version with id ' . $versionId . ' in the reply');
+ }
+
+ private function countVersions() {
+
+ return count ( $this->client->mc_project_get_versions( $this->userName, $this->password, $this->getProjectId() ) );
}
}

No commit comments for this range

Something went wrong with that request. Please try again.