I am putting PHPUnit testing into an existing project. Global constants variables are used extensively. In my unit test functions are failing because the global variables are null. Here is an example of a failing test
static $secret_key = "a secret Key"; class secret_key_Test extends PHPUnit_Framework_TestCase { function test_secret_key() { global $secret_key; $this->assertEquals($secret_key, "a secret Key"); } } >> Failed asserting that 'a secret Key' matches expected null Any help would be greatly appreciated
Update: I have tried removing static and adding
protected $backupGlobals = FALSE; To the class declaration without success.
global $secret_key = "a secret Key";notstatic, didn't you?statickeyword should just be removed.globalonly makes sense inside a function/method.