Browse files

soap tests: fix whitespace

  • Loading branch information...
1 parent 9f959b7 commit 2a7951bb2d2e5b4f993e127a3c966a95ed499170 @dregad dregad committed with dregad May 6, 2013
Showing with 106 additions and 106 deletions.
  1. +34 −34 tests/soap/AttachmentTest.php
  2. +72 −72 tests/soap/VersionTest.php
View
68 tests/soap/AttachmentTest.php
@@ -27,10 +27,10 @@
* Test fixture for attachment methods
*/
class AttachmentTest extends SoapBase {
-
-
+
+
private $projectAttachmentsToDelete = array();
-
+
/**
* A test case that tests the following:
* 1. Create an issue.
@@ -41,14 +41,14 @@ class AttachmentTest extends SoapBase {
*/
public function testAttachmentIsAdded() {
$issueToAdd = $this->getIssueToAdd( 'AttachmentTest.testAttachmentIsAdded' );
-
+
$attachmentContents = 'Attachment contents.';
$issueId = $this->client->mc_issue_add(
$this->userName,
$this->password,
$issueToAdd);
-
+
$this->deleteAfterRun( $issueId );
$attachmentId = $this->client->mc_issue_attachment_add(
@@ -59,43 +59,43 @@ public function testAttachmentIsAdded() {
'txt',
base64_encode( $attachmentContents )
);
-
+
$issue = $this->client->mc_issue_get(
$this->userName,
$this->password,
$issueId
);
$attachment = $this->client->mc_issue_attachment_get(
- $this->userName,
- $this->password,
+ $this->userName,
+ $this->password,
$attachmentId);
-
+
$this->assertEquals( 1, count( $issue->attachments ), 'count($issue->attachments)' );
$this->assertEquals( $attachmentContents, base64_decode( $attachment ), '$attachmentContents' );
$this->assertEquals( $this->mantisPath.'file_download.php?file_id='.$issue->attachments[0]->id.'&type=bug', $issue->attachments[0]->download_url);
$this->assertEquals( $this->userId, $issue->attachments[0]->user_id);
}
-
-
+
+
/**
* A test case that tests the following:
* 1. Gets a non-existing issue attachment
* 2. Verifies that that an error is thrown
*/
public function testIssueAttachmentNotFound() {
-
+
try {
$this->client->mc_issue_attachment_get(
- $this->userName,
- $this->password,
+ $this->userName,
+ $this->password,
-1);
$this->fail("Should have failed.");
} catch ( SoapFault $e) {
$this->assertRegexp('/Unable to find an attachment/', $e->getMessage());
}
- }
-
+ }
+
/**
* A test case that tests the following:
* 1. Create an issue.
@@ -106,7 +106,7 @@ public function testIssueAttachmentNotFound() {
*/
public function testProjectAttachmentIsAdded() {
$this->skipIfProjectDocumentationIsNotEnabled();
-
+
$attachmentContents = 'Attachment contents.';
$attachmentId = $this->client->mc_project_attachment_add(
@@ -119,19 +119,19 @@ public function testProjectAttachmentIsAdded() {
'txt',
base64_encode( $attachmentContents )
);
-
+
$this->projectAttachmentsToDelete[] = $attachmentId;
$attachment = $this->client->mc_project_attachment_get(
- $this->userName,
- $this->password,
+ $this->userName,
+ $this->password,
$attachmentId);
-
+
$this->assertEquals( $attachmentContents, base64_decode( $attachment ), '$attachmentContents' );
-
+
$attachments = $this->client->mc_project_get_attachments( $this->userName, $this->password, $this->getProjectId() );
$this->assertEquals( 1, count( $attachments ) );
-
+
$attachment = $attachments[0];
$this->assertEquals($this->userId, $attachment->user_id);
$this->assertEquals('description', $attachment->description);
@@ -143,39 +143,39 @@ public function testProjectAttachmentIsAdded() {
* 2. Verifies that an error is thrown
*/
public function testProjectAttachmentNotFound() {
-
+
$this->skipIfProjectDocumentationIsNotEnabled();
-
+
try {
$this->client->mc_project_attachment_get(
- $this->userName,
- $this->password,
+ $this->userName,
+ $this->password,
-1);
$this->fail("Should have failed.");
} catch ( SoapFault $e) {
$this->assertRegexp('/Unable to find an attachment/', $e->getMessage());
}
}
-
+
private function skipIfProjectDocumentationIsNotEnabled() {
-
+
$configEnabled = $this->client->mc_config_get_string( $this->userName, $this->password, 'enable_project_documentation' );
-
+
if ( ! $configEnabled ) {
$this->markTestSkipped('Project documentation is not enabled.');
}
}
-
+
protected function tearDown() {
SoapBase::tearDown();
-
+
foreach ( $this->projectAttachmentsToDelete as $projectAttachmentId ) {
$this->client->mc_project_attachment_delete(
$this->userName,
$this->password,
$projectAttachmentId);
}
}
-
-
+
+
}
View
144 tests/soap/VersionTest.php
@@ -27,84 +27,84 @@
* Test fixture for version methods
*/
class VersionTest extends SoapBase {
-
+
const DATE_ORDER = '2015-10-29T12:59:14+00:00';
- private function getTestVersion() {
+ private function getTestVersion() {
- return array (
+ return array (
'project_id' => $this->getProjectId(),
'name' => '1.0',
'released' => true,
'description' => 'Test version',
- 'obsolete' => false,
- 'date_order'=> self::DATE_ORDER
+ 'obsolete' => false,
+ 'date_order'=> self::DATE_ORDER
);
- }
-
- /**
- * Tests creating a new version
- */
- public function testAddVersion() {
-
- $initialVersions = $this->countVersions();
-
- $versionId = $this->client->mc_project_version_add($this->userName, $this->password, $this->getTestVersion() );
-
- $this->assertNotNull( $versionId );
-
- $this->deleteVersionAfterRun( $versionId );
-
- $versions = $this->client->mc_project_get_versions( $this->userName, $this->password, $this->getProjectId() );
-
- $this->assertEquals(1, count($versions) - $initialVersions);
-
- $version = $versions[0];
-
- $this->assertEquals('1.0', $version->name);
- $this->assertEquals(true, $version->released);
- $this->assertEquals('Test version', $version->description);
- $this->assertEquals($this->getProjectId(), $version->project_id);
- $this->assertEquals(self::DATE_ORDER, $version->date_order);
- $this->assertEquals(false, $version->obsolete);
- }
-
-
- /**
- * Tests updating a version
- */
- public function testUpdateVersion() {
-
- $initialVersions = $this->countVersions();
-
- $versionId = $this->client->mc_project_version_add($this->userName, $this->password, $this->getTestVersion() );
-
- $this->assertNotNull( $versionId );
-
- $this->deleteVersionAfterRun( $versionId );
-
- $updatedVersion = $this->getTestVersion();
- $updatedVersion['name'] = '1.1';
-
- $this->client->mc_project_version_update ( $this->userName, $this->password, $versionId, $updatedVersion );
-
- $versions = $this->client->mc_project_get_versions( $this->userName, $this->password, $this->getProjectId() );
-
- $this->assertEquals(1, count($versions) - $initialVersions);
-
- foreach ( $versions as $version ) {
- if ( $version->id == $versionId ) {
- $this->assertEquals('1.1', $version->name);
- $this->assertEquals(self::DATE_ORDER, $version->date_order);
- return;
- }
- }
-
- 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() ) );
- }
+ }
+
+ /**
+ * Tests creating a new version
+ */
+ public function testAddVersion() {
+
+ $initialVersions = $this->countVersions();
+
+ $versionId = $this->client->mc_project_version_add($this->userName, $this->password, $this->getTestVersion() );
+
+ $this->assertNotNull( $versionId );
+
+ $this->deleteVersionAfterRun( $versionId );
+
+ $versions = $this->client->mc_project_get_versions( $this->userName, $this->password, $this->getProjectId() );
+
+ $this->assertEquals(1, count($versions) - $initialVersions);
+
+ $version = $versions[0];
+
+ $this->assertEquals('1.0', $version->name);
+ $this->assertEquals(true, $version->released);
+ $this->assertEquals('Test version', $version->description);
+ $this->assertEquals($this->getProjectId(), $version->project_id);
+ $this->assertEquals(self::DATE_ORDER, $version->date_order);
+ $this->assertEquals(false, $version->obsolete);
+ }
+
+
+ /**
+ * Tests updating a version
+ */
+ public function testUpdateVersion() {
+
+ $initialVersions = $this->countVersions();
+
+ $versionId = $this->client->mc_project_version_add($this->userName, $this->password, $this->getTestVersion() );
+
+ $this->assertNotNull( $versionId );
+
+ $this->deleteVersionAfterRun( $versionId );
+
+ $updatedVersion = $this->getTestVersion();
+ $updatedVersion['name'] = '1.1';
+
+ $this->client->mc_project_version_update ( $this->userName, $this->password, $versionId, $updatedVersion );
+
+ $versions = $this->client->mc_project_get_versions( $this->userName, $this->password, $this->getProjectId() );
+
+ $this->assertEquals(1, count($versions) - $initialVersions);
+
+ foreach ( $versions as $version ) {
+ if ( $version->id == $versionId ) {
+ $this->assertEquals('1.1', $version->name);
+ $this->assertEquals(self::DATE_ORDER, $version->date_order);
+ return;
+ }
+ }
+
+ 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 2a7951b

Please sign in to comment.