Phpunit suppressing errors when skipping tests

Hi,

I'm skipping unit tests like so

public function setup(){
        parent::setup();
        if ( ! defined ('TEST_DB')){
            $this->markTestSkipped('skipping db tests');
            return;
        }
        global $_SERVER;
        $_SERVER['TEST_DB'] = 1;
 }

The phpstorm test-runner throws exceptions

E:\app\php\latest\php.exe C:\Users\Willem\AppData\Local\Temp\ide-phpunit.php --configuration E:\home\Willem\proj\php\ikreo\travmedia_new\phpunit.xml
Testing started at 1:38 PM ...
  PHPUnit 3.7.21 by Sebastian Bergmann.

Configuration read from E:\home\Willem\proj\php\ikreo\travmedia_new\phpunit.xml

2012-12-31 17:26:00 EST (-05:00)

PHPUnit_Framework_SkippedTestError : skipping db tests
#0 E:\home\Willem\proj\php\ikreo\travmedia_new\test\ikreo\application\Locale\LocaleDbTest.php(16): PHPUnit_Framework_Assert::markTestSkipped('skipping db tes...')
#1 phar://E:/home/Willem/proj/php/phpunit.phar/PHPUnit/Framework/TestCase.php(828): LocaleDBTest->setup()
#2 phar://E:/home/Willem/proj/php/phpunit.phar/PHPUnit/Framework/TestResult.php(648): PHPUnit_Framework_TestCase->runBare()
#3 phar://E:/home/Willem/proj/php/phpunit.phar/PHPUnit/Framework/TestCase.php(776): PHPUnit_Framework_TestResult->run(Object(LocaleDBTest))
#4 phar://E:/home/Willem/proj/php/phpunit.phar/PHPUnit/Framework/TestSuite.php(775): PHPUnit_Framework_TestCase->run(Object(PHPUnit_Framework_TestResult))
#5 phar://E:/home/Willem/proj/php/phpunit.phar/PHPUnit/Framework/TestSuite.php(745): PHPUnit_Framework_TestSuite->runTest(Object(LocaleDBTest), Object(PHPUnit_Framework_TestResult))
#6 phar://E:/home/Willem/proj/php/phpunit.phar/PHPUnit/Framework/TestSuite.php(705): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult), false, Array, Array, false)
#7 phar://E:/home/Willem/proj/php/phpunit.phar/PHPUnit/TextUI/TestRunner.php(349): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult), false, Array, Array, false)
#8 phar://E:/home/Willem/proj/php/phpunit.phar/PHPUnit/TextUI/Command.php(176): PHPUnit_TextUI_TestRunner->doRun(Object(PHPUnit_Framework_TestSuite), Array)
#9 C:\Users\Willem\AppData\Local\Temp\ide-phpunit.php(260): PHPUnit_TextUI_Command->run(Array, true)
#10 C:\Users\Willem\AppData\Local\Temp\ide-phpunit.php(498): IDE_Base_PHPUnit_TextUI_Command::main()
#11 {main}


When I run it from the command line I get the expected output which just tells me I've skipped tests without the exception & stacktrace per test.

Is there a way to prevent the exception & stacktrace.

I tried setting convertErrorsToExceptions to false in my phpunit.xml but this didn't have any effect, and it is a bad option anyway as I want errors as exceptions, I just don't need an exception when I'm skipping tests.

Thanks,
Willem

Please sign in to leave a comment.