mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-04 22:58:10 +02:00
[ticket/develop/11568] Do not directly access $client from tests
PHPBB3-11568
This commit is contained in:
parent
6d9888be65
commit
467c4d62c4
@ -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());
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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">>=5.3</p>', $this->client->getResponse()->getContent());
|
||||
$this->assertContains('<p id="require_php">>=5.3</p>', $this->get_content());
|
||||
}
|
||||
|
||||
public function test_extensions_details_notexists()
|
||||
|
Loading…
x
Reference in New Issue
Block a user