-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
When trying the same as the first example you have in your README.md file, calling $this->client->response->getBody()->getContent() returns "" in my test meaning the following does not work:
$this->client->get('/');
$this->assertEquals('Hello World', $this->client->response->getBody());Your example code:
class VersionTest extends LocalWebTestCase
{
public function testVersion()
{
$this->client->get('/version');
$this->assertEquals(200, $this->client->response->getStatusCode());
$this->assertEquals($this->app->config('version'), $this->client->response->getBody());
}
}We have our own version (replicated) of WebTestCase as we have our own config and setup process.
To get it working, our test make-up is the following:
public function testHomePage()
{
$body = $this->client->get('/');
$this->assertEquals(200, $this->client->response->getStatusCode());
$this->assertContains('Hello world', $body);
$this->assertContains('<title>Welcome</title>', $body);
}The main difference with mine is that I am assigning $body = $this->client->get('/'); as ::get calls ::request but ends with return (string)$this->response->getBody();.
Am I missing something or have the docs not been updated? I can PR on the fix in the docs providing I am not missing something first.
Metadata
Metadata
Assignees
Labels
No labels