Skip to content

Commit

Permalink
Issue #10749: Verify that the data read using the SOAP API has a handler
Browse files Browse the repository at this point in the history
Two new SOAP tests have been added:

- verify that the handler added on issue creation is returned;
- verify that the handler added on issue update is returned.
  • Loading branch information
rombert committed Oct 25, 2009
1 parent 787f3a2 commit bd31d62
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/soap/IssueAddTest.php
Expand Up @@ -173,4 +173,42 @@ public function testCreateIssueWithRareFields() {
$this->password,
$issueId);
}

/**
* This issue tests the following:
* 1. Retrieving all the administrator users, and verifying at least one is present
* 2. Creating an issue with the first admin user as a handler
* 3. Retrieving the issue after it is created
* 4. Verifying that the correct handler is passed
* 5. Deleting the issue
*/
public function testCreateIssueWithHandler() {

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

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

$issueToAdd = $this->getIssueToAdd( 'IssueAddTest.testCreateIssueWithHandler' );

$adminUser = $adminUsers[0];

$issueToAdd['handler'] = $adminUser;

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

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

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

$this->client->mc_issue_delete(
$this->userName,
$this->password,
$issueId);
}
}
50 changes: 50 additions & 0 deletions tests/soap/IssueUpdateTest.php
Expand Up @@ -232,4 +232,54 @@ public function testUpdateWithNewNote() {
$this->password,
$issueId);
}

/**
* This issue tests the following:
* 1. Retrieving all the administrator users, and verifying only one is present
* 2. Creating an issue
* 3. Retrieving the issue after it is created
* 4. Updating the issue to add a handler
* 5. Verifying that the correct handler is passed
* 6. Deleting the issue
*/
public function testUpdateIssueWithHandler() {

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

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

$issueToAdd = $this->getIssueToAdd( 'IssueUpdateTest.testUpdateIssueWithHandler' );

$adminUser = $adminUsers[0];

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

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

$issue->handler = $adminUser;

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

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

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

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

0 comments on commit bd31d62

Please sign in to comment.