aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorIgor Wiedler <igor@wiedler.ch>2012-11-16 01:23:24 +0100
committerIgor Wiedler <igor@wiedler.ch>2012-11-16 01:23:24 +0100
commit423c79e106e1977d8d1085f6cb7ac9b63be7ec63 (patch)
tree75bc997bc880041ec4124f629c54af936ce63e7b /tests
parenta23eebdb7bb60c4b910357c1e948b97d48071d6a (diff)
parentf5536354917d0ae9dd5a1f7c842f175478b8f904 (diff)
downloadforums-423c79e106e1977d8d1085f6cb7ac9b63be7ec63.tar
forums-423c79e106e1977d8d1085f6cb7ac9b63be7ec63.tar.gz
forums-423c79e106e1977d8d1085f6cb7ac9b63be7ec63.tar.bz2
forums-423c79e106e1977d8d1085f6cb7ac9b63be7ec63.tar.xz
forums-423c79e106e1977d8d1085f6cb7ac9b63be7ec63.zip
Merge remote-tracking branch 'upstream/develop' into ticket/11015
* upstream/develop: (22 commits) [ticket/11206] Remove includes to non-existent files from download/file.php [ticket/11205] Fix merge conflict in readme.html. [ticket/11202] Check response success before content assertions. [ticket/11204] Reindent. [ticket/11198] Remove additional asterix as /** is doc-block only [ticket/11200] Add a reminder comment. [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. [ticket/11200] Make cache available during container construction [ticket/11199] Match cache purge container files against container_* [ticket/11199] Purge dumped container correctly on cache purge. [ticket/11199] Revert merge of 'marc1706/ticket/11199' into develop [ticket/11199] Cache purge does not remove dumped container [ticket/11198] Store the swapping partners in vars and simplify the logic [ticket/11198] Correctly set links after an item is moved up/down with AJAX [ticket/11197] Prefix the css classes for the small arrow with "arrow" [ticket/10879] Remove arrow icon from attachment link in editor [ticket/11195] Condense logic, remove improperly formatted if() [ticket/11190-develop] Functional tests purge cache before running. ... Conflicts: tests/test_framework/phpbb_database_test_connection_manager.php
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/browse_test.php3
-rw-r--r--tests/functional/extension_controller_test.php2
-rw-r--r--tests/test_framework/phpbb_database_test_connection_manager.php6
-rw-r--r--tests/test_framework/phpbb_functional_test_case.php38
4 files changed, 32 insertions, 17 deletions
diff --git a/tests/functional/browse_test.php b/tests/functional/browse_test.php
index 26c18c4c1f..b5748059c6 100644
--- a/tests/functional/browse_test.php
+++ b/tests/functional/browse_test.php
@@ -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());
}
}
diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php
index e9409d9d3f..d92a830365 100644
--- a/tests/functional/extension_controller_test.php
+++ b/tests/functional/extension_controller_test.php
@@ -82,6 +82,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
{
$this->phpbb_extension_manager->enable('foobar');
$crawler = $this->request('GET', 'index.php?ext=foobar');
+ $this->assert_response_success();
$this->assertContains("This is for testing purposes.", $crawler->filter('#page-body')->text());
$this->phpbb_extension_manager->purge('foobar');
}
@@ -94,6 +95,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
{
$this->phpbb_extension_manager->enable('foo/bar');
$crawler = $this->request('GET', 'index.php?ext=foo/bar');
+ $this->assert_response_success();
$this->assertContains("This is for testing purposes.", $crawler->filter('#page-body')->text());
$this->phpbb_extension_manager->purge('foo/bar');
}
diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php
index 82da5fe4c3..479e3aaca5 100644
--- a/tests/test_framework/phpbb_database_test_connection_manager.php
+++ b/tests/test_framework/phpbb_database_test_connection_manager.php
@@ -166,12 +166,6 @@ class phpbb_database_test_connection_manager
switch ($this->config['dbms'])
{
case 'phpbb_db_driver_sqlite':
- if (file_exists($this->config['dbhost']))
- {
- unlink($this->config['dbhost']);
- }
- break;
-
case 'phpbb_db_driver_firebird':
$this->connect();
// Drop all of the tables
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php
index 4c7dfb960b..f9c1d64ff8 100644
--- a/tests/test_framework/phpbb_functional_test_case.php
+++ b/tests/test_framework/phpbb_functional_test_case.php
@@ -51,6 +51,7 @@ class phpbb_functional_test_case extends phpbb_test_case
// that were added in other tests are gone
$this->lang = array();
$this->add_lang('common');
+ $this->purge_cache();
}
public function request($method, $path)
@@ -327,15 +328,30 @@ class phpbb_functional_test_case extends phpbb_test_case
return call_user_func_array('sprintf', $args);
}
- /**
- * assertContains for language strings
- *
- * @param string $needle Search string
- * @param string $haystack Search this
- * @param string $message Optional failure message
- */
- public function assertContainsLang($needle, $haystack, $message = null)
- {
- $this->assertContains(html_entity_decode($this->lang($needle), ENT_QUOTES), $haystack, $message);
- }
+ /**
+ * assertContains for language strings
+ *
+ * @param string $needle Search string
+ * @param string $haystack Search this
+ * @param string $message Optional failure message
+ */
+ public function assertContainsLang($needle, $haystack, $message = null)
+ {
+ $this->assertContains(html_entity_decode($this->lang($needle), ENT_QUOTES), $haystack, $message);
+ }
+
+ /**
+ * 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);
+ }
}