For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > May 2006 > [PHPUNIT] problem with globals









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author [PHPUNIT] problem with globals
Jared Nedzel

2006-05-26, 7:01 pm

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:
Sebastian Bergmann

2006-05-27, 4:01 am

Jared Nedzel wrote:
> Any suggestions for workarounds?


The problem you refer to (bug #5053) needs a version of the Xdebug
extension that provides xdebug_get_declared_vars().

--
Sebastian Bergmann http://www.sebastian-bergmann.de/
GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com