1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-01 14:30:32 +02:00

Merge pull request #5760 from v12mike/ticket/16138

Ticket/16138 Eliminate redundant parameters from board URLs
This commit is contained in:
Marc Alexander
2021-08-23 20:11:35 +02:00
39 changed files with 288 additions and 226 deletions

View File

@@ -107,7 +107,7 @@ class phpbb_functional_download_test extends phpbb_functional_test_case
));
$this->add_lang('posting');
$crawler = self::request('GET', "posting.php?mode=delete&f={$this->data['forums']['Download #1']}&p={$this->data['posts']['Re: Download Topic #1-#2']}&sid={$this->sid}");
$crawler = self::request('GET', "posting.php?mode=delete&p={$this->data['posts']['Re: Download Topic #1-#2']}&sid={$this->sid}");
$this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text());
$form = $crawler->selectButton('Yes')->form();

View File

@@ -524,7 +524,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
));
$this->add_lang('posting');
$crawler = self::request('GET', "posting.php?mode=delete&f={$this->data['forums']['Feeds #1']}&p={$this->data['posts']['Re: Feeds #1 - Topic #2']}&sid={$this->sid}");
$crawler = self::request('GET', "posting.php?mode=delete&p={$this->data['posts']['Re: Feeds #1 - Topic #2']}&sid={$this->sid}");
self::assertContainsLang('DELETE_PERMANENTLY', $crawler->text());
$form = $crawler->selectButton('Yes')->form();

View File

@@ -63,7 +63,7 @@ class phpbb_functional_fileupload_form_test extends phpbb_functional_test_case
$crawler = self::$client->request(
'POST',
'posting.php?mode=reply&f=2&t=1&sid=' . $this->sid,
'posting.php?mode=reply&t=1&sid=' . $this->sid,
$file_form_data,
array('fileupload' => $file)
);

View File

@@ -63,7 +63,7 @@ class phpbb_functional_plupload_test extends phpbb_functional_test_case
public function get_urls()
{
return array(
array('posting.php?mode=reply&f=2&t=1'),
array('posting.php?mode=reply&t=1'),
array('ucp.php?i=pm&mode=compose'),
);
}

View File

@@ -33,7 +33,7 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case
$this->assertStringContainsString('This is a test post posted by the testing framework.', $crawler->filter('html')->text());
// Test quoting a message
$crawler = self::request('GET', "posting.php?mode=quote&f=2&t={$post2['topic_id']}&p={$post2['post_id']}&sid={$this->sid}");
$crawler = self::request('GET', "posting.php?mode=quote&p={$post2['post_id']}&sid={$this->sid}");
$this->assertStringContainsString('This is a test post posted by the testing framework.', $crawler->filter('html')->text());
}
@@ -76,7 +76,7 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case
$topic = $this->create_topic(2, 'Test Topic 1', 'Test topic');
$post = $this->create_post(2, $topic['topic_id'], 'Re: Test Topic 1', $text);
$crawler = self::request('GET', "posting.php?mode=quote&f=2&t={$post['topic_id']}&p={$post['post_id']}&sid={$this->sid}");
$crawler = self::request('GET', "posting.php?mode=quote&p={$post['post_id']}&sid={$this->sid}");
$this->assertRegexp($expected, $crawler->filter('textarea#message')->text());
}
@@ -91,7 +91,7 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case
$url = self::$client->getCrawler()->selectLink('Edit')->link()->getUri();
$post_id = $this->get_parameter_from_link($url, 'p');
$crawler = self::request('GET', "posting.php?mode=edit&f=2&p={$post_id}&sid={$this->sid}");
$crawler = self::request('GET', "posting.php?mode=edit&p={$post_id}&sid={$this->sid}");
$form = $crawler->selectButton('Submit')->form();
$form->setValues(array('message' => 'Edited post'));
$crawler = self::submit($form);
@@ -115,7 +115,7 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case
$this->login();
$topic = $this->create_topic(2, 'Test Topic 1', 'Test topic');
$post = $this->create_post(2, $topic['topic_id'], 'Re: Test Topic 1', $text);
$quote_url = "posting.php?mode=quote&f=2&t={$post['topic_id']}&p={$post['post_id']}&sid={$this->sid}";
$quote_url = "posting.php?mode=quote&p={$post['post_id']}&sid={$this->sid}";
$this->admin_login();
foreach ($expected as $quote_depth => $expected_text)

