aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2013-05-28 14:55:04 +0200
committerJoas Schilling <nickvergessen@gmx.de>2013-05-28 14:55:04 +0200
commit467c4d62c44a32a1a60bed2e2a2519b10cdebd33 (patch)
treeff255cbbb902af4744594961f55729f6ec3e24c6
parent6d9888be6504dee73341832c7de3d085f09da983 (diff)
downloadforums-467c4d62c44a32a1a60bed2e2a2519b10cdebd33.tar
forums-467c4d62c44a32a1a60bed2e2a2519b10cdebd33.tar.gz
forums-467c4d62c44a32a1a60bed2e2a2519b10cdebd33.tar.bz2
forums-467c4d62c44a32a1a60bed2e2a2519b10cdebd33.tar.xz
forums-467c4d62c44a32a1a60bed2e2a2519b10cdebd33.zip
[ticket/develop/11568] Do not directly access $client from tests
PHPBB3-11568
-rw-r--r--tests/functional/acp_permissions_test.php8
-rw-r--r--tests/functional/extension_controller_test.php9
-rw-r--r--tests/functional/extension_permission_lang_test.php2
-rw-r--r--tests/functional/fileupload_form_test.php2
-rw-r--r--tests/functional/forgot_password_test.php7
-rw-r--r--tests/functional/metadata_manager_test.php2
6 files changed, 13 insertions, 17 deletions
diff --git a/tests/functional/acp_permissions_test.php b/tests/functional/acp_permissions_test.php
index f7fd44fc89..2f27b68555 100644
--- a/tests/functional/acp_permissions_test.php
+++ b/tests/functional/acp_permissions_test.php
@@ -28,7 +28,7 @@ class phpbb_functional_acp_permissions_test extends phpbb_functional_test_case
$crawler = $this->request('GET', 'adm/index.php?i=16&sid=' . $this->sid);
$this->assert_response_success();
// these language strings are html
- $this->assertContains($this->lang('ACP_PERMISSIONS_EXPLAIN'), $this->client->getResponse()->getContent());
+ $this->assertContains($this->lang('ACP_PERMISSIONS_EXPLAIN'), $this->get_content());
}
public function test_select_user()
@@ -36,13 +36,13 @@ class phpbb_functional_acp_permissions_test extends phpbb_functional_test_case
// User permissions
$crawler = $this->request('GET', 'adm/index.php?i=acp_permissions&icat=16&mode=setting_user_global&sid=' . $this->sid);
$this->assert_response_success();
- $this->assertContains($this->lang('ACP_USERS_PERMISSIONS_EXPLAIN'), $this->client->getResponse()->getContent());
+ $this->assertContains($this->lang('ACP_USERS_PERMISSIONS_EXPLAIN'), $this->get_content());
// Select admin
$form = $crawler->selectButton($this->lang('SUBMIT'))->form();
$data = array('username[0]' => 'admin');
$form->setValues($data);
- $crawler = $this->client->submit($form);
+ $crawler = $this->submit($form);
$this->assert_response_success();
$this->assertContains($this->lang('ACL_SET'), $crawler->filter('h1')->eq(1)->text());
}
@@ -114,7 +114,7 @@ class phpbb_functional_acp_permissions_test extends phpbb_functional_test_case
// set to never
$data = array("setting[$object_id][0][$permission]" => '0');
$form->setValues($data);
- $crawler = $this->client->submit($form);
+ $crawler = $this->submit($form);
$this->assert_response_success();
$this->assertContains($this->lang('AUTH_UPDATED'), $crawler->text());
diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php
index f28b321942..7f1decd5b5 100644
--- a/tests/functional/extension_controller_test.php
+++ b/tests/functional/extension_controller_test.php
@@ -115,8 +115,9 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
public function test_missing_argument()
{
$this->phpbb_extension_manager->enable('foo/bar');
- $crawler = $this->request('GET', 'app.php?controller=foo/baz');
- $this->assertEquals(500, $this->client->getResponse()->getStatus());
+ $crawler = $this->request('GET', 'app.php?controller=foo/baz', false);
+ $this->request('GET', 'app.php?controller=foo/baz', false);
+ $this->assert_response_success(500);
$this->assertContains('Missing value for argument #1: test in class phpbb_ext_foo_bar_controller:baz', $crawler->filter('body')->text());
$this->phpbb_extension_manager->purge('foo/bar');
}
@@ -128,7 +129,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
{
$this->phpbb_extension_manager->enable('foo/bar');
$crawler = $this->request('GET', 'app.php?controller=foo/exception');
- $this->assertEquals(500, $this->client->getResponse()->getStatus());
+ $this->assert_response_success(500);
$this->assertContains('Exception thrown from foo/exception route', $crawler->filter('body')->text());
$this->phpbb_extension_manager->purge('foo/bar');
}
@@ -145,7 +146,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
public function test_error_ext_disabled_or_404()
{
$crawler = $this->request('GET', 'app.php?controller=does/not/exist');
- $this->assertEquals(404, $this->client->getResponse()->getStatus());
+ $this->assert_response_success(404);
$this->assertContains('No route found for "GET /does/not/exist"', $crawler->filter('body')->text());
}
}
diff --git a/tests/functional/extension_permission_lang_test.php b/tests/functional/extension_permission_lang_test.php
index 26ec4d28a1..4e40b11560 100644
--- a/tests/functional/extension_permission_lang_test.php
+++ b/tests/functional/extension_permission_lang_test.php
@@ -106,7 +106,7 @@ class phpbb_functional_extension_permission_lang_test extends phpbb_functional_t
$form = $crawler->selectButton($this->lang('SUBMIT'))->form();
$data = array('username[0]' => 'admin');
$form->setValues($data);
- $crawler = $this->client->submit($form);
+ $crawler = $this->submit($form);
$this->assert_response_success();
// language from language/en/acp/permissions_phpbb.php
diff --git a/tests/functional/fileupload_form_test.php b/tests/functional/fileupload_form_test.php
index b663c89e95..ec2296d6f2 100644
--- a/tests/functional/fileupload_form_test.php
+++ b/tests/functional/fileupload_form_test.php
@@ -68,7 +68,7 @@ class phpbb_functional_fileupload_form_test extends phpbb_functional_test_case
$crawler = $this->upload_file('valid.jpg', 'image/jpeg');
$this->assert_response_success();
// ensure there was no error message rendered
- $this->assertNotContains('<h2>' . $this->lang('INFORMATION') . '</h2>', $this->client->getResponse()->getContent());
+ $this->assertNotContains('<h2>' . $this->lang('INFORMATION') . '</h2>', $this->get_content());
$this->assertContains($this->lang('POSTED_ATTACHMENTS'), $crawler->filter('#postform h3')->eq(1)->text());
}
}
diff --git a/tests/functional/forgot_password_test.php b/tests/functional/forgot_password_test.php
index bfb4616d64..7c5f27c07e 100644
--- a/tests/functional/forgot_password_test.php
+++ b/tests/functional/forgot_password_test.php
@@ -27,18 +27,13 @@ class phpbb_functional_forgot_password_test extends phpbb_functional_test_case
$this->admin_login();
$this->add_lang('ucp');
$crawler = $this->request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=security');
- $this->assertEquals(200, $this->client->getResponse()->getStatus());
- $content = $this->client->getResponse()->getContent();
- $this->assertNotContains('Fatal error:', $content);
- $this->assertNotContains('Notice:', $content);
- $this->assertNotContains('[phpBB Debug]', $content);
$form = $crawler->selectButton('Submit')->form();
$values = $form->getValues();
$values["config[allow_password_reset]"] = 0;
$form->setValues($values);
- $crawler = $this->client->submit($form);
+ $crawler = $this->submit($form);
$this->logout();
diff --git a/tests/functional/metadata_manager_test.php b/tests/functional/metadata_manager_test.php
index 0125886e04..fa668b3cb5 100644
--- a/tests/functional/metadata_manager_test.php
+++ b/tests/functional/metadata_manager_test.php
@@ -97,7 +97,7 @@ class phpbb_functional_metadata_manager_test extends phpbb_functional_test_case
// Details should be html escaped
// However, text() only returns the displayed text, so HTML Special Chars are decoded.
// So we test this directly on the content of the response.
- $this->assertContains('<p id="require_php">&gt;=5.3</p>', $this->client->getResponse()->getContent());
+ $this->assertContains('<p id="require_php">&gt;=5.3</p>', $this->get_content());
}
public function test_extensions_details_notexists()