Re: PHPUnit, backup globals and pear unit tests
| From: | Bill Shupp | Date: | Sun, 21 Dec 2008 02:34:12 +0000 |
| Subject: | Re: PHPUnit, backup globals and pear unit tests | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-51342@lists.php.net to get a copy of this message | ||
On Dec 20, 2008, at 6:27 PM, Daniel O'Connor wrote:
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 lightningDaniel, Thanks for the tip! I had problems in the past where I expected globals to be unset between tests, and they were not. But I did not see this option in the documentation. Thanks! Bill