Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mantisbt/mantisbt
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: fd8b2f0
Choose a base ref
...
head repository: mantisbt/mantisbt
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 8c78051
Choose a head ref
  • 5 commits
  • 5 files changed
  • 1 contributor

Commits on Nov 11, 2011

  1. 5

    Verified

    This commit was signed with the committer’s verified signature.
    jtojnar Jan Tojnar
    Copy the full SHA
    6cd4123 View commit details
  2. Verified

    This commit was signed with the committer’s verified signature.
    jtojnar Jan Tojnar
    Copy the full SHA
    f5c2fb4 View commit details
  3. Verified

    This commit was signed with the committer’s verified signature.
    jtojnar Jan Tojnar
    Copy the full SHA
    64601e6 View commit details
  4. 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.
    rombert committed Nov 11, 2011

    Verified

    This commit was signed with the committer’s verified signature.
    jtojnar Jan Tojnar
    Copy the full SHA
    618f512 View commit details
  5. 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.
    rombert committed Nov 11, 2011

    Verified

    This commit was signed with the committer’s verified signature.
    jtojnar Jan Tojnar
    Copy the full SHA
    8c78051 View commit details
Showing with 171 additions and 131 deletions.
  1. +42 −16 tests/soap/FilterTest.php
  2. +54 −54 tests/soap/IssueAddTest.php
  3. +54 −54 tests/soap/IssueUpdateTest.php
  4. +3 −3 tests/soap/UserTest.php
  5. +18 −4 tests/soap/VersionTest.php
58 changes: 42 additions & 16 deletions tests/soap/FilterTest.php
Original file line number Diff line number Diff line change
@@ -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);
}
}
108 changes: 54 additions & 54 deletions tests/soap/IssueAddTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
# MantisBT - A PHP based bugtracking system
# MantisBT - a php based bugtracking system

