/** * Tests the JApplicationCms::redirect method with headers already sent. * * @return void * * @since 3.2 */ public function testRedirectWithHeadersSent() { $base = 'http://mydomain.com/'; $url = 'index.php'; // Emulate headers already sent. JApplicationCmsInspector::$headersSent = true; // Inject the internal configuration. $config = new Registry(); $config->set('uri.base.full', $base); TestReflection::setValue($this->class, 'config', $config); // Capture the output for this test. ob_start(); $this->class->redirect('index.php'); $buffer = ob_get_contents(); ob_end_clean(); $this->assertEquals("<script>document.location.href='{$base}{$url}';</script>\n", $buffer); }