View File

@@ -176,7 +176,7 @@ class phpbb_functional_visibility_disapprove_test extends phpbb_functional_test_
$link = $crawler->selectLink($this->lang('RETURN_PAGE', '', ''))->link();
$link_url = $link->getUri();
$this->assertStringContainsString('viewtopic.php?f=' . $this->data['forums']['Disapprove Test #1'] . '&t=' . $this->data['topics']['Disapprove Test Topic #1'], $link_url);
$this->assertStringContainsString('viewtopic.php?t=' . $this->data['topics']['Disapprove Test Topic #1'], $link_url);
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Disapprove Test Topic #1']}&sid={$this->sid}");
$this->assertStringContainsString('Disapprove Test Topic #1', $crawler->filter('html')->text());

View File

@@ -167,7 +167,7 @@ class phpbb_functional_visibility_reapprove_test extends phpbb_functional_test_c
$link = $crawler->selectLink($this->lang('RETURN_PAGE', '', ''))->link();
$link_url = $link->getUri();
$this->assertStringContainsString('viewtopic.php?f=' . $this->data['forums']['Reapprove Test #1'] . '&t=' . $this->data['topics']['Reapprove Test Topic #1'], $link_url);
$this->assertStringContainsString('viewtopic.php?t=' . $this->data['topics']['Reapprove Test Topic #1'], $link_url);
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Reapprove Test Topic #1']}&sid={$this->sid}");
$this->assertStringContainsString('Reapprove Test Topic #1', $crawler->filter('h2')->text());
@@ -226,7 +226,7 @@ class phpbb_functional_visibility_reapprove_test extends phpbb_functional_test_c
$link = $crawler->selectLink($this->lang('RETURN_PAGE', '', ''))->link();
$link_url = $link->getUri();
$this->assertStringContainsString('viewtopic.php?f=' . $this->data['forums']['Reapprove Test #1'], $link_url);
$this->assertStringContainsString('viewtopic.php?t=' . $this->data['topics']['Reapprove Test Topic #2'], $link_url);
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Reapprove Test Topic #2']}&sid={$this->sid}");
$this->assertStringContainsString('Reapprove Test Topic #2', $crawler->filter('h2')->text());
@@ -264,7 +264,7 @@ class phpbb_functional_visibility_reapprove_test extends phpbb_functional_test_c
$this->add_user_group('NEWLY_REGISTERED', array('reapprove_testuser'));
// Test editing a post
$posting_url = "posting.php?mode=edit&f={$this->data['forums']['Reapprove Test #1']}&p={$this->data['posts']['Re: Reapprove Test Topic #1-#2']}&sid={$this->sid}";
$posting_url = "posting.php?mode=edit&p={$this->data['posts']['Re: Reapprove Test Topic #1-#2']}&sid={$this->sid}";
$form_data = array(
'message' => 'Post edited by testing framework',
'subject' => 'Re: Reapprove Test Topic #1-#2',
@@ -287,7 +287,7 @@ class phpbb_functional_visibility_reapprove_test extends phpbb_functional_test_c
), 'after editing post');
// Test editing a topic
$posting_url = "posting.php?mode=edit&f={$this->data['forums']['Reapprove Test #1']}&p={$this->data['posts']['Reapprove Test Topic #2']}&sid={$this->sid}";
$posting_url = "posting.php?mode=edit&p={$this->data['posts']['Reapprove Test Topic #2']}&sid={$this->sid}";
$form_data = array(
'message' => 'Post edited by testing framework',
'subject' => 'Reapprove Test Topic #2',

View File

@@ -48,29 +48,29 @@ class phpbb_build_url_test extends phpbb_test_case
'phpBB/index.php?',
),
array(
'viewtopic.php?t=5&f=4',
'viewtopic.php?t=5',
false,
'phpBB/viewtopic.php?t=5&f=4',
'phpBB/viewtopic.php?t=5',
),
array(
'viewtopic.php?f=2&style=1&t=6',
'viewtopic.php?style=1&t=6',
'f',
'phpBB/viewtopic.php?style=1&t=6',
),
array(
'viewtopic.php?f=2&style=1&t=6',
'viewtopic.php?style=1&t=6',
array('f', 'style', 't'),
'phpBB/viewtopic.php?',
),
array(
'http://test.phpbb.com/viewtopic.php?f=2&style=1&t=6',
'http://test.phpbb.com/viewtopic.php?style=1&t=6',
array('f', 'style', 't'),
'http://test.phpbb.com/viewtopic.php?',
),
array(
'posting.php?f=2&mode=delete&p=20%22%3Cscript%3Ealert%281%29%3B%3C%2Fscript%3E',
'posting.php?mode=delete&p=20%22%3Cscript%3Ealert%281%29%3B%3C%2Fscript%3E',
false,
'phpBB/posting.php?f=2&mode=delete&p=20%22%3Cscript%3Ealert%281%29%3B%3C%2Fscript%3E',
'phpBB/posting.php?mode=delete&p=20%22%3Cscript%3Ealert%281%29%3B%3C%2Fscript%3E',
)
);
}

