Skip to content

Commit

Permalink
All the ability to retrive monitors using mc_issue_get
Browse files Browse the repository at this point in the history
Bug: 8558 ( SOAP API needs ability to Monitor a Task )
  • Loading branch information
rombert committed Feb 13, 2011
1 parent f4cfc07 commit 1cce859
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/soap/mantisconnect.php
Expand Up @@ -283,7 +283,8 @@
'relationships' => array( 'name' => 'relationships', 'type' => 'tns:RelationshipDataArray', 'minOccurs' => '0' ),
'notes' => array( 'name' => 'notes', 'type' => 'tns:IssueNoteDataArray', 'minOccurs' => '0' ),
'custom_fields' => array( 'name' => 'custom_fields', 'type' => 'tns:CustomFieldValueForIssueDataArray', 'minOccurs' => '0' ),
'due_date' => array( 'name' => 'due_date', 'type' => 'xsd:dateTime', 'minOccurs' => '0' )
'due_date' => array( 'name' => 'due_date', 'type' => 'xsd:dateTime', 'minOccurs' => '0' ),
'monitors' => array( 'name' => 'monitors', 'type' => 'AccountDataArray', 'minOccurs' => '0')
)
);

Expand Down
11 changes: 11 additions & 0 deletions api/soap/mc_account_api.php
Expand Up @@ -26,3 +26,14 @@ function mci_account_get_array_by_id( $p_user_id ) {
}
return $t_result;
}

function mci_account_get_array_by_ids ( $p_user_ids ) {

$t_result = array();

foreach ( $p_user_ids as $t_user_id ) {
$t_result[] = mci_account_get_array_by_id( $t_user_id );
}

return $t_result;
}
1 change: 1 addition & 0 deletions api/soap/mc_issue_api.php
Expand Up @@ -110,6 +110,7 @@ function mc_issue_get( $p_username, $p_password, $p_issue_id ) {
$t_issue_data['relationships'] = mci_issue_get_relationships( $p_issue_id, $t_user_id );
$t_issue_data['notes'] = mci_issue_get_notes( $p_issue_id );
$t_issue_data['custom_fields'] = mci_issue_get_custom_fields( $p_issue_id );
$t_issue_data['monitors'] = mci_account_get_array_by_ids( bug_get_monitors ( $p_issue_id ) );

return $t_issue_data;
}
Expand Down
54 changes: 54 additions & 0 deletions tests/soap/IssueMonitorTest.php
@@ -0,0 +1,54 @@
<?php
# MantisBT - a php based bugtracking system

# MantisBT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT. If not, see <http://www.gnu.org/licenses/>.

/**
* @package Tests
* @subpackage UnitTests
* @copyright Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net
* @link http://www.mantisbt.org
*/

require_once 'SoapBase.php';

/**
* Test fixture for issue monitoring webservice methods.
*/
class IssueMonitorTest extends SoapBase {
/**
* A test case that tests the following:
* 1. Creates a new issue
* 2. validates that the monitor list is empty
*/
public function testCreateIssueHasEmptyMonitorList() {

$issueToAdd = $this->getIssueToAdd( 'IssueMonitorTest.testCreateIssueHasEmptyMonitorList' );

$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);

// no monitors on new issue
$this->assertEquals(0, sizeof($issue->monitors));
}
}

0 comments on commit 1cce859

Please sign in to comment.