private function header($headerLine)
{
$this->headers[] = $headerLine;
}
...
}
这是我们的测试代码:
public function testANewPostIsCreated()
{
$action = new ForumPosting();
$response = $action->handleRequest(array(
'id_thread' => 42,
'text' => 'Hello, world',
...
));
$this->assertEquals('...', $response['content']);
$this->assertContains('Content-type: text/html', $response['headers']);
}
结论