mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-16 21:54:00 +02:00
Merge branch 'develop-olympus' of https://github.com/phpbb/phpbb3 into ticket/11548
This commit is contained in:
@@ -17,8 +17,7 @@ class phpbb_functional_auth_test extends phpbb_functional_test_case
|
||||
$this->login();
|
||||
|
||||
// check for logout link
|
||||
$crawler = $this->request('GET', 'index.php');
|
||||
$this->assert_response_success();
|
||||
$crawler = self::request('GET', 'index.php');
|
||||
$this->assertContains($this->lang('LOGOUT_USER', 'admin'), $crawler->filter('.navbar')->text());
|
||||
}
|
||||
|
||||
@@ -26,8 +25,7 @@ class phpbb_functional_auth_test extends phpbb_functional_test_case
|
||||
{
|
||||
$this->create_user('anothertestuser');
|
||||
$this->login('anothertestuser');
|
||||
$crawler = $this->request('GET', 'index.php');
|
||||
$this->assert_response_success();
|
||||
$crawler = self::request('GET', 'index.php');
|
||||
$this->assertContains('anothertestuser', $crawler->filter('.icon-logout')->text());
|
||||
}
|
||||
|
||||
@@ -40,13 +38,11 @@ class phpbb_functional_auth_test extends phpbb_functional_test_case
|
||||
$this->add_lang('ucp');
|
||||
|
||||
// logout
|
||||
$crawler = $this->request('GET', 'ucp.php?sid=' . $this->sid . '&mode=logout');
|
||||
$this->assert_response_success();
|
||||
$crawler = self::request('GET', 'ucp.php?sid=' . $this->sid . '&mode=logout');
|
||||
$this->assertContains($this->lang('LOGOUT_REDIRECT'), $crawler->filter('#message')->text());
|
||||
|
||||
// look for a register link, which should be visible only when logged out
|
||||
$crawler = $this->request('GET', 'index.php');
|
||||
$this->assert_response_success();
|
||||
$crawler = self::request('GET', 'index.php');
|
||||
$this->assertContains($this->lang('REGISTER'), $crawler->filter('.navbar')->text());
|
||||
}
|
||||
}
|
||||
|
@@ -14,22 +14,19 @@ class phpbb_functional_browse_test extends phpbb_functional_test_case
|
||||
{
|
||||
public function test_index()
|
||||
{
|
||||
$crawler = $this->request('GET', 'index.php');
|
||||
$this->assert_response_success();
|
||||
$crawler = self::request('GET', 'index.php');
|
||||
$this->assertGreaterThan(0, $crawler->filter('.topiclist')->count());
|
||||
}
|
||||
|
||||
public function test_viewforum()
|
||||
{
|
||||
$crawler = $this->request('GET', 'viewforum.php?f=2');
|
||||
$this->assert_response_success();
|
||||
$crawler = self::request('GET', 'viewforum.php?f=2');
|
||||
$this->assertGreaterThan(0, $crawler->filter('.topiclist')->count());
|
||||
}
|
||||
|
||||
public function test_viewtopic()
|
||||
{
|
||||
$crawler = $this->request('GET', 'viewtopic.php?t=1');
|
||||
$this->assert_response_success();
|
||||
$crawler = self::request('GET', 'viewtopic.php?t=1');
|
||||
$this->assertGreaterThan(0, $crawler->filter('.postbody')->count());
|
||||
}
|
||||
}
|
||||
|
@@ -35,11 +35,10 @@ abstract class phpbb_functional_common_groups_test extends phpbb_functional_test
|
||||
$this->add_lang(array('ucp', 'acp/groups'));
|
||||
|
||||
// Manage Administrators group
|
||||
$crawler = $this->request('GET', $this->get_url() . '&g=5&sid=' . $this->sid);
|
||||
$this->assert_response_success();
|
||||
$crawler = self::request('GET', $this->get_url() . '&g=5&sid=' . $this->sid);
|
||||
$form = $crawler->selectButton($this->lang('SUBMIT'))->form();
|
||||
$form['group_colour']->setValue($input);
|
||||
$crawler = $this->client->submit($form);
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContains($this->lang($expected), $crawler->text());
|
||||
}
|
||||
}
|
||||
|
45
tests/functional/forum_style_test.php
Normal file
45
tests/functional/forum_style_test.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2013 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group functional
|
||||
*/
|
||||
class phpbb_functional_forum_style_test extends phpbb_functional_test_case
|
||||
{
|
||||
public function test_default_forum_style()
|
||||
{
|
||||
$crawler = self::request('GET', 'viewtopic.php?t=1&f=2');
|
||||
$this->assertContains('styles/prosilver/', $crawler->filter('head > link[rel=stylesheet]')->attr('href'));
|
||||
|
||||
$crawler = self::request('GET', 'viewtopic.php?t=1');
|
||||
$this->assertContains('styles/prosilver/', $crawler->filter('head > link[rel=stylesheet]')->attr('href'));
|
||||
|
||||
$crawler = self::request('GET', 'viewtopic.php?t=1&view=next');
|
||||
$this->assertContains('styles/prosilver/', $crawler->filter('head > link[rel=stylesheet]')->attr('href'));
|
||||
}
|
||||
|
||||
public function test_custom_forum_style()
|
||||
{
|
||||
$db = $this->get_db();
|
||||
$this->add_style(2, 'test_style');
|
||||
$db->sql_query('UPDATE ' . FORUMS_TABLE . ' SET forum_style = 2 WHERE forum_id = 2');
|
||||
|
||||
$crawler = self::request('GET', 'viewtopic.php?t=1&f=2');
|
||||
$this->assertContains('styles/test_style/', $crawler->filter('head > link[rel=stylesheet]')->attr('href'));
|
||||
|
||||
$crawler = self::request('GET', 'viewtopic.php?t=1');
|
||||
$this->assertContains('styles/test_style/', $crawler->filter('head > link[rel=stylesheet]')->attr('href'));
|
||||
|
||||
$crawler = self::request('GET', 'viewtopic.php?t=1&view=next');
|
||||
$this->assertContains('styles/test_style/', $crawler->filter('head > link[rel=stylesheet]')->attr('href'));
|
||||
|
||||
$db->sql_query('UPDATE ' . FORUMS_TABLE . ' SET forum_style = 0 WHERE forum_id = 2');
|
||||
$this->delete_style(2, 'test_style');
|
||||
}
|
||||
}
|
@@ -19,18 +19,17 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case
|
||||
// Test creating topic
|
||||
$post = $this->create_topic(2, 'Test Topic 1', 'This is a test topic posted by the testing framework.');
|
||||
|
||||
$crawler = $this->request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}");
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}");
|
||||
$this->assertContains('This is a test topic posted by the testing framework.', $crawler->filter('html')->text());
|
||||
|
||||
// Test creating a reply
|
||||
$post2 = $this->create_post(2, $post['topic_id'], 'Re: Test Topic 1', 'This is a test post posted by the testing framework.');
|
||||
|
||||
$crawler = $this->request('GET', "viewtopic.php?t={$post2['topic_id']}&sid={$this->sid}");
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$post2['topic_id']}&sid={$this->sid}");
|
||||
$this->assertContains('This is a test post posted by the testing framework.', $crawler->filter('html')->text());
|
||||
|
||||
// Test quoting a message
|
||||
$crawler = $this->request('GET', "posting.php?mode=quote&f=2&t={$post2['topic_id']}&p={$post2['post_id']}&sid={$this->sid}");
|
||||
$this->assert_response_success();
|
||||
$crawler = self::request('GET', "posting.php?mode=quote&f=2&t={$post2['topic_id']}&p={$post2['post_id']}&sid={$this->sid}");
|
||||
$this->assertContains('This is a test post posted by the testing framework.', $crawler->filter('html')->text());
|
||||
}
|
||||
|
||||
@@ -55,7 +54,7 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case
|
||||
'post' => true,
|
||||
), $additional_form_data);
|
||||
|
||||
return $this->submit_post($posting_url, 'POST_TOPIC', $form_data);
|
||||
return self::submit_post($posting_url, 'POST_TOPIC', $form_data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,7 +78,7 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case
|
||||
'post' => true,
|
||||
), $additional_form_data);
|
||||
|
||||
return $this->submit_post($posting_url, 'POST_REPLY', $form_data);
|
||||
return self::submit_post($posting_url, 'POST_REPLY', $form_data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,8 +93,7 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case
|
||||
{
|
||||
$this->add_lang('posting');
|
||||
|
||||
$crawler = $this->request('GET', $posting_url);
|
||||
$this->assert_response_success();
|
||||
$crawler = self::request('GET', $posting_url);
|
||||
$this->assertContains($this->lang($posting_contains), $crawler->filter('html')->text());
|
||||
|
||||
$hidden_fields = array(
|
||||
@@ -119,8 +117,7 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case
|
||||
// I use a request because the form submission method does not allow you to send data that is not
|
||||
// contained in one of the actual form fields that the browser sees (i.e. it ignores "hidden" inputs)
|
||||
// Instead, I send it as a request with the submit button "post" set to true.
|
||||
$crawler = $this->client->request('POST', $posting_url, $form_data);
|
||||
$this->assert_response_success();
|
||||
$crawler = self::request('POST', $posting_url, $form_data);
|
||||
$this->assertContains($this->lang('POST_STORED'), $crawler->filter('html')->text());
|
||||
|
||||
$url = $crawler->selectLink($this->lang('VIEW_MESSAGE', '', ''))->link()->getUri();
|
||||
|
61
tests/functional/report_post_captcha.php
Normal file
61
tests/functional/report_post_captcha.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2013 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group functional
|
||||
*/
|
||||
class phpbb_functional_report_post_captcha_test extends phpbb_functional_test_case
|
||||
{
|
||||
public function test_user_report_post()
|
||||
{
|
||||
$this->login();
|
||||
$crawler = self::request('GET', 'report.php?f=2&p=1');
|
||||
$this->assertNotContains($this->lang('CONFIRM_CODE'), $crawler->filter('html')->text());
|
||||
}
|
||||
|
||||
public function test_guest_report_post()
|
||||
{
|
||||
$crawler = self::request('GET', 'report.php?f=2&p=1');
|
||||
$this->add_lang('mcp');
|
||||
$this->assertContains($this->lang('USER_CANNOT_REPORT'), $crawler->filter('html')->text());
|
||||
|
||||
$this->set_reporting_guest(1);
|
||||
$crawler = self::request('GET', 'report.php?f=2&p=1');
|
||||
$this->assertContains($this->lang('CONFIRM_CODE'), $crawler->filter('html')->text());
|
||||
$this->set_reporting_guest(-1);
|
||||
}
|
||||
|
||||
protected function set_reporting_guest($report_post_allowed)
|
||||
{
|
||||
$this->login();
|
||||
$this->admin_login();
|
||||
|
||||
$crawler = self::request('GET', 'adm/index.php?i=permissions&icat=12&mode=setting_group_local&sid=' . $this->sid);
|
||||
$form = $crawler->selectButton('Submit')->form();
|
||||
$values = $form->getValues();
|
||||
$values["group_id[0]"] = 1;
|
||||
$form->setValues($values);
|
||||
$crawler = self::submit($form);
|
||||
|
||||
$form = $crawler->selectButton('Submit')->form();
|
||||
$values = $form->getValues();
|
||||
$values["forum_id"] = 2;
|
||||
$form->setValues($values);
|
||||
$crawler = self::submit($form);
|
||||
|
||||
$this->add_lang('acp/permissions');
|
||||
$form = $crawler->selectButton($this->lang('APPLY_ALL_PERMISSIONS'))->form();
|
||||
$values = $form->getValues();
|
||||
$values["setting[1][2][f_report]"] = $report_post_allowed;
|
||||
$form->setValues($values);
|
||||
$crawler = self::submit($form);
|
||||
|
||||
$crawler = self::request('GET', 'ucp.php?mode=logout&sid=' . $this->sid);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user