Skip to content

Commit

Permalink
Tests: move include of constant_inc.php to SoapBase.php
Browse files Browse the repository at this point in the history
  • Loading branch information
dregad committed Jul 22, 2013
1 parent 77fa9a5 commit 4b4b8f4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
5 changes: 0 additions & 5 deletions tests/soap/IssueHistoryTest.php
Expand Up @@ -23,11 +23,6 @@

require_once 'SoapBase.php';

/**
* MantisBT constants
*/
require_once ( $t_root_path . DIRECTORY_SEPARATOR . 'core/constant_inc.php' );

/**
* Test fixture for issue history
*/
Expand Down
37 changes: 21 additions & 16 deletions tests/soap/SoapBase.php
Expand Up @@ -25,6 +25,11 @@

$t_root_path = dirname( dirname( dirname( __FILE__ ) ) ) . DIRECTORY_SEPARATOR;

/**
* MantisBT constants
*/
require_once ( $t_root_path . DIRECTORY_SEPARATOR . 'core/constant_inc.php' );

/**
* Test cases for SoapEnum class.
*/
Expand All @@ -34,7 +39,7 @@ class SoapBase extends PHPUnit_Framework_TestCase {
protected $password = 'root';
protected $email = 'root@localhost';
protected $userId = '1';

protected $mantisPath;
private $issueIdsToDelete = array();
private $versionIdsToDelete = array();
Expand All @@ -56,22 +61,22 @@ protected function setUp()
SoapClient(
$GLOBALS['MANTIS_TESTSUITE_SOAP_HOST'],
array_merge($this->defaultSoapClientOptions, $this->extraSoapClientFlags()
)
)
);

$this->mantisPath = substr($GLOBALS['MANTIS_TESTSUITE_SOAP_HOST'], 0, -strlen('api/soap/mantisconnect.php?wsdl'));
}

/**
* @return an array of extra options to be passed to the SoapClient constructor
*/
protected function extraSoapClientFlags() {

return array();
}

protected function tearDown() {

foreach ( $this->versionIdsToDelete as $versionIdToDelete ) {
$this->client->mc_project_version_delete($this->userName, $this->password, $versionIdToDelete);
}
Expand All @@ -82,7 +87,7 @@ protected function tearDown() {
$this->password,
$issueIdToDelete);
}

foreach ( $this->tagIdsToDelete as $tagIdToDelete ) {
$this->client->mc_tag_delete ( $this->userName, $this->password, $tagIdToDelete );
}
Expand Down Expand Up @@ -122,26 +127,26 @@ protected function deleteAfterRun( $issueId ) {

$this->issueIdsToDelete[] = $issueId;
}

/**
* Registers an version for deletion after the test method has run
*
* @param int $versionId
* @return void
*/
protected function deleteVersionAfterRun( $versionId ) {

$this->versionIdsToDelete[] = $versionId;
}

/**
* Registers a tag for deletion after the test method has run
*
*
* @param int $tagId
* @return void
*/
protected function deleteTagAfterRun ( $tagId ) {

$this->tagIdsToDelete[] = $tagId;
}

Expand All @@ -158,10 +163,10 @@ protected function skipIfAllowNoCategoryIsDisabled() {
$this->markTestSkipped( 'g_allow_no_category is not ON.' );
}
}

protected function skipIsZlibIsNotAvailable() {
if( !extension_loaded( 'zlib' ) ) {
$this->markTestSkipped('zlib extension not found.');
}
$this->markTestSkipped('zlib extension not found.');
}
}
}

0 comments on commit 4b4b8f4

Please sign in to comment.