When writing PHPT tests for PHP, it’s good practice to have a conditional --SKIPIF-- block to see if the test can be skipped when some extension you’re testing isn’t available. With the PHP_5_3 CVS branch (the one you should be testing against), some new extensions can’t be disabled, so the --SKIPIF-- block isn’t needed anymore. This applies to the following extensions: PCRE, Reflection and SPL.
In fact, the following extensions can’t be disabled so you can safely test against them without the --SKIPIF-- block:
- date
- ereg
- pcre
- Reflection
- SPL
- standard
For completeness, a short example for a Reflection test:
--TEST-- ReflectionClass::isAbstract() method // THESE 2 LINES ARE NOT NEEDED --SKIPIF-- // REMOVE THEM! <?php extension_loaded('reflection') or die('skip'); ?> --FILE-- <?php abstract class TestAbstractClass {} $abstractClass = new ReflectionClass('TestAbstractClass'); var_dump($abstractClass->isAbstract()); ?> --EXPECT-- bool(true)
Recent Comments