| [ 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 filter related webservice method. 28 */ 29 class FilterTest extends SoapBase { 30 /** 31 * A test case that tests the following: 32 * 1. Retrieving all the project's issues 33 * 2. Creating an issue 34 * 3. Retrieving all the project's issues 35 * 4. Verifying that one extra issue is found in the results 36 * 5. Verifying that the first returned issue is the one we have submitted 37 */ 38 public function testGetProjectIssues() { 39 40 $initialIssues = $this->getProjectIssues(); 41 42 $issueToAdd = $this->getIssueToAdd( 'FilterTest.getProjectIssues' ); 43 44 $issueId = $this->client->mc_issue_add( 45 $this->userName, 46 $this->password, 47 $issueToAdd); 48 49 $this->deleteAfterRun( $issueId ); 50 51 $projectIssues = $this->getProjectIssues(); 52 53 $this->assertEquals( 1, count( $projectIssues ) - count( $initialIssues ), "count(projectIssues) - count(initialIssues)"); 54 $this->assertEquals( $issueId, $projectIssues[0]->id, "issueId"); 55 } 56 57 /** 58 * A test case that tests the following: 59 * 1. Retrieving all the project's issue headers 60 * 2. Creating an issue 61 * 3. Retrieving all the project's issue headers 62 * 4. Verifying that one extra issue is found in the results 63 * 5. Verifying that the first returned issue is the one we have submitted 64 */ 65 public function testGetProjectIssueHeaders() { 66 67 $initialIssues = $this->getProjectIssueHeaders(); 68 69 $issueToAdd = $this->getIssueToAdd( 'FilterTest.getProjectIssues' ); 70 71 $issueId = $this->client->mc_issue_add( 72 $this->userName, 73 $this->password, 74 $issueToAdd); 75 76 $this->deleteAfterRun( $issueId ); 77 78 $projectIssues = $this->getProjectIssueHeaders(); 79 80 $this->assertEquals( 1, count( $projectIssues ) - count( $initialIssues ), "count(projectIssues) - count(initialIssues)" ); 81 $this->assertEquals( $issueId, $projectIssues[0]->id, "issueId" ); 82 } 83 84 /** 85 * A test case that tests the following: 86 * 1. Retrieving all the project's issue headers 87 * 2. Creating an issue 88 * 3. Retrieving the issue 89 * 4. Creating 3 notes for that issue 90 * 5. Retrieving all the project's issue headers 91 * 7. Verifying that the first returned issue has 3 notes 92 */ 93 public function testGetProjectIssueHeadersCountNotes() { 94 95 $initialIssues = $this->getProjectIssueHeaders(); 96 97 $issueToAdd = $this->getIssueToAdd( 'FilterTest.getProjectIssues' ); 98 99 $issueId = $this->client->mc_issue_add( 100 $this->userName, 101 $this->password, 102 $issueToAdd); 103 104 $this->deleteAfterRun( $issueId ); 105 106 $issue = $this->client->mc_issue_get( 107 $this->userName, 108 $this->password, 109 $issueId); 110 111 $note = array( 112 'text' => 'Note text.' 113 ); 114 115 $noteCount = 3; 116 117 for ( $i = 0 ; $i < $noteCount ; $i++) { 118 $this->client->mc_issue_note_add( 119 $this->userName, 120 $this->password, 121 $issueId, 122 $note); 123 } 124 125 $projectIssues = $this->getProjectIssueHeaders(); 126 127 $this->assertEquals( 3, $projectIssues[0]->notes_count, "notes_count" ); 128 } 129 130 131 /** 132 * A test case that tests the following: 133 * 1. Retrieving all the project's issues 134 * 2. Creating an issue with status = closed and resolution = fixed 135 * 3. Retrieving all the project's issues 136 * 4. Verifying that one extra issue is found in the results 137 */ 138 public function testGetProjectClosedIssues() { 139 140 $initialIssues = $this->getProjectIssues(); 141 142 $issueToAdd = $this->getIssueToAdd( 'FilterTest.testGetProjectClosedIssues' ); 143 $issueToAdd['status'] = 'closed'; 144 $issueToAdd['resolution'] = 'fixed'; 145 146 $issueId = $this->client->mc_issue_add( 147 $this->userName, 148 $this->password, 149 $issueToAdd); 150 151 $this->deleteAfterRun( $issueId ); 152 153 $projectIssues = $this->getProjectIssues(); 154 155 $this->assertEquals( 1, count( $projectIssues ) - count( $initialIssues ), "count(projectIssues) - count(initialIssues)"); 156 } 157 158 /** 159 * A test case that tests the following: 160 * 161 * 1. Creating an issue with a category 162 * 2. Retrieving all the project's issues 163 * 3. Verifying that the created issue is present in the retrieved issues 164 * 165 * Test created to verify issue #11609 166 */ 167 public function testGetProjectIssuesWithoutCategory() { 168 169 $this->skipIfAllowNoCategoryIsDisabled(); 170 171 $issueToAdd = $this->getIssueToAdd( 'IssueAddTest.testCreateBugWithNoCategory' ); 172 unset ( $issueToAdd['category'] ); 173 174 $issueId = $this->client->mc_issue_add( 175 $this->userName, 176 $this->password, 177 $issueToAdd); 178 179 $this->deleteAfterRun( $issueId ); 180 181 $projectIssues = $this->getProjectIssues(); 182 183 $this->assertEquals( $issueId, $projectIssues[0]->id, "id" ); 184 } 185 186 /** 187 * Verifies that after the last page no more issues are being returned 188 */ 189 public function testGetIssueHeadersPaged() { 190 191 $issue = $this->getIssueToAdd('FilterTest.getIssueHeadersPaged'); 192 $issueId = $this->client->mc_issue_add($this->userName, $this->password, $issue); 193 $this->deleteAfterRun($issueId); 194 195 self::assertEquals(1, count($this->client->mc_project_get_issue_headers($this->userName, $this->password, $this->getProjectId(),1, 1 ))); 196 self::assertEquals(0, count($this->client->mc_project_get_issue_headers($this->userName, $this->password, $this->getProjectId(),2, 1 ))); 197 } 198 199 /** 200 * Verifies that after the last page no more issues are being returned 201 */ 202 public function testGetIssuesPaged() { 203 204 $issue = $this->getIssueToAdd('FilterTest.getIssuesPaged'); 205 $issueId = $this->client->mc_issue_add($this->userName, $this->password, $issue); 206 $this->deleteAfterRun($issueId); 207 208 self::assertEquals(1, count($this->client->mc_project_get_issues($this->userName, $this->password, $this->getProjectId(),1, 1 ))); 209 self::assertEquals(0, count($this->client->mc_project_get_issues($this->userName, $this->password, $this->getProjectId(),2, 1 ))); 210 } 211 212 213 /** 214 * 215 * @return Array the project issues 216 */ 217 private function getProjectIssues() { 218 219 return $this->client->mc_project_get_issues( 220 $this->userName, 221 $this->password, 222 $this->getProjectId(), 223 0, 224 50); 225 } 226 227 /** 228 * 229 * @return Array the project issues 230 */ 231 private function getProjectIssueHeaders() { 232 233 return $this->client->mc_project_get_issue_headers( 234 $this->userName, 235 $this->password, 236 $this->getProjectId(), 237 0, 238 50); 239 } 240 }
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 |