# MantisBT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ class IssueAddTest extends SoapBase {
* 1. Ability to create an issue with only the mandatory parameters.
* 2. mc_issue_get_biggest_id()
* 3. mc_issue_get_id_from_summary()
* 4. The defaulting of the non-mandatory parameters.
* 4. The defaulting of the non-mandatory parameters.
*/
public function testCreateIssue() {
$issueToAdd = $this->getIssueToAdd( 'IssueAddTest.testCreateIssue' );
@@ -41,7 +41,7 @@ public function testCreateIssue() {
$this->userName,
$this->password,
$issueToAdd);

$this->deleteAfterRun( $issueId );

$issueExists = $this->client->mc_issue_exists(
@@ -106,14 +106,14 @@ public function testCreateIssue() {
public function testCreateIssueWithHtmlMarkup() {
$issueToAdd = $this->getIssueToAdd( 'IssueAddTest.testCreateIssueWithHtmlMarkup' );

$issueToAdd['summary'] .= " <strong>WithHtmlMarkup</strong>";
$issueToAdd['description'] .= " <strong>WithHtmlMarkup</strong>";
$issueToAdd['summary'] .= " <b>WithHtmlMarkup</b>";
$issueToAdd['description'] .= " <b>WithHtmlMarkup</b>";

$issueId = $this->client->mc_issue_add(
$this->userName,
$this->password,
$issueToAdd);

$this->deleteAfterRun( $issueId );

$issue = $this->client->mc_issue_get(
@@ -126,14 +126,14 @@ public function testCreateIssueWithHtmlMarkup() {
$this->assertEquals( $issueToAdd['description'], $issue->description );

}

/**
* This issue tests the following:
* 1. Creating an issue with some fields that are typically not used at creation time.
* For example: projection, eta, resolution, status, fixed_in_version, and target_version.
* 2. Get the issue and confirm that all fields are set as expected.
* 3. Delete the issue.
*
*
* This test case was added for bug #9132.
*/
public function testCreateIssueWithRareFields() {
@@ -150,7 +150,7 @@ public function testCreateIssueWithRareFields() {
$this->userName,
$this->password,
$issueToAdd);

$this->deleteAfterRun( $issueId );

$issue = $this->client->mc_issue_get(
@@ -177,7 +177,7 @@ public function testCreateIssueWithRareFields() {
*/
public function testCreateIssueWithHandler() {

$adminUsers = $this->client->mc_project_get_users($this->userName, $this->password, $this->getProjectId(), 90);
$adminUsers = $this->client->mc_project_get_users($this->userName, $this->password, $this->getProjectId(), 90);

$this->assertTrue(count($adminUsers) >= 1 , "count(adminUsers) >= 1");

@@ -191,7 +191,7 @@ public function testCreateIssueWithHandler() {
$this->userName,
$this->password,
$issueToAdd);

$this->deleteAfterRun( $issueId );

$issue = $this->client->mc_issue_get(
@@ -201,112 +201,112 @@ public function testCreateIssueWithHandler() {

$this->assertEquals( $adminUser->id, $issue->handler->id, 'handler.id' );
}

/**
* This issue tests the following
*
*
* 1. Creating an issue with a due date
* 2. Retrieving the issue
* 3. Validating that the due date is properly set
*/
public function testCreateIssueWithDueDate() {

$this->skipIfDueDateIsNotEnabled();

$date = '2015-10-29T12:59:14Z';

$date = '2015-10-29T12:59:14+00:00';
$issueToAdd = $this->getIssueToAdd( 'IssueAddTest.testCreateIssueWithDueDate' );

$issueToAdd['due_date'] = $date;

$issueId = $this->client->mc_issue_add(
$this->userName,
$this->password,
$issueToAdd);

$this->deleteAfterRun( $issueId );
$this->deleteAfterRun( $issueId );

$issue = $this->client->mc_issue_get(
$this->userName,
$this->password,
$issueId);


$this->assertEquals( $date, $issue->due_date, "due_date");
}

/**
* This issue tests the following
*
*
* 1. Creating an issue without a due date
* 2. Retrieving the issue
* 3. Validating that the due date is properly encoded as null
*
*
* This stricter verification originates in some SOAP frameworks, notably
* Axis, not accepting the empty tag format sent by nusoap by default, which
* is accepted by the PHP5 SOAP extension nevertheless.
*/
public function testCreateIssueWithNullDueDate() {
$issueToAdd = $this->getIssueToAdd( 'IssueAddTest.testCreateIssueWithNullDueDate' );

$issueId = $this->client->mc_issue_add(
$this->userName,
$this->password,
$issueToAdd);

$this->deleteAfterRun( $issueId );
$this->deleteAfterRun( $issueId );

$issue = $this->client->mc_issue_get(
$this->userName,
$this->password,
$issueId);

$this->assertNull( $issue->due_date , 'due_date is not null' );
$this->assertEquals( 'true', $this->readDueDate( $this->client->__getLastResponse() ) , 'xsi:nil not set to true' );
}

/**
* This issue tests the following
*
*
* 1. Creating an issue with no category
* 2. Retrieving the issue
* 3. Verifying that the category is empty.
*
*
*/
public function testCreateBugWithNoCategory() {
$this->skipIfAllowNoCategoryIsDisabled();

$issueToAdd = $this->getIssueToAdd( 'IssueAddTest.testCreateBugWithNoCategory' );
unset ( $issueToAdd['category'] );

$issueId = $this->client->mc_issue_add(
$this->userName,
$this->password,
$issueToAdd);

$this->deleteAfterRun( $issueId );
$this->deleteAfterRun( $issueId );

$issue = $this->client->mc_issue_get(
$this->userName,
$this->password,
$issueId);

$this->assertEquals( '', $issue->category, 'category' );

}

/**
*
*
* @param string $issueDataXml
* @return string the xsi:null value
*/
private function readDueDate( $issueDataXml ) {
$reader = new XMLReader();
$reader = new XMLReader();
$reader->XML( $this->client->__getLastResponse());

while ( $reader->read() ) {
switch ( $reader->nodeType ) {

case XMLReader::ELEMENT:
if ( $reader->name == 'due_date') {
return $reader->getAttribute( 'xsi:nil' );
@@ -316,15 +316,15 @@ private function readDueDate( $issueDataXml ) {
}
return null;
}

/**
* A test cases that tests the creation of issues
* A test cases that tests the creation of issues
* with a note passed in which contains time tracking data.
*/
public function testCreateIssueWithTimeTrackingNote() {

$this->skipIfTimeTrackingIsNotEnabled();

$issueToAdd = $this->getIssueToAdd( 'testCreateIssueWithNote' );
$issueToAdd['notes'] = array(
array(
@@ -347,24 +347,24 @@ public function testCreateIssueWithTimeTrackingNote() {
$this->assertEquals( 1, count( $issue->notes ) );

$note = $issue->notes[0];

$this->assertEquals( 30, $note->time_tracking );

$this->client->mc_issue_delete(
$this->userName,
$this->password,
$issueId);
}

/**
* This issue tests the following
*
*
* 1. Creating an issue where the handler is given by name
* 2. Retrieving the issue
* 3. Verifying that the handler name is correctly set
*/
public function testCreateIssueWithHandlerByName() {

$issueToAdd = $this->getIssueToAdd( 'testCreateIssueWithHandlerByName' );
$issueToAdd['handler'] = array(
'name' => $this->userName
@@ -374,7 +374,7 @@ public function testCreateIssueWithHandlerByName() {
$this->userName,
$this->password,
$issueToAdd);

$this->deleteAfterRun( $issueId );

$issue = $this->client->mc_issue_get(
Loading