[PHPUNIT] problem with globals
| From: | Jared Nedzel | Date: | Fri, 26 May 2006 20:37:14 +0000 |
| Subject: | [PHPUNIT] problem with globals | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-24169@lists.php.net to get a copy of this message | ||
I'm having problems with PHPUnit2. I've v2.3.5 but had problems with globals. It appeared that this problem was fixed in 3.0, so I downloaded 3.0.0alpha3, but I'm still seeing the problem.
Here's my code:
<?php
require_once 'PHPUnit2/Framework/TestCase.php';
$foo = 'foo';
class TestGlobal extends PHPUnit2_Framework_TestCase {
function testFoo() {
global $foo;
print "foo: $foo\n";
$bar = $GLOBALS['foo'];
print "bar: $bar\n";
}
}
?>
I would expect that the output would be:
foo: foo
bar: foo
But what I get is:
phpunit TestGlobal PHPUnit 3.0.0alpha3 by Sebastian Bergmann.foo: bar: . Time: 00:00 OK (1 test) Any suggestions for workarounds? Thanks, Jared