PHPUnit, backup globals and pear unit tests
| From: | Daniel O'Connor | Date: | Sun, 21 Dec 2008 02:27:58 +0000 |
| Subject: | PHPUnit, backup globals and pear unit tests | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-51341@lists.php.net to get a copy of this message | ||
Hey all,
If you've got a package with PHPUnit tests; you might be interested in
http://sebastian-bergmann.de/archives/797-Global-Variables-and-PHPUnit.html
Basically - PHPUnit helps you out by restoring the global state of your code
after execution.
The downsides to this is the significant performance hit involved; and it
also can encourage authors to write tests which are more brittle.
If you've got a few minutes to spare, go and do the following to your unit
tests
<?php
class MyTest extends PHPUnit_Framework_TestCase
{
protected $backupGlobals = FALSE;
// ...
}
?>
... and we'll see if we can't get PEAR wide unit tests running like
lightning