| [ 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) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org 21 * @copyright Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net 22 * @link http://www.mantisbt.org 23 */ 24 25 require_once 'PHPUnit/Framework.php'; 26 27 $t_root_path = dirname( dirname( dirname( __FILE__ ) ) ) . DIRECTORY_SEPARATOR; 28 29 /** 30 * Test cases for SoapEnum class. 31 */ 32 class SoapBase extends PHPUnit_Framework_TestCase { 33 protected $client; 34 protected $userName = 'administrator'; 35 protected $password = 'root'; 36 protected $userId = '1'; 37 38 protected $mantisPath; 39 private $issueIdsToDelete = array(); 40 private $versionIdsToDelete = array(); 41 private $defaultSoapClientOptions = array( 'trace' => true, 42 'exceptions' => true, 43 'cache_wsdl' => WSDL_CACHE_NONE, 44 'trace' => true 45 ); 46 47 protected function setUp() 48 { 49 if (!isset($GLOBALS['MANTIS_TESTSUITE_SOAP_ENABLED']) || 50 !$GLOBALS['MANTIS_TESTSUITE_SOAP_ENABLED']) { 51 $this->markTestSkipped( 'The Soap tests are disabled.' ); 52 } 53 54 $this->client = new 55 SoapClient( 56 $GLOBALS['MANTIS_TESTSUITE_SOAP_HOST'], 57 array_merge($this->defaultSoapClientOptions, $this->extraSoapClientFlags() 58 ) 59 ); 60 61 $this->mantisPath = substr($GLOBALS['MANTIS_TESTSUITE_SOAP_HOST'], 0, -strlen('api/soap/mantisconnect.php?wsdl')); 62 } 63 64 /** 65 * @return an array of extra options to be passed to the SoapClient constructor 66 */ 67 protected function extraSoapClientFlags() { 68 69 return array(); 70 } 71 72 protected function tearDown() { 73 74 foreach ( $this->versionIdsToDelete as $versionIdToDelete ) { 75 $this->client->mc_project_version_delete($this->userName, $this->password, $versionIdToDelete); 76 } 77 78 foreach ( $this->issueIdsToDelete as $issueIdToDelete ) { 79 $this->client->mc_issue_delete( 80 $this->userName, 81 $this->password, 82 $issueIdToDelete); 83 } 84 } 85 86 protected function getProjectId() { 87 return 1; 88 } 89 90 protected function getCategory() { 91 return 'General'; 92 } 93 94 protected function skipIfTimeTrackingIsNotEnabled() { 95 96 $timeTrackingEnabled = $this->client->mc_config_get_string($this->userName, $this->password, 'time_tracking_enabled'); 97 if ( !$timeTrackingEnabled ) { 98 $this->markTestSkipped('Time tracking is not enabled'); 99 } 100 } 101 102 protected function getIssueToAdd( $testCase ) { 103 return array( 104 'summary' => $testCase . ': test issue: ' . rand(1, 1000000), 105 'description' => 'description of test issue.', 106 'project' => array( 'id' => $this->getProjectId() ), 107 'category' => $this->getCategory() ); 108 } 109 110 /** 111 * Registers an issue for deletion after the test method has run 112 * 113 * @param int $issueId 114 * @return void 115 */ 116 protected function deleteAfterRun( $issueId ) { 117 118 $this->issueIdsToDelete[] = $issueId; 119 } 120 121 /** 122 * Registers an version for deletion after the test method has run 123 * 124 * @param int $versionId 125 * @return void 126 */ 127 protected function deleteVersionAfterRun( $versionId ) { 128 129 $this->versionIdsToDelete[] = $versionId; 130 } 131 132 protected function skipIfDueDateIsNotEnabled() { 133 134 if ( $this->client->mc_config_get_string( $this->userName, $this->password, 'due_date_view_threshold' ) > 90 || 135 $this->client->mc_config_get_string( $this->userName, $this->password, 'due_date_update_threshold' ) > 90 ) { 136 $this->markTestSkipped('Due date thresholds are too high.'); 137 } 138 } 139 140 protected function skipIfAllowNoCategoryIsDisabled() { 141 if ( $this->client->mc_config_get_string($this->userName, $this->password, 'allow_no_category' ) != true ) { 142 $this->markTestSkipped( 'g_allow_no_category is not ON.' ); 143 } 144 } 145 146 protected function skipIsZlibIsNotAvailable() { 147 if( !extension_loaded( 'zlib' ) ) { 148 $this->markTestSkipped('zlib extension not found.'); 149 } 150 } 151 }
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 |