mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-17 22:11:26 +02:00
Merge branch 'develop' of https://github.com/phpbb/phpbb3 into ticket/11531
This commit is contained in:
@@ -39,7 +39,6 @@ class phpbb_functional_auth_test extends phpbb_functional_test_case
|
||||
|
||||
// logout
|
||||
$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 = self::request('GET', 'index.php');
|
||||
|
@@ -36,6 +36,26 @@ abstract class phpbb_functional_common_groups_test extends phpbb_functional_test
|
||||
$this->add_lang(array('ucp', 'acp/groups'));
|
||||
}
|
||||
|
||||
// Enable all avatars in the ACP
|
||||
protected function enable_all_avatars()
|
||||
{
|
||||
$this->add_lang('acp/board');
|
||||
|
||||
$crawler = self::request('GET', 'adm/index.php?i=board&mode=avatar&sid=' . $this->sid);
|
||||
// Check the default entries we should have
|
||||
$this->assertContains($this->lang('ALLOW_REMOTE'), $crawler->text());
|
||||
$this->assertContains($this->lang('ALLOW_AVATARS'), $crawler->text());
|
||||
$this->assertContains($this->lang('ALLOW_LOCAL'), $crawler->text());
|
||||
|
||||
// Now start setting the needed settings
|
||||
$form = $crawler->selectButton($this->lang('SUBMIT'))->form();
|
||||
$form['config[allow_avatar_local]']->select(1);
|
||||
$form['config[allow_avatar_remote]']->select(1);
|
||||
$form['config[allow_avatar_remote_upload]']->select(1);
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContains($this->lang('CONFIG_UPDATED'), $crawler->text());
|
||||
}
|
||||
|
||||
public function groups_manage_test_data()
|
||||
{
|
||||
return array(
|
||||
@@ -60,4 +80,34 @@ abstract class phpbb_functional_common_groups_test extends phpbb_functional_test
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContains($this->lang($expected), $crawler->text());
|
||||
}
|
||||
|
||||
public function group_avatar_min_max_data()
|
||||
{
|
||||
return array(
|
||||
array('avatar_driver_upload', 'avatar_upload_url', 'foo', 'AVATAR_URL_INVALID'),
|
||||
array('avatar_driver_upload', 'avatar_upload_url', 'foobar', 'AVATAR_URL_INVALID'),
|
||||
array('avatar_driver_upload', 'avatar_upload_url', 'http://www.phpbb.com/' . str_repeat('f', 240) . '.png', 'TOO_LONG'),
|
||||
array('avatar_driver_remote', 'avatar_remote_url', 'foo', 'AVATAR_URL_INVALID'),
|
||||
array('avatar_driver_remote', 'avatar_remote_url', 'foobar', 'AVATAR_URL_INVALID'),
|
||||
array('avatar_driver_remote', 'avatar_remote_url', 'http://www.phpbb.com/' . str_repeat('f', 240) . '.png', 'TOO_LONG'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider group_avatar_min_max_data
|
||||
*/
|
||||
public function test_group_avatar_min_max($avatar_type, $form_name, $input, $expected)
|
||||
{
|
||||
$this->login();
|
||||
$this->admin_login();
|
||||
$this->add_lang(array('ucp', 'acp/groups'));
|
||||
$this->enable_all_avatars();
|
||||
|
||||
$crawler = self::request('GET', $this->get_url() . '&g=5&sid=' . $this->sid);
|
||||
$form = $crawler->selectButton($this->lang('SUBMIT'))->form();
|
||||
$form['avatar_driver']->setValue($avatar_type);
|
||||
$form[$form_name]->setValue($input);
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContains($this->lang($expected), $crawler->text());
|
||||
}
|
||||
}
|
||||
|
@@ -6,7 +6,6 @@
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php';
|
||||
|
||||
/**
|
||||
* @group functional
|
||||
|
@@ -6,8 +6,6 @@
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php';
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/acp/acp_modules.php';
|
||||
|
||||
/**
|
||||
|
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');
|
||||
}
|
||||
}
|
@@ -7,8 +7,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php';
|
||||
|
||||
/**
|
||||
* @group functional
|
||||
*/
|
||||
|
39
tests/functional/paging_test.php
Normal file
39
tests/functional/paging_test.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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_paging_test extends phpbb_functional_test_case
|
||||
{
|
||||
|
||||
public function test_pagination()
|
||||
{
|
||||
$this->login();
|
||||
|
||||
$post = $this->create_topic(2, 'Test Topic 1', 'This is a test topic posted by the testing framework.');
|
||||
for ($post_id = 1; $post_id < 20; $post_id++)
|
||||
{
|
||||
$this->create_post(2, $post['topic_id'], 'Re: Test Topic 1', 'This is a test post no' . $post_id . ' posted by the testing framework.');
|
||||
}
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}");
|
||||
$this->assertContains('post no9', $crawler->text());
|
||||
$this->assertNotContains('post no19', $crawler->text());
|
||||
|
||||
$next_link = $crawler->filter('#viewtopic > fieldset > a.arrow-right')->attr('href');
|
||||
$crawler = self::request('GET', $next_link);
|
||||
$this->assertContains('post no19', $crawler->text());
|
||||
$this->assertNotContains('post no9', $crawler->text());
|
||||
|
||||
$prev_link = $crawler->filter('#viewtopic > fieldset > a.arrow-left')->attr('href');
|
||||
$crawler = self::request('GET', $prev_link);
|
||||
$this->assertContains('post no9', $crawler->text());
|
||||
$this->assertNotContains('post no19', $crawler->text());
|
||||
}
|
||||
}
|
@@ -32,105 +32,4 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case
|
||||
$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());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a topic
|
||||
*
|
||||
* Be sure to login before creating
|
||||
*
|
||||
* @param int $forum_id
|
||||
* @param string $subject
|
||||
* @param string $message
|
||||
* @param array $additional_form_data Any additional form data to be sent in the request
|
||||
* @return array post_id, topic_id
|
||||
*/
|
||||
public function create_topic($forum_id, $subject, $message, $additional_form_data = array())
|
||||
{
|
||||
$posting_url = "posting.php?mode=post&f={$forum_id}&sid={$this->sid}";
|
||||
|
||||
$form_data = array_merge(array(
|
||||
'subject' => $subject,
|
||||
'message' => $message,
|
||||
'post' => true,
|
||||
), $additional_form_data);
|
||||
|
||||
return self::submit_post($posting_url, 'POST_TOPIC', $form_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a post
|
||||
*
|
||||
* Be sure to login before creating
|
||||
*
|
||||
* @param int $forum_id
|
||||
* @param string $subject
|
||||
* @param string $message
|
||||
* @param array $additional_form_data Any additional form data to be sent in the request
|
||||
* @return array post_id, topic_id
|
||||
*/
|
||||
public function create_post($forum_id, $topic_id, $subject, $message, $additional_form_data = array())
|
||||
{
|
||||
$posting_url = "posting.php?mode=reply&f={$forum_id}&t={$topic_id}&sid={$this->sid}";
|
||||
|
||||
$form_data = array_merge(array(
|
||||
'subject' => $subject,
|
||||
'message' => $message,
|
||||
'post' => true,
|
||||
), $additional_form_data);
|
||||
|
||||
return self::submit_post($posting_url, 'POST_REPLY', $form_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper for submitting posts
|
||||
*
|
||||
* @param string $posting_url
|
||||
* @param string $posting_contains
|
||||
* @param array $form_data
|
||||
* @return array post_id, topic_id
|
||||
*/
|
||||
protected function submit_post($posting_url, $posting_contains, $form_data)
|
||||
{
|
||||
$this->add_lang('posting');
|
||||
|
||||
$crawler = self::request('GET', $posting_url);
|
||||
$this->assertContains($this->lang($posting_contains), $crawler->filter('html')->text());
|
||||
|
||||
$hidden_fields = array(
|
||||
$crawler->filter('[type="hidden"]')->each(function ($node, $i) {
|
||||
return array('name' => $node->getAttribute('name'), 'value' => $node->getAttribute('value'));
|
||||
}),
|
||||
);
|
||||
|
||||
foreach ($hidden_fields as $fields)
|
||||
{
|
||||
foreach($fields as $field)
|
||||
{
|
||||
$form_data[$field['name']] = $field['value'];
|
||||
}
|
||||
}
|
||||
|
||||
// Bypass time restriction that said that if the lastclick time (i.e. time when the form was opened)
|
||||
// is not at least 2 seconds before submission, cancel the form
|
||||
$form_data['lastclick'] = 0;
|
||||
|
||||
// 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 = 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();
|
||||
|
||||
$matches = $topic_id = $post_id = false;
|
||||
preg_match_all('#&t=([0-9]+)(&p=([0-9]+))?#', $url, $matches);
|
||||
|
||||
$topic_id = (int) (isset($matches[1][0])) ? $matches[1][0] : 0;
|
||||
$post_id = (int) (isset($matches[3][0])) ? $matches[3][0] : 0;
|
||||
|
||||
return array(
|
||||
'topic_id' => $topic_id,
|
||||
'post_id' => $post_id,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
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);
|
||||
}
|
||||
}
|
761
tests/functional/softdelete_test.php
Normal file
761
tests/functional/softdelete_test.php
Normal file
@@ -0,0 +1,761 @@
|
||||
<?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_softdelete_test extends phpbb_functional_test_case
|
||||
{
|
||||
protected $data = array();
|
||||
|
||||
public function test_setup_forums()
|
||||
{
|
||||
$this->login();
|
||||
$this->admin_login();
|
||||
|
||||
$crawler = self::request('GET', "adm/index.php?i=acp_forums&mode=manage&sid={$this->sid}");
|
||||
$form = $crawler->selectButton('addforum')->form(array(
|
||||
'forum_name' => 'Soft Delete #1',
|
||||
));
|
||||
$crawler = self::submit($form);
|
||||
$form = $crawler->selectButton('update')->form(array(
|
||||
'forum_perm_from' => 2,
|
||||
));
|
||||
$crawler = self::submit($form);
|
||||
|
||||
$crawler = self::request('GET', "adm/index.php?i=acp_forums&mode=manage&sid={$this->sid}");
|
||||
$form = $crawler->selectButton('addforum')->form(array(
|
||||
'forum_name' => 'Soft Delete #2',
|
||||
));
|
||||
$crawler = self::submit($form);
|
||||
$form = $crawler->selectButton('update')->form(array(
|
||||
'forum_perm_from' => 2,
|
||||
));
|
||||
$crawler = self::submit($form);
|
||||
}
|
||||
|
||||
public function test_create_post()
|
||||
{
|
||||
$this->login();
|
||||
$this->load_ids(array(
|
||||
'forums' => array(
|
||||
'Soft Delete #1',
|
||||
'Soft Delete #2',
|
||||
),
|
||||
));
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
|
||||
'forum_posts_approved' => 0,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 0,
|
||||
'forum_topics_approved' => 0,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 0,
|
||||
'forum_last_post_id' => 0,
|
||||
), 'initial comparison');
|
||||
|
||||
// Test creating topic
|
||||
$post = $this->create_topic($this->data['forums']['Soft Delete #1'], 'Soft Delete Topic #1', 'This is a test topic posted by the testing framework.');
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}");
|
||||
|
||||
$this->assertContains('Soft Delete Topic #1', $crawler->filter('html')->text());
|
||||
$this->data['topics']['Soft Delete Topic #1'] = (int) $post['topic_id'];
|
||||
$this->data['posts']['Soft Delete Topic #1'] = (int) $this->get_parameter_from_link($crawler->filter('.post')->selectLink($this->lang('POST', '', ''))->link()->getUri(), 'p');
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
|
||||
'forum_posts_approved' => 1,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 0,
|
||||
'forum_topics_approved' => 1,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 0,
|
||||
'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
|
||||
), 'after creating topic #1');
|
||||
|
||||
// Test creating a reply
|
||||
$post2 = $this->create_post($this->data['forums']['Soft Delete #1'], $post['topic_id'], 'Re: Soft Delete Topic #1-#2', 'This is a test post posted by the testing framework.');
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$post2['topic_id']}&sid={$this->sid}");
|
||||
|
||||
$this->assertContains('Re: Soft Delete Topic #1-#2', $crawler->filter('html')->text());
|
||||
$this->data['posts']['Re: Soft Delete Topic #1-#2'] = (int) $this->get_parameter_from_link($crawler->filter('.post')->eq(1)->selectLink($this->lang('POST', '', ''))->link()->getUri(), 'p');
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
|
||||
'forum_posts_approved' => 2,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 0,
|
||||
'forum_topics_approved' => 1,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 0,
|
||||
'forum_last_post_id' => $this->data['posts']['Re: Soft Delete Topic #1-#2'],
|
||||
), 'after replying');
|
||||
}
|
||||
|
||||
public function test_softdelete_post()
|
||||
{
|
||||
$this->login();
|
||||
$this->load_ids(array(
|
||||
'forums' => array(
|
||||
'Soft Delete #1',
|
||||
'Soft Delete #2',
|
||||
),
|
||||
'topics' => array(
|
||||
'Soft Delete Topic #1',
|
||||
),
|
||||
'posts' => array(
|
||||
'Soft Delete Topic #1',
|
||||
'Re: Soft Delete Topic #1-#2',
|
||||
),
|
||||
));
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
|
||||
'forum_posts_approved' => 2,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 0,
|
||||
'forum_topics_approved' => 1,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 0,
|
||||
'forum_last_post_id' => $this->data['posts']['Re: Soft Delete Topic #1-#2'],
|
||||
), 'before softdelete');
|
||||
|
||||
$this->add_lang('posting');
|
||||
$crawler = self::request('GET', "posting.php?mode=delete&f={$this->data['forums']['Soft Delete #1']}&p={$this->data['posts']['Re: Soft Delete Topic #1-#2']}&sid={$this->sid}");
|
||||
$this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text());
|
||||
|
||||
$form = $crawler->selectButton('Yes')->form();
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContainsLang('POST_DELETED', $crawler->text());
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
|
||||
'forum_posts_approved' => 1,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 1,
|
||||
'forum_topics_approved' => 1,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 0,
|
||||
'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
|
||||
), 'after softdelete');
|
||||
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
|
||||
$this->assertContains($this->lang('POST_DISPLAY', '', ''), $crawler->text());
|
||||
}
|
||||
|
||||
public function test_move_softdeleted_post()
|
||||
{
|
||||
$this->login();
|
||||
$this->load_ids(array(
|
||||
'forums' => array(
|
||||
'Soft Delete #1',
|
||||
'Soft Delete #2',
|
||||
),
|
||||
'topics' => array(
|
||||
'Soft Delete Topic #1',
|
||||
),
|
||||
'posts' => array(
|
||||
'Soft Delete Topic #1',
|
||||
'Re: Soft Delete Topic #1-#2',
|
||||
),
|
||||
));
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
|
||||
'forum_posts_approved' => 1,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 1,
|
||||
'forum_topics_approved' => 1,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 0,
|
||||
'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
|
||||
), 'before moving #1');
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
|
||||
'forum_posts_approved' => 0,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 0,
|
||||
'forum_topics_approved' => 0,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 0,
|
||||
'forum_last_post_id' => 0,
|
||||
), 'before moving #2');
|
||||
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
|
||||
|
||||
$form = $crawler->selectButton('Go')->eq(2)->form();
|
||||
$form['action']->select('move');
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContainsLang('SELECT_DESTINATION_FORUM', $crawler->text());
|
||||
|
||||
$this->add_lang('mcp');
|
||||
$form = $crawler->selectButton('Yes')->form();
|
||||
$form['to_forum_id']->select($this->data['forums']['Soft Delete #2']);
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContainsLang('TOPIC_MOVED_SUCCESS', $crawler->text());
|
||||
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
|
||||
$this->assertContains('Soft Delete #2', $crawler->filter('.navlinks')->text());
|
||||
$this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text());
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
|
||||
'forum_posts_approved' => 0,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 0,
|
||||
'forum_topics_approved' => 0,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 0,
|
||||
'forum_last_post_id' => 0,
|
||||
), 'after moving #1');
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
|
||||
'forum_posts_approved' => 1,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 1,
|
||||
'forum_topics_approved' => 1,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 0,
|
||||
'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
|
||||
), 'after moving #2');
|
||||
}
|
||||
|
||||
public function test_softdelete_topic()
|
||||
{
|
||||
$this->login();
|
||||
$this->load_ids(array(
|
||||
'forums' => array(
|
||||
'Soft Delete #1',
|
||||
'Soft Delete #2',
|
||||
),
|
||||
'topics' => array(
|
||||
'Soft Delete Topic #1',
|
||||
),
|
||||
'posts' => array(
|
||||
'Soft Delete Topic #1',
|
||||
'Re: Soft Delete Topic #1-#2',
|
||||
),
|
||||
));
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
|
||||
'forum_posts_approved' => 0,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 0,
|
||||
'forum_topics_approved' => 0,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 0,
|
||||
'forum_last_post_id' => 0,
|
||||
), 'before softdeleting #1');
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
|
||||
'forum_posts_approved' => 1,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 1,
|
||||
'forum_topics_approved' => 1,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 0,
|
||||
'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
|
||||
), 'before softdeleting #2');
|
||||
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
|
||||
|
||||
$this->add_lang('posting');
|
||||
$form = $crawler->selectButton('Go')->eq(2)->form();
|
||||
$form['action']->select('delete_topic');
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text());
|
||||
|
||||
$this->add_lang('mcp');
|
||||
$form = $crawler->selectButton('Yes')->form();
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContainsLang('TOPIC_DELETED_SUCCESS', $crawler->text());
|
||||
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
|
||||
$this->assertContains('Soft Delete #2', $crawler->filter('.navlinks')->text());
|
||||
$this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text());
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
|
||||
'forum_posts_approved' => 0,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 0,
|
||||
'forum_topics_approved' => 0,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 0,
|
||||
'forum_last_post_id' => 0,
|
||||
), 'after moving #1');
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
|
||||
'forum_posts_approved' => 0,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 2,
|
||||
'forum_topics_approved' => 0,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 1,
|
||||
'forum_last_post_id' => 0,
|
||||
), 'after moving #2');
|
||||
}
|
||||
|
||||
public function test_move_softdeleted_topic()
|
||||
{
|
||||
$this->login();
|
||||
$this->load_ids(array(
|
||||
'forums' => array(
|
||||
'Soft Delete #1',
|
||||
'Soft Delete #2',
|
||||
),
|
||||
'topics' => array(
|
||||
'Soft Delete Topic #1',
|
||||
),
|
||||
'posts' => array(
|
||||
'Soft Delete Topic #1',
|
||||
'Re: Soft Delete Topic #1-#2',
|
||||
),
|
||||
));
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
|
||||
'forum_posts_approved' => 0,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 0,
|
||||
'forum_topics_approved' => 0,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 0,
|
||||
'forum_last_post_id' => 0,
|
||||
), 'before moving #1');
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
|
||||
'forum_posts_approved' => 0,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 2,
|
||||
'forum_topics_approved' => 0,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 1,
|
||||
'forum_last_post_id' => 0,
|
||||
), 'before moving #2');
|
||||
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
|
||||
|
||||
$form = $crawler->selectButton('Go')->eq(2)->form();
|
||||
$form['action']->select('move');
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContainsLang('SELECT_DESTINATION_FORUM', $crawler->text());
|
||||
|
||||
$this->add_lang('mcp');
|
||||
$form = $crawler->selectButton('Yes')->form();
|
||||
$form['to_forum_id']->select($this->data['forums']['Soft Delete #1']);
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContainsLang('TOPIC_MOVED_SUCCESS', $crawler->text());
|
||||
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
|
||||
$this->assertContains('Soft Delete #1', $crawler->filter('.navlinks')->text());
|
||||
$this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text());
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
|
||||
'forum_posts_approved' => 0,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 2,
|
||||
'forum_topics_approved' => 0,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 1,
|
||||
'forum_last_post_id' => 0,
|
||||
), 'after moving #1');
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
|
||||
'forum_posts_approved' => 0,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 0,
|
||||
'forum_topics_approved' => 0,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 0,
|
||||
'forum_last_post_id' => 0,
|
||||
), 'after moving #2');
|
||||
}
|
||||
|
||||
public function test_restore_post()
|
||||
{
|
||||
$this->login();
|
||||
$this->load_ids(array(
|
||||
'forums' => array(
|
||||
'Soft Delete #1',
|
||||
'Soft Delete #2',
|
||||
),
|
||||
'topics' => array(
|
||||
'Soft Delete Topic #1',
|
||||
),
|
||||
'posts' => array(
|
||||
'Soft Delete Topic #1',
|
||||
'Re: Soft Delete Topic #1-#2',
|
||||
),
|
||||
));
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
|
||||
'forum_posts_approved' => 0,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 2,
|
||||
'forum_topics_approved' => 0,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 1,
|
||||
'forum_last_post_id' => 0,
|
||||
), 'before restoring #1');
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
|
||||
'forum_posts_approved' => 0,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 0,
|
||||
'forum_topics_approved' => 0,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 0,
|
||||
'forum_last_post_id' => 0,
|
||||
), 'before restoring #2');
|
||||
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
|
||||
|
||||
$this->add_lang('mcp');
|
||||
$form = $crawler->selectButton($this->lang('RESTORE'))->form();
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContainsLang('RESTORE_POST', $crawler->text());
|
||||
|
||||
$form = $crawler->selectButton('Yes')->form();
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContainsLang('POST_RESTORED_SUCCESS', $crawler->text());
|
||||
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
|
||||
$this->assertContains('Soft Delete #1', $crawler->filter('.navlinks')->text());
|
||||
$this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text());
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
|
||||
'forum_posts_approved' => 1,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 1,
|
||||
'forum_topics_approved' => 1,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 0,
|
||||
'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
|
||||
), 'after restoring #1');
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
|
||||
'forum_posts_approved' => 0,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 0,
|
||||
'forum_topics_approved' => 0,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 0,
|
||||
'forum_last_post_id' => 0,
|
||||
), 'after restoring #2');
|
||||
}
|
||||
|
||||
public function test_split_topic()
|
||||
{
|
||||
$this->login();
|
||||
$this->load_ids(array(
|
||||
'forums' => array(
|
||||
'Soft Delete #1',
|
||||
'Soft Delete #2',
|
||||
),
|
||||
'topics' => array(
|
||||
'Soft Delete Topic #1',
|
||||
),
|
||||
'posts' => array(
|
||||
'Soft Delete Topic #1',
|
||||
'Re: Soft Delete Topic #1-#2',
|
||||
),
|
||||
));
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
|
||||
'forum_posts_approved' => 1,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 1,
|
||||
'forum_topics_approved' => 1,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 0,
|
||||
'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
|
||||
), 'before splitting #1');
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
|
||||
'forum_posts_approved' => 0,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 0,
|
||||
'forum_topics_approved' => 0,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 0,
|
||||
'forum_last_post_id' => 0,
|
||||
), 'before splitting #2');
|
||||
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
|
||||
|
||||
$this->add_lang('mcp');
|
||||
$form = $crawler->selectButton('Go')->eq(2)->form();
|
||||
$form['action']->select('split');
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContainsLang('SPLIT_TOPIC_EXPLAIN', $crawler->text());
|
||||
|
||||
$form = $crawler->selectButton('Submit')->form(array(
|
||||
'subject' => 'Soft Delete Topic #2',
|
||||
));
|
||||
$form['to_forum_id']->select($this->data['forums']['Soft Delete #2']);
|
||||
$form['post_id_list'][1]->tick();
|
||||
$crawler = self::submit($form);
|
||||
|
||||
$form = $crawler->selectButton('Yes')->form();
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContainsLang('TOPIC_SPLIT_SUCCESS', $crawler->text());
|
||||
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
|
||||
$this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text());
|
||||
$this->assertNotContains('Re: Soft Delete Topic #1-#2', $crawler->text());
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
|
||||
'forum_posts_approved' => 1,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 0,
|
||||
'forum_topics_approved' => 1,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 0,
|
||||
'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
|
||||
), 'after restoring #1');
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
|
||||
'forum_posts_approved' => 0,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 1,
|
||||
'forum_topics_approved' => 0,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 1,
|
||||
'forum_last_post_id' => 0,
|
||||
), 'after restoring #2');
|
||||
}
|
||||
|
||||
public function test_move_topic_back()
|
||||
{
|
||||
$this->login();
|
||||
$this->load_ids(array(
|
||||
'forums' => array(
|
||||
'Soft Delete #1',
|
||||
'Soft Delete #2',
|
||||
),
|
||||
'topics' => array(
|
||||
'Soft Delete Topic #1',
|
||||
'Soft Delete Topic #2',
|
||||
),
|
||||
'posts' => array(
|
||||
'Soft Delete Topic #1',
|
||||
'Re: Soft Delete Topic #1-#2',
|
||||
),
|
||||
));
|
||||
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #2']}&sid={$this->sid}");
|
||||
|
||||
$form = $crawler->selectButton('Go')->eq(1)->form();
|
||||
$form['action']->select('move');
|
||||
$crawler = self::submit($form);
|
||||
|
||||
$form = $crawler->selectButton('Yes')->form();
|
||||
$form['to_forum_id']->select($this->data['forums']['Soft Delete #1']);
|
||||
$crawler = self::submit($form);
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
|
||||
'forum_posts_approved' => 1,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 1,
|
||||
'forum_topics_approved' => 1,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 1,
|
||||
'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
|
||||
), 'after moving back');
|
||||
}
|
||||
|
||||
public function test_merge_topics()
|
||||
{
|
||||
$this->login();
|
||||
$this->load_ids(array(
|
||||
'forums' => array(
|
||||
'Soft Delete #1',
|
||||
'Soft Delete #2',
|
||||
),
|
||||
'topics' => array(
|
||||
'Soft Delete Topic #1',
|
||||
'Soft Delete Topic #2',
|
||||
),
|
||||
'posts' => array(
|
||||
'Soft Delete Topic #1',
|
||||
'Re: Soft Delete Topic #1-#2',
|
||||
),
|
||||
));
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
|
||||
'forum_posts_approved' => 1,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 1,
|
||||
'forum_topics_approved' => 1,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 1,
|
||||
'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
|
||||
), 'before merging #1');
|
||||
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #2']}&sid={$this->sid}");
|
||||
|
||||
$this->add_lang('mcp');
|
||||
$form = $crawler->selectButton('Go')->eq(1)->form();
|
||||
$form['action']->select('merge_topic');
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContainsLang('SELECT_MERGE', $crawler->text());
|
||||
|
||||
$crawler = self::request('GET', "mcp.php?f={$this->data['forums']['Soft Delete #1']}&t={$this->data['topics']['Soft Delete Topic #2']}&i=main&mode=forum_view&action=merge_topic&to_topic_id={$this->data['topics']['Soft Delete Topic #1']}");
|
||||
$this->assertContainsLang('MERGE_TOPICS_CONFIRM', $crawler->text());
|
||||
|
||||
$form = $crawler->selectButton('Yes')->form();
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContainsLang('POSTS_MERGED_SUCCESS', $crawler->text());
|
||||
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
|
||||
$this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text());
|
||||
$this->assertContainsLang('POST_DELETED', $crawler->filter('body')->text());
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
|
||||
'forum_posts_approved' => 1,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 1,
|
||||
'forum_topics_approved' => 1,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 0,
|
||||
'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
|
||||
), 'after merging #1');
|
||||
}
|
||||
|
||||
public function test_fork_topic()
|
||||
{
|
||||
$this->login();
|
||||
$this->load_ids(array(
|
||||
'forums' => array(
|
||||
'Soft Delete #1',
|
||||
'Soft Delete #2',
|
||||
),
|
||||
'topics' => array(
|
||||
'Soft Delete Topic #1',
|
||||
),
|
||||
'posts' => array(
|
||||
'Soft Delete Topic #1',
|
||||
'Re: Soft Delete Topic #1-#2',
|
||||
),
|
||||
));
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
|
||||
'forum_posts_approved' => 1,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 1,
|
||||
'forum_topics_approved' => 1,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 0,
|
||||
'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
|
||||
), 'before forking #1');
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
|
||||
'forum_posts_approved' => 0,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 0,
|
||||
'forum_topics_approved' => 0,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 0,
|
||||
'forum_last_post_id' => 0,
|
||||
), 'before forking #2');
|
||||
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
|
||||
|
||||
$this->add_lang('mcp');
|
||||
$form = $crawler->selectButton('Go')->eq(2)->form();
|
||||
$form['action']->select('fork');
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContainsLang('FORK_TOPIC', $crawler->text());
|
||||
|
||||
$form = $crawler->selectButton('Yes')->form();
|
||||
$form['to_forum_id']->select($this->data['forums']['Soft Delete #2']);
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContainsLang('TOPIC_FORKED_SUCCESS', $crawler->text());
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
|
||||
'forum_posts_approved' => 1,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 1,
|
||||
'forum_topics_approved' => 1,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 0,
|
||||
'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
|
||||
), 'after forking #1');
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
|
||||
'forum_posts_approved' => 1,
|
||||
'forum_posts_unapproved' => 0,
|
||||
'forum_posts_softdeleted' => 1,
|
||||
'forum_topics_approved' => 1,
|
||||
'forum_topics_unapproved' => 0,
|
||||
'forum_topics_softdeleted' => 0,
|
||||
'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'] + 2,
|
||||
), 'after forking #2');
|
||||
}
|
||||
|
||||
public function assert_forum_details($forum_id, $details, $additional_error_message = '')
|
||||
{
|
||||
$this->db = $this->get_db();
|
||||
|
||||
$sql = 'SELECT ' . implode(', ', array_keys($details)) . '
|
||||
FROM phpbb_forums
|
||||
WHERE forum_id = ' . (int) $forum_id;
|
||||
$result = $this->db->sql_query($sql);
|
||||
$data = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$this->assertEquals($details, $data, "Forum {$forum_id} does not match expected {$additional_error_message}");
|
||||
}
|
||||
|
||||
public function load_ids($data)
|
||||
{
|
||||
$this->db = $this->get_db();
|
||||
|
||||
if (!empty($data['forums']))
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM phpbb_forums
|
||||
WHERE ' . $this->db->sql_in_set('forum_name', $data['forums']);
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
if (in_array($row['forum_name'], $data['forums']))
|
||||
{
|
||||
$this->data['forums'][$row['forum_name']] = (int) $row['forum_id'];
|
||||
}
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
if (!empty($data['topics']))
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM phpbb_topics
|
||||
WHERE ' . $this->db->sql_in_set('topic_title', $data['topics']);
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
if (in_array($row['topic_title'], $data['topics']))
|
||||
{
|
||||
$this->data['topics'][$row['topic_title']] = (int) $row['topic_id'];
|
||||
}
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
if (!empty($data['posts']))
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM phpbb_posts
|
||||
WHERE ' . $this->db->sql_in_set('post_subject', $data['posts']);
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
if (in_array($row['post_subject'], $data['posts']))
|
||||
{
|
||||
$this->data['posts'][$row['post_subject']] = (int) $row['post_id'];
|
||||
}
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user