chobo2 Posted May 5, 2007 Share Posted May 5, 2007 Hi I have a problem I have these 2 files: AbandonSeekRequestProcessorTest.php AbandonSeekRequestProcessor.php AbandonSeekRequestProcessorTest <?php ini_set('include_path',ini_get('include_path').';../src/'); require_once('simpletest/unit_tester.php'); require_once('simpletest/reporter.php'); class AbandonSeekRequestProcessorTest extends UnitTestCase { public function __construct($testName) { parent::__construct($testName); } public static function suite() { $suite = new PHPUnit_Framework_TestSuite("AbandonSeekRequestProcessorTest"); return $suite; } public function testCreateResponse() { $processor = new AbandonSeekRequestProcessor(); $document = $processor->process(); $this->assertNotNull($document); $this->assertEqual('<?xml version="1.0" encoding="UTF-8"?><requesterror xmlns="http://requesterror.chess.comp2910.cst.bcit.ca"><reason message="abandonseek is not implemented"/></requesterror>', $document); } } $t = new AbandonSeekRequestProcessorTest("abandon seek request processor test"); $t->run(new HtmlReporter()); ?> AbandonSeekRequestProcessor.php <?php class AbandonSeekRequestProcessor { public function __construct() { } public function process() { header('Content-Type: text/xml'); $xml = '<?xml version="1.0" encoding="UTF-8"?>'; $xml .= '<requesterror xmlns="http://requesterror.chess.comp2910.cst.bcit.ca">'; $xml .= '<reason message="abandonseek not implemented"/>'; $xml .= '</requesterror>'; echo $xml; } } ?> So the problem is that the htmlReporter from simpleTest already sends out headers. So if you have headers in your program you get header already sent error: Exception: testResponse -> Unexpected PHP error [Cannot modify header information - headers already sent] severity [E_WARNING] in [G:\website\trunk\mysrc\AbandonSeekRequestProcessor.php line 12] I have tired all the flushing and output buffering and nothing seems to work. Quote Link to comment https://forums.phpfreaks.com/topic/50096-need-help-with-simple-test-header-errror-warnings/ Share on other sites More sharing options...
MadTechie Posted May 5, 2007 Share Posted May 5, 2007 you sure the problem isn't in "simpletest/unit_tester.php" or "simpletest/reporter.php" Quote Link to comment https://forums.phpfreaks.com/topic/50096-need-help-with-simple-test-header-errror-warnings/#findComment-245964 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.