Skip to content

Commit

Permalink
Add a test to verify that the monitor list is not changed on empty up…
Browse files Browse the repository at this point in the history
…date

Bug: 8558 ( SOAP API needs ability to Monitor a Task )
  • Loading branch information
rombert committed Feb 13, 2011
1 parent f6a79e3 commit 19cda76
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions tests/soap/IssueMonitorTest.php
Expand Up @@ -127,4 +127,74 @@ public function testAddMonitorToExistingIssue() {
self::assertEquals( $this->userId, $monitor->id );
self::assertEquals( $this->userName, $monitor->name );
}

/**
* A test case that tests the following
*
* 1. Creates a new issue with a monitor
* 2. Retrieves the issue
* 3. Updates the monitor list to be empty
* 4. Retrieves the issue and verifies that the monitors list is empty
*/
public function testRemoveMonitor() {

$issueToAdd = $this->getIssueToAdd( 'IssueMonitorTest.testAddRemoveMonitorFromIssue' );
$issueToAdd['monitors'] = array(
array ('id' => $this->userId )
);

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

$this->deleteAfterRun( $issueId );

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

$issue->monitors = array();

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

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

self::assertEquals(0, sizeof($issue->monitors));
}

/**
* A test case that tests the following
*
* 1. Creates a new issue with a monitor
* 2. Retrieves the issue
* 3. Updates the issue ( no actual changes )
* 4. Retrieves the issue and verifies that the monitors list is unchanged
*/
public function testUpdateKeepsMonitor() {

$issueToAdd = $this->getIssueToAdd( 'IssueMonitorTest.testUpdateKeepsMonitor' );
$issueToAdd['monitors'] = array(
array ('id' => $this->userId )
);

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

$this->deleteAfterRun( $issueId );

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

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

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

self::assertEquals(1, sizeof($issue->monitors));
}
}

0 comments on commit 19cda76

Please sign in to comment.