-- Sebastian Hopfe <[EMAIL PROTECTED]> wrote (on Tuesday, 09 December 2008, 01:07 AM +0100): > 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.
No, it's not. We require 80% coverage for acceptance to trunk, and recommend 90%. There are some cases, such as this type, that you simply can only trigger by testing in specific environments (PHP version, OS, presence/absence of an extension, etc.). > How this should work at following issue? > > http://framework.zend.com/issues/browse/ZF-5091 I've resolved it as "Won't Fix", due to the fact that it is filed against 1.7.0, and is specific to a version less than our required minimum PHP version. > 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 > -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/
