| [ Index ] |
PHP Cross Reference of MantisBT |
[Summary view] [Print] [Text view]
1 <?php 2 # MantisBT - a php based bugtracking system 3 4 # MantisBT is free software: you can redistribute it and/or modify 5 # it under the terms of the GNU General Public License as published by 6 # the Free Software Foundation, either version 2 of the License, or 7 # (at your option) any later version. 8 # 9 # MantisBT is distributed in the hope that it will be useful, 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 # GNU General Public License for more details. 13 # 14 # You should have received a copy of the GNU General Public License 15 # along with MantisBT. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * @package Tests 19 * @subpackage UnitTests 20 * @copyright Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net 21 * @link http://www.mantisbt.org 22 */ 23 24 require_once 'SoapBase.php'; 25 26 /** 27 * Test fixture for issue relationships 28 */ 29 class RelationshipTest extends SoapBase { 30 31 /** 32 * Creates two issues and adds a relationship between them 33 */ 34 public function testCreateIssuesAndAddRelation() { 35 36 $firstIssue = $this->getIssueToAdd( 'RelationshipTest.testCreateIssueAndAddRelation1' ); 37 38 $firstIssueId = $this->client->mc_issue_add( $this->userName, $this->password, $firstIssue); 39 40 $this->deleteAfterRun( $firstIssueId ); 41 42 $secondIssue = $this->getIssueToAdd( 'RelationshipTest.testCreateIssueAndAddRelation2' ); 43 44 $secondIssueId = $this->client->mc_issue_add( $this->userName, $this->password, $secondIssue); 45 46 $this->deleteAfterRun( $secondIssueId ); 47 48 $relationship = array ( 49 'type' => array ( 50 'id' => 0 # BUG_DUPLICATE 51 ), 52 'target_id' => $secondIssueId 53 ); 54 55 $this->client->mc_issue_relationship_add( $this->userName, $this->password, $firstIssueId, $relationship ); 56 57 $retrievedFirstIssue = $this->client->mc_issue_get($this->userName, $this->password, $firstIssueId); 58 $retrievedSecondIssue = $this->client->mc_issue_get($this->userName, $this->password, $secondIssueId); 59 60 $this->assertEquals(1, count ( $retrievedFirstIssue->relationships) ); 61 62 $firstRelationship = $retrievedFirstIssue->relationships[0]; 63 $this->assertEquals($secondIssueId, $firstRelationship->target_id); 64 $this->assertEquals(0, $firstRelationship->type->id); 65 66 $this->assertEquals(1, count ( $retrievedSecondIssue->relationships) ); 67 $secondRelationship = $retrievedSecondIssue->relationships[0]; 68 $this->assertEquals($firstIssueId, $secondRelationship->target_id); 69 $this->assertEquals(4, $secondRelationship->type->id); # BUG_HAS_DUPLICATE 70 } 71 72 /** 73 * Creates two issues, adds and then deletes a relationship between them 74 */ 75 public function testDeleteRelation() { 76 77 $firstIssue = $this->getIssueToAdd( 'RelationshipTest.testCreateIssueAndAddRelation1' ); 78 79 $firstIssueId = $this->client->mc_issue_add( $this->userName, $this->password, $firstIssue); 80 81 $this->deleteAfterRun( $firstIssueId ); 82 83 $secondIssue = $this->getIssueToAdd( 'RelationshipTest.testCreateIssueAndAddRelation2' ); 84 85 $secondIssueId = $this->client->mc_issue_add( $this->userName, $this->password, $secondIssue); 86 87 $this->deleteAfterRun( $secondIssueId ); 88 89 $relationship = array ( 90 'type' => array ( 91 'id' => 0 # BUG_DUPLICATE 92 ), 93 'target_id' => $secondIssueId 94 ); 95 96 $relationshipId = $this->client->mc_issue_relationship_add( $this->userName, $this->password, $firstIssueId, $relationship ); 97 $this->client->mc_issue_relationship_delete ( $this->userName, $this->password, $firstIssueId, $relationshipId); 98 99 $retrievedFirstIssue = $this->client->mc_issue_get($this->userName, $this->password, $firstIssueId); 100 $retrievedSecondIssue = $this->client->mc_issue_get($this->userName, $this->password, $secondIssueId); 101 102 $this->assertObjectNotHasAttribute('relationships', $retrievedFirstIssue); 103 $this->assertObjectNotHasAttribute('relationships', $retrievedSecondIssue); 104 } 105 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Jul 28 15:48:31 2011 | Cross-referenced by PHPXref 0.7 |