You are here

public function Framework_TestCaseTest::testGlobalsBackupPre in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit/tests/Framework/TestCaseTest.php \Framework_TestCaseTest::testGlobalsBackupPre()

@backupGlobals enabled

File

vendor/phpunit/phpunit/tests/Framework/TestCaseTest.php, line 291

Class

Framework_TestCaseTest
@since Class available since Release 2.0.0 @covers PHPUnit_Framework_TestCase

Code

public function testGlobalsBackupPre() {
  global $a;
  global $i;
  $this
    ->assertEquals('a', $a);
  $this
    ->assertEquals('a', $GLOBALS['a']);
  $this
    ->assertEquals('b', $_ENV['b']);
  $this
    ->assertEquals('c', $_POST['c']);
  $this
    ->assertEquals('d', $_GET['d']);
  $this
    ->assertEquals('e', $_COOKIE['e']);
  $this
    ->assertEquals('f', $_SERVER['f']);
  $this
    ->assertEquals('g', $_FILES['g']);
  $this
    ->assertEquals('h', $_REQUEST['h']);
  $this
    ->assertEquals('i', $i);
  $this
    ->assertEquals('i', $GLOBALS['i']);
  $GLOBALS['a'] = 'aa';
  $GLOBALS['foo'] = 'bar';
  $_ENV['b'] = 'bb';
  $_POST['c'] = 'cc';
  $_GET['d'] = 'dd';
  $_COOKIE['e'] = 'ee';
  $_SERVER['f'] = 'ff';
  $_FILES['g'] = 'gg';
  $_REQUEST['h'] = 'hh';
  $GLOBALS['i'] = 'ii';
  $this
    ->assertEquals('aa', $a);
  $this
    ->assertEquals('aa', $GLOBALS['a']);
  $this
    ->assertEquals('bar', $GLOBALS['foo']);
  $this
    ->assertEquals('bb', $_ENV['b']);
  $this
    ->assertEquals('cc', $_POST['c']);
  $this
    ->assertEquals('dd', $_GET['d']);
  $this
    ->assertEquals('ee', $_COOKIE['e']);
  $this
    ->assertEquals('ff', $_SERVER['f']);
  $this
    ->assertEquals('gg', $_FILES['g']);
  $this
    ->assertEquals('hh', $_REQUEST['h']);
  $this
    ->assertEquals('ii', $i);
  $this
    ->assertEquals('ii', $GLOBALS['i']);
}