View File

@@ -153,7 +153,7 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case
'viewforum' => append_sid("phpBB/viewforum.$phpEx", 'f=23'),
'action' => '{LOG MOD}',
'viewtopic' => append_sid("phpBB/viewtopic.$phpEx", 'f=23&t=56'),
'viewtopic' => append_sid("phpBB/viewtopic.$phpEx", 't=56'),
'viewpost' => '',
'viewlogs' => append_sid("phpBB/mcp.$phpEx", 'i=logs&mode=topic_logs&t=56'),
),

View File

@@ -1140,12 +1140,13 @@ class phpbb_functional_test_case extends phpbb_test_case
*/
public function create_post($forum_id, $topic_id, $subject, $message, $additional_form_data = array(), $expected = '')
{
$posting_url = "posting.php?mode=reply&f={$forum_id}&t={$topic_id}&sid={$this->sid}";
$posting_url = "posting.php?mode=reply&t={$topic_id}&sid={$this->sid}";
$form_data = array_merge(array(
'subject' => $subject,
'message' => $message,
'post' => true,
'topic_id' => $topic_id,
), $additional_form_data);
return self::submit_post($posting_url, 'POST_REPLY', $form_data, $expected);
@@ -1181,8 +1182,14 @@ class phpbb_functional_test_case extends phpbb_test_case
$url = $crawler->selectLink($form_data['subject'])->link()->getUri();
$topic_id = $this->get_parameter_from_link($url, 't');
if (!$topic_id)
{
$topic_id = $form_data['topic_id'];
}
return array(
'topic_id' => $this->get_parameter_from_link($url, 't'),
'topic_id' => $topic_id,
'post_id' => $this->get_parameter_from_link($url, 'p'),
);
}
@@ -1303,7 +1310,7 @@ class phpbb_functional_test_case extends phpbb_test_case
public function delete_post($forum_id, $post_id)
{
$this->add_lang('posting');
$crawler = self::request('GET', "posting.php?mode=delete&f={$forum_id}&p={$post_id}&sid={$this->sid}");
$crawler = self::request('GET', "posting.php?mode=delete&p={$post_id}&sid={$this->sid}");
$this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text());
$form = $crawler->selectButton('Yes')->form();