Example #1
0
 /**
  * Tests to ensure that the $_GET and $_REQUEST variables are fixed.
  */
 public function testFixGetGlobal()
 {
     $get = array('id' => 1, 'other' => array(1, 2, 3), 'name' => 'name');
     // Empty out $_GET and $_REQUEST.
     $GLOBALS['_GET'] = array();
     $GLOBALS['_REQUEST'] = array();
     $GLOBALS['_POST'] = array('test' => 23, 'another' => 'yes');
     $this->application->fixGetGlobal(http_build_query($get));
     // Check that everything in the query string matches.
     foreach (array('_GET', '_REQUEST') as $variable) {
         foreach ($get as $key => $value) {
             $this->assertEquals($value, $GLOBALS[$variable][$key]);
         }
     }
     // _REQUEST should be $_GET and $_POST merged.
     $this->assertEquals(array_merge($GLOBALS['_GET'], $GLOBALS['_POST']), $GLOBALS['_REQUEST']);
 }