4 * Class CRM_Utils_GlobalStackTest
7 class CRM_Utils_GlobalStackTest
extends CiviUnitTestCase
{
10 * Temporarily override global variables and ensure that the variable data.
11 * is set as expected (before/during/after the override).
13 public function testPushPop() {
14 global $_FOO, $_EXTRA;
20 $this->assertEquals(1, $_FOO['bar']);
21 $this->assertEquals(1, $_FOO['whiz']);
22 $this->assertFalse(isset($_FOO['bang']));
23 $this->assertEquals(1, $_EXTRA);
25 CRM_Utils_GlobalStack
::singleton()->push(array(
33 $this->assertEquals(2, $_FOO['bar']);
34 $this->assertEquals(1, $_FOO['whiz']);
35 $this->assertEquals(2, $_FOO['bang']);
36 $this->assertEquals(2, $_EXTRA);
38 CRM_Utils_GlobalStack
::singleton()->pop();
40 $this->assertEquals(1, $_FOO['bar']);
41 $this->assertEquals(1, $_FOO['whiz']);
42 $this->assertEquals(NULL, $_FOO['bang']);
43 $this->assertEquals(1, $_EXTRA);