示例#1
0
 /**
  * Tests the JWeb::redirect method with headers already sent.
  *
  * @return  void
  *
  * @since   11.3
  */
 public function testRedirectWithHeadersSent()
 {
     $base = 'http://j.org/';
     $url = 'index.php';
     // Emulate headers already sent.
     JWebInspector::$headersSent = true;
     // Inject the internal configuration.
     $config = new JRegistry();
     $config->set('uri.base.full', $base);
     $this->inspector->setClassProperty('config', $config);
     // Capture the output for this test.
     ob_start();
     $this->inspector->redirect('index.php');
     $buffer = ob_get_contents();
     ob_end_clean();
     $this->assertThat($buffer, $this->equalTo("<script>document.location.href='{$base}{$url}';</script>\n"));
 }