Skip to content

Commit

Permalink
VersionTest: make tests run against bugtrackers with existing versions
Browse files Browse the repository at this point in the history
  • Loading branch information
rombert committed Nov 11, 2011
1 parent 9c0d87b commit b34c7c9
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions tests/soap/VersionTest.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ private function getTestVersion() {
* Tests creating a new version * Tests creating a new version
*/ */
public function testAddVersion() { public function testAddVersion() {

$initialVersions = $this->countVersions();


$versionId = $this->client->mc_project_version_add($this->userName, $this->password, $this->getTestVersion() ); $versionId = $this->client->mc_project_version_add($this->userName, $this->password, $this->getTestVersion() );


Expand All @@ -53,7 +55,7 @@ public function testAddVersion() {


$versions = $this->client->mc_project_get_versions( $this->userName, $this->password, $this->getProjectId() ); $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]; $version = $versions[0];


Expand All @@ -70,6 +72,8 @@ public function testAddVersion() {
* Tests updating a version * Tests updating a version
*/ */
public function testUpdateVersion() { public function testUpdateVersion() {

$initialVersions = $this->countVersions();


$versionId = $this->client->mc_project_version_add($this->userName, $this->password, $this->getTestVersion() ); $versionId = $this->client->mc_project_version_add($this->userName, $this->password, $this->getTestVersion() );


Expand All @@ -84,10 +88,20 @@ public function testUpdateVersion() {


$versions = $this->client->mc_project_get_versions( $this->userName, $this->password, $this->getProjectId() ); $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() ) );
} }
} }

0 comments on commit b34c7c9

Please sign in to comment.