View Issue Details

IDProjectCategoryView StatusLast Update
0010749mantisbtapi soappublic2010-02-22 14:34
Reportertobar Assigned Torombert  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionno change required 
Product Version1.2.0rc1 
Target Version1.2.0Fixed in Version1.2.0 
Summary0010749: issue data get through soap api has not handler_id field
Description

the value of handler_id field is null

Additional Information

possible solution:

mantisbt-1.2.0rc1\api\soap\mc_issue_api.php

line 88

if( !empty( $t_bug->handler_id ) ) {

change to
if( !isset( $t_bug->handler_id ) ) {

Tagspatch
Attached Files
0001-Issue-10749-Verify-that-the-data-read-using-the-SOAP.patch (1,768 bytes)   
From 7ccd1ebb8ee69158b03d41b3379ac7c94f2af280 Mon Sep 17 00:00:00 2001
From: Robert Munteanu <robert.munteanu@gmail.com>
Date: Thu, 22 Oct 2009 22:42:22 +0300
Subject: [PATCH] Issue #10749: Verify that the data read using the SOAP API has a handler

---
 tests/soap/IssueAddTest.php |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/tests/soap/IssueAddTest.php b/tests/soap/IssueAddTest.php
index a062136..00482b1 100644
--- a/tests/soap/IssueAddTest.php
+++ b/tests/soap/IssueAddTest.php
@@ -173,4 +173,42 @@ class IssueAddTest extends SoapBase {
 			$this->password,
 			$issueId);
 	}
+
+	/**
+	 * This issue tests the following:
+	 * 1. Retrieving all the adminstrator users, and verifying only one is present
+	 * 2. Creating an issue with the 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->assertEquals( 1, count($adminUsers), 'count(adminUsers)' );
+
+		$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);
+	}
 }
-- 
1.6.4.2

Activities

dim

dim

2009-10-08 06:28

reporter   ~0023100

Last edited: 2009-10-08 08:48

Your code is not running.

the if statement can be removed

mantisbt-1.2.0rc1\api\soap\mc_issue_api.php

Line 88 remove if(isset( $t_bug->handler_id )) {
Line 90 remove }

the same issue is on other files:
mantisbt-1.2.0rc1\api\soap\mc_filter_api.php

Line 97 remove if(!empty( $t_issue_data->handler_id )) {
Line 99 remove }

Line 176 remove if(!empty( $t_issue_data->handler_id )) {
Line 178 remove }

mantisbt-1.2.0rc1\api\soap\mc_project_api.php

Line 54 remove if(!empty( $t_issue_data->handler_id )) {
Line 56 remove }

Line 735 remove if(!empty( $t_issue_data['handler_id'])) {
Line 737 remove }

rombert

rombert

2009-10-22 15:49

reporter   ~0023284

The attached SOAP test verifies that the handler is passed in. Are you sure that there is indeed an error?

vboctor

vboctor

2009-10-23 00:09

manager   ~0023289

@rombert, if we end up closing the issue as no-repro we should still checkin the test case. I've a minor comment thought, the assert for the number of admins should be to make sure that there is at least 1, rather than exactly equal to 1.

rombert

rombert

2009-10-23 05:52

reporter   ~0023294

I'll update the test case and I'll add another test, for update. Probably going to send a pull request in 3-4 days.

rombert

rombert

2009-10-25 12:27

reporter   ~0023312

The following changes since commit e6bc4638aa54ea8e04742b9171dc65a4ae0e3852:
Victor Boctor (1):
Fixes 0011045: Display of attached files.

are available in the git repository at:

git://github.com/rombert/mantisbt.git soap_empty_handler_id

Robert Munteanu (1):
Issue 0010749: Verify that the data read using the SOAP API has a handler

tests/soap/IssueAddTest.php | 38 ++++++++++++++++++++++++++++++
tests/soap/IssueUpdateTest.php | 50 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 88 insertions(+), 0 deletions(-)

rombert

rombert

2009-10-25 12:28

reporter   ~0023313

@tobar or anyone else seeing this - perhaps my test cases are mistaken.

Please provide a workflow which does not retrieve the handler_id. This does not have to be a PHPUnit test, just describe the steps you're taking.

rombert

rombert

2009-10-30 06:16

reporter   ~0023484

Resolving since tests show that the functionality exists.

Related Changesets

MantisBT: master-1.2.x 1146ee66

2009-10-22 15:42

rombert


Details Diff
Issue 0010749: Verify that the data read using the SOAP API has a handler

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.
Affected Issues
0010749
mod - tests/soap/IssueAddTest.php Diff File
mod - tests/soap/IssueUpdateTest.php Diff File

MantisBT: master bd31d62a

2009-10-22 15:42

rombert


Details Diff
Issue 0010749: Verify that the data read using the SOAP API has a handler

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.
Affected Issues
0010749
mod - tests/soap/IssueAddTest.php Diff File
mod - tests/soap/IssueUpdateTest.php Diff File