mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-24 12:03:21 +01:00
Merge remote-tracking branch 'p/ticket/11202-olympus' into develop-olympus
* p/ticket/11202-olympus: [ticket/11202] Custom message does not make sense here, delete it. [ticket/11202] Check response success before content assertions. [ticket/11202] Add a heuristic function to check for response success.
This commit is contained in:
commit
14a42a97a8
@ -15,18 +15,21 @@ class phpbb_functional_browse_test extends phpbb_functional_test_case
|
||||
public function test_index()
|
||||
{
|
||||
$crawler = $this->request('GET', 'index.php');
|
||||
$this->assert_response_success();
|
||||
$this->assertGreaterThan(0, $crawler->filter('.topiclist')->count());
|
||||
}
|
||||
|
||||
public function test_viewforum()
|
||||
{
|
||||
$crawler = $this->request('GET', 'viewforum.php?f=2');
|
||||
$this->assert_response_success();
|
||||
$this->assertGreaterThan(0, $crawler->filter('.topiclist')->count());
|
||||
}
|
||||
|
||||
public function test_viewtopic()
|
||||
{
|
||||
$crawler = $this->request('GET', 'viewtopic.php?t=1');
|
||||
$this->assert_response_success();
|
||||
$this->assertGreaterThan(0, $crawler->filter('.postbody')->count());
|
||||
}
|
||||
}
|
||||
|
@ -252,4 +252,19 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||
|
||||
return call_user_func_array('sprintf', $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Heuristic function to check that the response is success.
|
||||
*
|
||||
* When php decides to die with a fatal error, it still sends 200 OK
|
||||
* status code. This assertion tries to catch that.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function assert_response_success()
|
||||
{
|
||||
$this->assertEquals(200, $this->client->getResponse()->getStatus());
|
||||
$content = $this->client->getResponse()->getContent();
|
||||
$this->assertNotContains('Fatal error:', $content);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user