Hi till, i know that this function is added since a long time. This was only an example. But how i could write a PHPUnit test - so that i get a CodeCoverage by 100% and the test is solved complete?
I mean - the ZF is solicited with a 100% Code Coverage. How this should work at following issue? http://framework.zend.com/issues/browse/ZF-5091 thanks for spending time in my question. Best regards Sebastian -----Ursprüngliche Nachricht----- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von till Gesendet: Montag, 8. Dezember 2008 23:41 An: Sebastian Hopfe Cc: [email protected] Betreff: Re: [fw-general] How to test downwardly compatible Methodes with PHPUnit On Mon, Dec 8, 2008 at 11:24 PM, Sebastian Hopfe <[EMAIL PROTECTED]> wrote: > Hi, > > > > i want to open a discussion about PHPUnit. First of all I love PHPUnit > but i see some problems by testing methodes which providing downwardly > compatible. > > > > The function file_gets_content" is in old php versions not available. We > should check this with function_exists() if these is false we should write > an alternative function. > > This is only an example. Added in 5.0.0. :P > But how we could test this with PHPUnit? On a more serious note... I'm not sure how to do that with PHPUnit, but you can run PHPT tests with PHPUnit as well, and in PHPT you can do the following: --TEST-- This is an example test. --SKIPIF-- if (!function_exists('file_get_contents')) die('SKIP file_get_contents() does not exist'); --FILE-- <?php $resp = @file_get_contents('http://domain.tld'); var_dump($resp); ?> --EXPECT-- bool(false) You can run this test with pear run-tests foo.phpt, but also use an extension which is bundled with PHPUnit to include phpt's in the usual phpunit AllTests.php run. For example: <http://cvs.php.net/viewvc.cgi/pear/HTTP_Session2/tests/AllTests.php?view=ma rkup> Cheers, Till
