Skip to content

Commit

Permalink
Unit tests can now choose to be skipped for whatever reason. Mostly d…
Browse files Browse the repository at this point in the history
…ue to not having the correct environment configured. ZendCodeAnalyzer skips itself if the config option is not set.

git-svn-id: http://svn.php.net/repository/pear/packages/PHP_CodeSniffer/trunk@244213 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information
gsherwood committed Oct 15, 2007
1 parent 835992f commit 314a91d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
13 changes: 13 additions & 0 deletions CodeSniffer/Standards/Zend/Tests/Debug/CodeAnalyzerUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ class Zend_Tests_Debug_CodeAnalyzerUnitTest extends AbstractSniffUnitTest
{


/**
* Should this test be skipped for some reason.
*
* @return void
*/
protected function shouldSkipTest()
{
$analyzerPath = PHP_CodeSniffer::getConfigData('zend_ca_path');
return (is_null($analyzerPath));

}//end shouldSkipTest()


/**
* Returns the lines where errors should occur.
*
Expand Down
17 changes: 17 additions & 0 deletions tests/Standards/AbstractSniffUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ protected function setUp()
}//end setUp()


/**
* Should this test be skipped for some reason.
*
* @return void
*/
protected function shouldSkipTest()
{
return false;

}//end shouldSkipTest()


/**
* Tests the extending classes Sniff class.
*
Expand All @@ -65,6 +77,11 @@ protected function setUp()
*/
protected final function runTest()
{
// Skip this test if we can't run in this environment.
if ($this->shouldSkipTest() === true) {
$this->markTestSkipped();
}

// The basis for determining file locations.
$basename = substr(get_class($this), 0, -8);

Expand Down

0 comments on commit 314a91d

Please sign in to comment.