From 465b515600d7639fcb46fd98810187e0b500ee91 Mon Sep 17 00:00:00 2001 From: sakimahesh Date: Fri, 26 Apr 2013 05:35:21 +0530 Subject: [PATCH 01/13] [ticket/9341] Correctly named template vars PHPBB3-9341 --- phpBB/includes/functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index b087e1298b..03a5b36a43 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2345,9 +2345,9 @@ function phpbb_generate_template_pagination($template, $base_url, $block_var_nam $tpl_prefix . 'BASE_URL' => $base_url, 'A_' . $tpl_prefix . 'BASE_URL' => addslashes($base_url), $tpl_prefix . 'PER_PAGE' => $per_page, - $tpl_prefix . 'PREVIOUS_PAGE' => $previous_page, + 'U_' . $tpl_prefix . 'PREVIOUS_PAGE' => $previous_page, $tpl_prefix . 'PREV_PAGE' => $previous_page, - $tpl_prefix . 'NEXT_PAGE' => ($on_page != $total_pages) ? $base_url . $url_delim . $start_name . '=' . ($on_page * $per_page) : '', + 'U_' . $tpl_prefix . 'NEXT_PAGE' => ($on_page != $total_pages) ? $base_url . $url_delim . $start_name . '=' . ($on_page * $per_page) : '', $tpl_prefix . 'TOTAL_PAGES' => $total_pages, $tpl_prefix . 'CURRENT_PAGE' => $on_page, ); From fdd60548bf7427471fa5585ec10f643c370bb829 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Thu, 20 Jun 2013 22:32:37 +0530 Subject: [PATCH 02/13] [ticket/9341] Use U_PREVIOUS and U_NEXT in template files PHPBB3-9341 --- phpBB/adm/style/acp_icons.html | 4 ++-- phpBB/styles/prosilver/template/mcp_forum.html | 4 ++-- phpBB/styles/prosilver/template/mcp_logs.html | 4 ++-- phpBB/styles/prosilver/template/mcp_notes_user.html | 4 ++-- phpBB/styles/prosilver/template/mcp_queue.html | 4 ++-- phpBB/styles/prosilver/template/mcp_reports.html | 4 ++-- phpBB/styles/prosilver/template/memberlist_body.html | 4 ++-- phpBB/styles/prosilver/template/search_results.html | 4 ++-- phpBB/styles/prosilver/template/ucp_attachments.html | 4 ++-- phpBB/styles/prosilver/template/ucp_pm_viewfolder.html | 4 ++-- phpBB/styles/prosilver/template/viewforum_body.html | 4 ++-- phpBB/styles/prosilver/template/viewonline_body.html | 4 ++-- phpBB/styles/prosilver/template/viewtopic_body.html | 6 +++--- 13 files changed, 27 insertions(+), 27 deletions(-) diff --git a/phpBB/adm/style/acp_icons.html b/phpBB/adm/style/acp_icons.html index 373a7b890c..eca02d2798 100644 --- a/phpBB/adm/style/acp_icons.html +++ b/phpBB/adm/style/acp_icons.html @@ -243,8 +243,8 @@ {items.EMOTION} - {ICON_MOVE_UP_DISABLED}{ICON_MOVE_UP}  - {ICON_MOVE_DOWN_DISABLED}{ICON_MOVE_DOWN} + {ICON_MOVE_UP_DISABLED}{ICON_MOVE_UP}  + {ICON_MOVE_DOWN_DISABLED}{ICON_MOVE_DOWN}  {ICON_EDIT} {ICON_DELETE} diff --git a/phpBB/styles/prosilver/template/mcp_forum.html b/phpBB/styles/prosilver/template/mcp_forum.html index ac686932b7..db5525fcd0 100644 --- a/phpBB/styles/prosilver/template/mcp_forum.html +++ b/phpBB/styles/prosilver/template/mcp_forum.html @@ -85,8 +85,8 @@
- {L_NEXT} - {L_PREVIOUS} + {L_NEXT} + {L_PREVIOUS} diff --git a/phpBB/styles/prosilver/template/mcp_logs.html b/phpBB/styles/prosilver/template/mcp_logs.html index c9db4e8afa..492c8cf201 100644 --- a/phpBB/styles/prosilver/template/mcp_logs.html +++ b/phpBB/styles/prosilver/template/mcp_logs.html @@ -54,8 +54,8 @@
- {L_NEXT} - {L_PREVIOUS} + {L_NEXT} + {L_PREVIOUS} diff --git a/phpBB/styles/prosilver/template/mcp_notes_user.html b/phpBB/styles/prosilver/template/mcp_notes_user.html index 328d12a04f..1738e45045 100644 --- a/phpBB/styles/prosilver/template/mcp_notes_user.html +++ b/phpBB/styles/prosilver/template/mcp_notes_user.html @@ -95,8 +95,8 @@
- {L_NEXT} - {L_PREVIOUS} + {L_NEXT} + {L_PREVIOUS} diff --git a/phpBB/styles/prosilver/template/mcp_queue.html b/phpBB/styles/prosilver/template/mcp_queue.html index 4d20804e66..d630606175 100644 --- a/phpBB/styles/prosilver/template/mcp_queue.html +++ b/phpBB/styles/prosilver/template/mcp_queue.html @@ -67,8 +67,8 @@
- {L_NEXT} - {L_PREVIOUS} + {L_NEXT} + {L_PREVIOUS} diff --git a/phpBB/styles/prosilver/template/mcp_reports.html b/phpBB/styles/prosilver/template/mcp_reports.html index 9a70b4a62a..902744fe25 100644 --- a/phpBB/styles/prosilver/template/mcp_reports.html +++ b/phpBB/styles/prosilver/template/mcp_reports.html @@ -72,8 +72,8 @@
- {L_NEXT} - {L_PREVIOUS} + {L_NEXT} + {L_PREVIOUS} diff --git a/phpBB/styles/prosilver/template/memberlist_body.html b/phpBB/styles/prosilver/template/memberlist_body.html index 17dc2c33c0..07a7e2e182 100644 --- a/phpBB/styles/prosilver/template/memberlist_body.html +++ b/phpBB/styles/prosilver/template/memberlist_body.html @@ -140,8 +140,8 @@
- {L_PREVIOUS} - {L_NEXT} + {L_PREVIOUS} + {L_NEXT}
diff --git a/phpBB/styles/prosilver/template/search_results.html b/phpBB/styles/prosilver/template/search_results.html index 1132e5295a..e31c278a4b 100644 --- a/phpBB/styles/prosilver/template/search_results.html +++ b/phpBB/styles/prosilver/template/search_results.html @@ -154,8 +154,8 @@
- {L_PREVIOUS} - {L_NEXT} + {L_PREVIOUS} + {L_NEXT} diff --git a/phpBB/styles/prosilver/template/ucp_attachments.html b/phpBB/styles/prosilver/template/ucp_attachments.html index 6e1bdfdd57..feb04278dc 100644 --- a/phpBB/styles/prosilver/template/ucp_attachments.html +++ b/phpBB/styles/prosilver/template/ucp_attachments.html @@ -51,8 +51,8 @@
- {L_NEXT} - {L_PREVIOUS} + {L_NEXT} + {L_PREVIOUS} diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html b/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html index 00b735fae6..c5078df268 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html @@ -122,8 +122,8 @@
- {L_PREVIOUS} - {L_NEXT} + {L_PREVIOUS} + {L_NEXT} diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index dd16b27988..9cbe7bc45a 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -192,8 +192,8 @@
- {L_PREVIOUS} - {L_NEXT} + {L_PREVIOUS} + {L_NEXT} diff --git a/phpBB/styles/prosilver/template/viewonline_body.html b/phpBB/styles/prosilver/template/viewonline_body.html index cb19a40d8f..74e891f7d0 100644 --- a/phpBB/styles/prosilver/template/viewonline_body.html +++ b/phpBB/styles/prosilver/template/viewonline_body.html @@ -47,9 +47,9 @@ - +
- {L_PREVIOUS}{L_PREVIOUS}{L_NEXT}{L_NEXT} + {L_PREVIOUS}{L_PREVIOUS}{L_NEXT}{L_NEXT}
diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index 5f999ade0c..9c0743d04d 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -245,12 +245,12 @@ - +
- {L_PREVIOUS} - {L_NEXT} + {L_PREVIOUS} + {L_NEXT} From a105a6d7a7140fe94e9b0a166fa515b9e02d9e3e Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Tue, 25 Jun 2013 12:39:43 -0700 Subject: [PATCH 03/13] [ticket/11615] Rename init_test to creation_test for clarity PHPBB3-11615 --- tests/session/{init_test.php => creation_test.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/session/{init_test.php => creation_test.php} (100%) diff --git a/tests/session/init_test.php b/tests/session/creation_test.php similarity index 100% rename from tests/session/init_test.php rename to tests/session/creation_test.php From c29cca1a755461ec2bd63b7cc9292d79ae0508d6 Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Tue, 25 Jun 2013 12:40:31 -0700 Subject: [PATCH 04/13] [ticket/11615] Rename class in file to match PHPBB3-11615 --- tests/session/creation_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/session/creation_test.php b/tests/session/creation_test.php index 2ce6c4a4ac..c5558c1577 100644 --- a/tests/session/creation_test.php +++ b/tests/session/creation_test.php @@ -10,7 +10,7 @@ require_once dirname(__FILE__) . '/../mock/cache.php'; require_once dirname(__FILE__) . '/testable_factory.php'; -class phpbb_session_init_test extends phpbb_database_test_case +class phpbb_session_creation_test extends phpbb_database_test_case { public function getDataSet() { From 4c432fecc75473c5f12a70048973a4139bdf1b22 Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Tue, 25 Jun 2013 12:42:19 -0700 Subject: [PATCH 05/13] [ticket/11615] Remove magic number in creation_test Removing this magic number to its own variable with clean multiplication makes it clear what the number represents. PHPBB3-11615 --- tests/session/creation_test.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/session/creation_test.php b/tests/session/creation_test.php index c5558c1577..b9f8b18c63 100644 --- a/tests/session/creation_test.php +++ b/tests/session/creation_test.php @@ -38,7 +38,8 @@ class phpbb_session_creation_test extends phpbb_database_test_case 'Check if exacly one session for user id 3 was created' ); - $cookie_expire = $session->time_now + 31536000; // default is one year + $one_year_in_seconds = 365 * 24 * 60 * 60; + $cookie_expire = $session->time_now + $one_year_in_seconds; $session->check_cookies($this, array( 'u' => array(null, $cookie_expire), From 7ba81a293f014f3c6b161672b8fbc27e2075d239 Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Tue, 25 Jun 2013 12:42:41 -0700 Subject: [PATCH 06/13] [ticket/11615] Fix typo in creation_test PHPBB3-11615 --- tests/session/creation_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/session/creation_test.php b/tests/session/creation_test.php index b9f8b18c63..bef52c6554 100644 --- a/tests/session/creation_test.php +++ b/tests/session/creation_test.php @@ -35,7 +35,7 @@ class phpbb_session_creation_test extends phpbb_database_test_case $this->assertSqlResultEquals( array(array('session_user_id' => 3)), $sql, - 'Check if exacly one session for user id 3 was created' + 'Check if exactly one session for user id 3 was created' ); $one_year_in_seconds = 365 * 24 * 60 * 60; From 1f989c6be774d88ffff8a8d5ac1da58f442f6174 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Thu, 27 Jun 2013 00:57:34 +0530 Subject: [PATCH 07/13] [ticket/9341] Move create_topic and post into functional test case create_topic and create_post are moved into functional test case so that they can be used by other tests as well PHPBB3-9341 --- tests/functional/posting_test.php | 101 ------------------ .../phpbb_functional_test_case.php | 101 ++++++++++++++++++ 2 files changed, 101 insertions(+), 101 deletions(-) diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php index 9bcfcc2fda..7fd1e4fdcf 100644 --- a/tests/functional/posting_test.php +++ b/tests/functional/posting_test.php @@ -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, - ); - } } diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 97fe147d8e..ece42c5fff 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -703,4 +703,105 @@ class phpbb_functional_test_case extends phpbb_test_case return $result; } + + /** + * 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, + ); + } } From bd9ece7ab678976db58325d740124b309507b5ca Mon Sep 17 00:00:00 2001 From: Dhruv Date: Thu, 27 Jun 2013 00:59:37 +0530 Subject: [PATCH 08/13] [ticket/9341] Add tests for checking Next and Previous template vars PHPBB3-9341 --- tests/functional/paging_test.php | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/functional/paging_test.php diff --git a/tests/functional/paging_test.php b/tests/functional/paging_test.php new file mode 100644 index 0000000000..d2e52ccf09 --- /dev/null +++ b/tests/functional/paging_test.php @@ -0,0 +1,33 @@ +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}"); + $link = $crawler->filter('#viewtopic > fieldset > a')->attr('href'); + $crawler = self::request('GET', $link); + + $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}&start=10"); + $link = $crawler->filter('#viewtopic > fieldset > a')->attr('href'); + $crawler = self::request('GET', $link); + } +} From 8e575487ff73f3b9c05aceba7b71f06c6e0b032a Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Wed, 26 Jun 2013 19:51:52 -0400 Subject: [PATCH 09/13] [ticket/11618] Replace glob() with scandir() and string matching Removes glob from template tests as glob() does not work on all systems according to PHP documentation as has been noticed by users. PHPBB3-11618 --- tests/template/template_test.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/tests/template/template_test.php b/tests/template/template_test.php index e532de294c..fd68124c89 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -69,9 +69,14 @@ class phpbb_template_template_test extends phpbb_test_case $this->markTestSkipped("Template cache directory ({$template_cache_dir}) is not writable."); } - foreach (glob($this->template->cachepath . '*') as $file) + $file_array = scandir($template_cache_dir); + $file_prefix = basename($this->template->cachepath); + foreach ($file_array as $file) { - unlink($file); + if (strpos($file, $file_prefix) === 0) + { + unlink($template_cache_dir . '/' . $file); + } } $GLOBALS['config'] = array( @@ -84,9 +89,15 @@ class phpbb_template_template_test extends phpbb_test_case { if (is_object($this->template)) { - foreach (glob($this->template->cachepath . '*') as $file) + $template_cache_dir = dirname($this->template->cachepath); + $file_array = scandir($template_cache_dir); + $file_prefix = basename($this->template->cachepath); + foreach ($file_array as $file) { - unlink($file); + if (strpos($file, $file_prefix) === 0) + { + unlink($template_cache_dir . '/' . $file); + } } } } From 69001902b98f66c8bf4c21df5920d2b070aa9a71 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Thu, 27 Jun 2013 20:47:03 +0530 Subject: [PATCH 10/13] [ticket/9341] remove PREV_PAGE tpl var used for backward compatability PHPBB3-9341 --- phpBB/includes/functions.php | 1 - 1 file changed, 1 deletion(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 03a5b36a43..6a1b3fd4f8 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2346,7 +2346,6 @@ function phpbb_generate_template_pagination($template, $base_url, $block_var_nam 'A_' . $tpl_prefix . 'BASE_URL' => addslashes($base_url), $tpl_prefix . 'PER_PAGE' => $per_page, 'U_' . $tpl_prefix . 'PREVIOUS_PAGE' => $previous_page, - $tpl_prefix . 'PREV_PAGE' => $previous_page, 'U_' . $tpl_prefix . 'NEXT_PAGE' => ($on_page != $total_pages) ? $base_url . $url_delim . $start_name . '=' . ($on_page * $per_page) : '', $tpl_prefix . 'TOTAL_PAGES' => $total_pages, $tpl_prefix . 'CURRENT_PAGE' => $on_page, From 22998ee5ee2d3cb4b0e3e34083b2876ab1e9bfb1 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Fri, 28 Jun 2013 00:52:36 +0530 Subject: [PATCH 11/13] [ticket/9341] Follow the Next/Prev link in tests follow the next/prev link and then assert if the page contains its last post or not PHPBB3-9341 --- tests/functional/paging_test.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/functional/paging_test.php b/tests/functional/paging_test.php index d2e52ccf09..d85ce49aa6 100644 --- a/tests/functional/paging_test.php +++ b/tests/functional/paging_test.php @@ -23,11 +23,15 @@ class phpbb_functional_paging_test extends phpbb_functional_test_case $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}"); - $link = $crawler->filter('#viewtopic > fieldset > a')->attr('href'); - $crawler = self::request('GET', $link); + $this->assertContains('post no9', $crawler->text()); - $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}&start=10"); - $link = $crawler->filter('#viewtopic > fieldset > a')->attr('href'); - $crawler = self::request('GET', $link); + $next_link = $crawler->filter('#viewtopic > fieldset > a.arrow-right')->attr('href'); + $crawler = self::request('GET', $next_link); + $this->assertContains('post no19', $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()); } } From 91e773a79538a8fa26bea1d56384379b8730ac70 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Fri, 28 Jun 2013 01:02:00 +0530 Subject: [PATCH 12/13] [ticket/9341] Assert that page doesnt contain next or prev page posts PHPBB3-9341 --- tests/functional/paging_test.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/functional/paging_test.php b/tests/functional/paging_test.php index d85ce49aa6..d5adc6ad0a 100644 --- a/tests/functional/paging_test.php +++ b/tests/functional/paging_test.php @@ -24,14 +24,16 @@ class phpbb_functional_paging_test extends phpbb_functional_test_case } $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()); } } From 5182ec09a5ad30a40eb21e3a08fc8739e173128c Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sat, 29 Jun 2013 15:26:36 +0530 Subject: [PATCH 13/13] [ticket/11593] initialize $is_expr as null before being passed to get_varref PHPBB3-11593 --- phpBB/includes/template/filter.php | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/includes/template/filter.php b/phpBB/includes/template/filter.php index f2bd442010..1c0a56c9f5 100644 --- a/phpBB/includes/template/filter.php +++ b/phpBB/includes/template/filter.php @@ -475,6 +475,7 @@ class phpbb_template_filter extends php_user_filter */ private function compile_var_tags(&$text_blocks) { + $is_expr = null; $text_blocks = $this->get_varref($text_blocks, $is_expr); $lang_replaced = $this->compile_language_tags($text_blocks);