From 6766016e7b77827223a42a4d1693058b5bc78b1f Mon Sep 17 00:00:00 2001
From: Robert Munteanu <robert.munteanu@gmail.com>
Date: Wed, 21 Oct 2009 17:21:37 +0300
Subject: [PATCH 3/3] Added separate testAddNoteWithTimeTracking

The test is skipped if time tracking is not enabled on the server.
---
 tests/soap/IssueNoteTest.php |   56 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/tests/soap/IssueNoteTest.php b/tests/soap/IssueNoteTest.php
index 7a3fba6..b72aec2 100644
--- a/tests/soap/IssueNoteTest.php
+++ b/tests/soap/IssueNoteTest.php
@@ -53,9 +53,9 @@ class IssueNoteTest extends SoapBase {
 			$issueId);
 
 		$noteData = array(
-			'text' => "first note",
+			'text' => "first note"
 		);
-
+		
 		$issueNoteId = $this->client->mc_issue_note_add(
 			$this->userName,
 			$this->password,
@@ -95,6 +95,58 @@ class IssueNoteTest extends SoapBase {
 	/**
 	 * A test case that tests the following:
 	 * 1. Create an issue.
+	 * 2. Add a note to the issue by specifying the text and time_tracking.
+	 * 3. Get the issue.
+	 * 4. Verify the note id against the one returned when adding the note.
+	 * 5. Verify the time_tracking entry
+	 * 6. Delete the issue.
+	 */
+	public function testAddNoteWithTimeTracking() {
+
+		$timeTrackingEnabled = $this->client->mc_config_get_string($this->userName, $this->password, 'time_tracking_enabled');
+		if ( !$timeTrackingEnabled ) {
+			$this->markTestSkipped('Time tracking is not enabled');
+		}
+
+		$issueToAdd = $this->getIssueToAdd( 'IssueNoteTest.testAddNoteWithTimeTracking' );
+
+		$issueId = $this->client->mc_issue_add(
+			$this->userName,
+			$this->password,
+			$issueToAdd);
+
+		$noteData = array(
+			'text' => "first note",
+			'time_tracking' => "30"
+		);
+		
+		$issueNoteId = $this->client->mc_issue_note_add(
+			$this->userName,
+			$this->password,
+			$issueId,
+			$noteData);
+
+		$issueWithNote = $this->client->mc_issue_get(
+			$this->userName,
+			$this->password,
+			$issueId);
+
+		$this->assertEquals( 1, count( $issueWithNote->notes ) );
+
+		$note = $issueWithNote->notes[0];
+		
+		$this->assertEquals( 30, $note->time_tracking );
+
+		$this->client->mc_issue_delete(
+			$this->userName,
+			$this->password,
+			$issueId);
+
+	}
+
+	/**
+	 * A test case that tests the following:
+	 * 1. Create an issue.
 	 * 2. Add a note to the issue.
 	 * 3. Get the issue.
 	 * 4. Verify that the issue has one note.
-- 
1.6.4.2

