From e7f970e26d636d69ea742bf591dc5fc9dc15a0a9 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Wed, 16 Apr 2014 23:41:10 +0200 Subject: [ticket/12413] Fatal Error for feed.php?mode=forums https://tracker.phpbb.com/browse/PHPBB3-12413 http://area51.phpbb.com/phpBB/viewtopic.php?f=81&t=45475 PHPBB3-12413 --- phpBB/feed.php | 5 +-- phpBB/phpbb/feed/attachments_base.php | 81 +++++++++++++++++++++++++++++++++++ phpBB/phpbb/feed/forum.php | 2 + phpBB/phpbb/feed/post_base.php | 2 +- phpBB/phpbb/feed/topic.php | 2 + phpBB/phpbb/feed/topic_base.php | 2 +- 6 files changed, 88 insertions(+), 6 deletions(-) create mode 100644 phpBB/phpbb/feed/attachments_base.php diff --git a/phpBB/feed.php b/phpBB/feed.php index 9ff8c66b9d..0c4cc32fdb 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -73,9 +73,6 @@ if ($feed === false) trigger_error('NO_FEED'); } -// Get attachments for this feed -$feed->fetch_attachments(); - // Open Feed $feed->open(); @@ -111,7 +108,7 @@ while ($row = $feed->get_item()) 'title' => censor_text($title), 'category' => ($config['feed_item_statistics'] && !empty($row['forum_id'])) ? $board_url . '/viewforum.' . $phpEx . '?f=' . $row['forum_id'] : '', 'category_name' => ($config['feed_item_statistics'] && isset($row['forum_name'])) ? $row['forum_name'] : '', - 'description' => censor_text($phpbb_feed_helper->generate_content($row[$feed->get('text')], $row[$feed->get('bbcode_uid')], $row[$feed->get('bitfield')], $options, $row['forum_id'], (($row['post_attachment']) ? $feed->attachments[$row['post_id']] : array()))), + 'description' => censor_text($phpbb_feed_helper->generate_content($row[$feed->get('text')], $row[$feed->get('bbcode_uid')], $row[$feed->get('bitfield')], $options, $row['forum_id'], ((isset($row['post_attachment']) && $row['post_attachment']) ? $feed->get_attachments($row['post_id']) : array()))), 'statistics' => '', ); diff --git a/phpBB/phpbb/feed/attachments_base.php b/phpBB/phpbb/feed/attachments_base.php new file mode 100644 index 0000000000..b497d3b3f7 --- /dev/null +++ b/phpBB/phpbb/feed/attachments_base.php @@ -0,0 +1,81 @@ +fetch_attachments(); + } + + /** + * Retrieve the list of attachments that may be displayed + */ + function fetch_attachments() + { + global $db; + + $sql_array = array( + 'SELECT' => 'a.*', + 'FROM' => array( + ATTACHMENTS_TABLE => 'a' + ), + 'WHERE' => 'a.in_message = 0 ', + 'ORDER_BY' => 'a.filetime DESC, a.post_msg_id ASC', + ); + + if (isset($this->topic_id)) + { + $sql_array['WHERE'] .= 'AND a.topic_id = ' . (int)$this->topic_id; + } + else if (isset($this->forum_id)) + { + $sql_array['LEFT_JOIN'] = array( + array( + 'FROM' => array(TOPICS_TABLE => 't'), + 'ON' => 'a.topic_id = t.topic_id', + ) + ); + $sql_array['WHERE'] .= 'AND t.forum_id = ' . (int)$this->forum_id; + } + + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query($sql); + + // Set attachments in feed items + while ($row = $db->sql_fetchrow($result)) + { + $this->attachments[$row['post_msg_id']][] = $row; + } + $db->sql_freeresult($result); + } + + /** + * Get attachments related to a given post + * + * @param $post_id Post id + * @return mixed Attachments related to $post_id + */ + function get_attachments($post_id) + { + return $this->attachments[$post_id]; + } +} diff --git a/phpBB/phpbb/feed/forum.php b/phpBB/phpbb/feed/forum.php index 85ecb60f7e..06e87ec21c 100644 --- a/phpBB/phpbb/feed/forum.php +++ b/phpBB/phpbb/feed/forum.php @@ -80,6 +80,8 @@ class forum extends \phpbb\feed\post_base unset($forum_ids_passworded); } + + $this->fetch_attachments(); } function get_sql() diff --git a/phpBB/phpbb/feed/post_base.php b/phpBB/phpbb/feed/post_base.php index c797d6a8ca..57eb70ea12 100644 --- a/phpBB/phpbb/feed/post_base.php +++ b/phpBB/phpbb/feed/post_base.php @@ -14,7 +14,7 @@ namespace phpbb\feed; * * @package phpBB3 */ -abstract class post_base extends \phpbb\feed\base +abstract class post_base extends \phpbb\feed\attachments_base { var $num_items = 'feed_limit_post'; var $attachments = array(); diff --git a/phpBB/phpbb/feed/topic.php b/phpBB/phpbb/feed/topic.php index a7acfb502f..3c2b3405f6 100644 --- a/phpBB/phpbb/feed/topic.php +++ b/phpBB/phpbb/feed/topic.php @@ -83,6 +83,8 @@ class topic extends \phpbb\feed\post_base unset($forum_ids_passworded); } + + $this->fetch_attachments(); } function get_sql() diff --git a/phpBB/phpbb/feed/topic_base.php b/phpBB/phpbb/feed/topic_base.php index 7e28e67b82..e8639a6fa6 100644 --- a/phpBB/phpbb/feed/topic_base.php +++ b/phpBB/phpbb/feed/topic_base.php @@ -14,7 +14,7 @@ namespace phpbb\feed; * * @package phpBB3 */ -abstract class topic_base extends \phpbb\feed\base +abstract class topic_base extends \phpbb\feed\attachments_base { var $num_items = 'feed_limit_topic'; -- cgit v1.2.1 From 103befc3d683a80da38fae5470315cb87a7860ae Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 20 Apr 2014 23:46:31 +0200 Subject: [ticket/12413] Tests: Adding functional tests for the feeds Some tests are disabled until PHPBB3-12418 (#2331) and PHPBB3-12421 (#2330) are fixed and merged PHPBB3-12413 --- tests/functional/feed_test.php | 1373 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1373 insertions(+) create mode 100644 tests/functional/feed_test.php diff --git a/tests/functional/feed_test.php b/tests/functional/feed_test.php new file mode 100644 index 0000000000..9aff0340f4 --- /dev/null +++ b/tests/functional/feed_test.php @@ -0,0 +1,1373 @@ +login(); + $this->admin_login(); + $this->create_user("disapprove_user"); + $this->add_user_group('NEWLY_REGISTERED', array('disapprove_user')); + + $crawler = self::request('GET', "adm/index.php?i=acp_forums&mode=manage&sid={$this->sid}"); + $form = $crawler->selectButton('addforum')->form(array( + 'forum_name' => 'Feeds #1', + )); + $crawler = self::submit($form); + $form = $crawler->selectButton('update')->form(array( + 'forum_perm_from' => 2, + )); + $crawler = self::submit($form); + + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + )); + + // 'Feeds #1.1' is a sub-forum of 'Feeds #1' + $crawler = self::request('GET', "adm/index.php?i=acp_forums&sid={$this->sid}&icat=6&mode=manage&parent_id={$this->data['forums']['Feeds #1']}"); + $form = $crawler->selectButton('addforum')->form(array( + 'forum_name' => 'Feeds #1.1', + )); + $crawler = self::submit($form); + $form = $crawler->selectButton('update')->form(array( + 'forum_perm_from' => 2, + )); + $crawler = self::submit($form); + + // 'Feeds #news' will be used for feed.php?mode=news + $crawler = self::request('GET', "adm/index.php?i=acp_forums&mode=manage&sid={$this->sid}"); + $form = $crawler->selectButton('addforum')->form(array( + 'forum_name' => 'Feeds #news', + )); + $crawler = self::submit($form); + $form = $crawler->selectButton('update')->form(array( + 'forum_perm_from' => 2, + )); + $crawler = self::submit($form); + + // 'Feeds #exclude' will not be displayed on feed.php?mode=forums + $crawler = self::request('GET', "adm/index.php?i=acp_forums&mode=manage&sid={$this->sid}"); + $form = $crawler->selectButton('addforum')->form(array( + 'forum_name' => 'Feeds #exclude', + )); + $crawler = self::submit($form); + $form = $crawler->selectButton('update')->form(array( + 'forum_perm_from' => 2, + )); + $crawler = self::submit($form); + } + + public function test_setup_config() + { + $this->login(); + $this->admin_login(); + + $this->load_ids(array( + 'forums' => array( + 'Feeds #news', + 'Feeds #exclude', + ), + )); + + $crawler = self::request('GET', "adm/index.php?sid={$this->sid}&i=acp_board&mode=feed"); + + $form = $crawler->selectButton('Submit')->form(); + $values = $form->getValues(); + + // Enable all feeds + $values["config[feed_enable]"] = true; + $values["config[feed_forum]"] = true; + $values["config[feed_item_statistics]"] = true; + $values["config[feed_overall]"] = true; + $values["config[feed_overall_forums]"] = true; + $values["config[feed_topic]"] = true; + $values["config[feed_topics_active]"] = true; + $values["config[feed_topics_new]"] = true; + + $form->setValues($values); + + // News/Exclude's forums config + $form['feed_news_id']->select(array($this->data['forums']['Feeds #news'])); + $form['feed_exclude_id']->select(array($this->data['forums']['Feeds #exclude'])); + + $crawler = self::submit($form); + $this->assertGreaterThan(0, $crawler->filter('.successbox')->count()); + + // News special config (Guest can't see attachments) + $this->add_lang('acp/permissions'); + + $crawler = self::request('GET', "adm/index.php?i=acp_permissions&sid={$this->sid}&icat=16&mode=setting_group_global&group_id[0]=1"); + $this->assertContains($this->lang('ACL_SET'), $crawler->filter('h1')->eq(1)->text()); + + $form = $crawler->selectButton($this->lang('APPLY_PERMISSIONS'))->form(); + $form["setting[1][0][u_download]"]->select(-1); + + $crawler = self::submit($form); + $this->assertGreaterThan(0, $crawler->filter('.successbox')->count()); + } + + public function test_feeds_empty() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + 'Feeds #1.1', + ), + )); + + // Excluded forums (and topics under them) shouldn't be displayed in feeds + $this->assert_feeds(array( + 'f' => array( + array( + 'id' => $this->data['forums']['Feeds #1'], + 'nb_entries' => 0, + ), + array( + 'id' => $this->data['forums']['Feeds #1.1'], + 'nb_entries' => 0, + ), + ), + 'forums' => array( + array( + 'nb_entries' => 4, + 'xpath' => array( + '//entry/category[@label="Feeds #exclude"]' => 0, + ), + ), + ), + 'news' => array( + array( + 'nb_entries' => 0, + ), + ), + ), 'admin'); + } + + public function test_create_exclude_topic() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Feeds #exclude', + ), + )); + + $post = $this->create_topic($this->data['forums']['Feeds #exclude'], 'Feeds #exclude - Topic #1', 'This is a test topic posted by the testing framework.'); + $this->data['topics']['Feeds #exclude - Topic #1'] = (int) $post['topic_id']; + } + + public function test_feeds_exclude() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #exclude', + ), + 'topics' => array( + 'Feeds #exclude - Topic #1', + ), + )); + + // Assert that feeds aren't available for excluded forums + $this->assert_feeds(array( + 'f' => array( + array( + 'id' => $this->data['forums']['Feeds #exclude'], + 'contents_lang' => array('NO_FEED'), + 'invalid' => true, + ), + ), + 't' => array( + array( + 'id' => $this->data['topics']['Feeds #exclude - Topic #1'], + 'contents_lang' => array('NO_FEED'), + 'invalid' => true, + ), + ), + 'overall' => array( + array( + 'nb_entries' => 1, + 'xpath' => array( + '//entry/title[contains(., "#exclude")]' => 0, + ), + ), + ), + 'topics' => array( + array( + 'nb_entries' => 1, + 'xpath' => array( + '//entry/title[contains(., "#exclude")]' => 0, + ), + ), + ), + 'topics_new' => array( + array( + 'nb_entries' => 1, + 'xpath' => array( + '//entry/title[contains(., "#exclude")]' => 0, + ), + ), + ), + 'topics_active' => array( + array( + 'nb_entries' => 1, + 'xpath' => array( + '//entry/title[contains(., "#exclude")]' => 0, + ), + ), + ), + ), 'admin'); + } + + public function test_create_news_topics() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Feeds #news', + ), + )); + + $post = $this->create_topic($this->data['forums']['Feeds #news'], 'Feeds #news - Topic #1', 'This is a test topic posted by the testing framework.'); + $this->data['topics']['Feeds #news - Topic #1'] = (int) $post['topic_id']; + + $post = $this->create_topic($this->data['forums']['Feeds #news'], 'Feeds #news - Topic #2', '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('Feeds #news - Topic #2', $crawler->filter('html')->text()); + $this->data['topics']['Feeds #news - Topic #2'] = (int) $post['topic_id']; + $this->data['posts']['Feeds #news - Topic #2'] = (int) $this->get_parameter_from_link($crawler->filter('.post')->selectLink($this->lang('POST', '', ''))->link()->getUri(), 'p'); + + // Test creating a reply + $post2 = $this->create_post($this->data['forums']['Feeds #news'], $post['topic_id'], 'Re: Feeds #news - Topic #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: Feeds #news - Topic #2', $crawler->filter('html')->text()); + $this->data['posts']['Re: Feeds #news - Topic #2'] = (int) $post2['post_id']; + } + + public function test_feeds_news_admin() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #news', + ), + 'topics' => array( + 'Feeds #news - Topic #1', + 'Feeds #news - Topic #2', + ), + 'posts' => array( + 'Feeds #news - Topic #2', + ), + )); + + // Assert that the first post of the two topics are displayed in news feed + $this->assert_feeds(array( + 'news' => array( + array( + 'nb_entries' => 2, + 'contents' => array( + 1 => 'This is a test topic posted by the testing framework.', + 2 => 'This is a test topic posted by the testing framework.', + ), + ), + ), + // News should also be displayed in other feeds + 'f' => array( + array( + 'nb_entries' => 3, + 'id' => $this->data['forums']['Feeds #news'], + ), + ), + 't' => array( + array( + 'nb_entries' => 1, + 'id' => $this->data['topics']['Feeds #news - Topic #1'], + ), + array( + 'nb_entries' => 2, + 'id' => $this->data['topics']['Feeds #news - Topic #2'], + ), + ), + 'overall' => array( + array( + 'nb_entries' => 4, + 'xpath' => array( + '//entry/title[contains(., "#news")]' => 3, + ), + ), + ), + 'topics' => array( + array( + 'nb_entries' => 3, + 'xpath' => array( + '//entry/title[contains(., "#news")]' => 2, + ), + ), + ), + 'topics_new' => array( + array( + 'nb_entries' => 3, + 'xpath' => array( + '//entry/title[contains(., "#news")]' => 2, + ), + ), + ), + 'topics_active' => array( + array( + 'nb_entries' => 3, + 'xpath' => array( + '//entry/title[contains(., "#news")]' => 2, + ), + ), + ), + ), 'admin'); + } + + public function test_feeds_news_guest() + { + $this->load_ids(array( + 'posts' => array( + 'Feeds #news - Topic #2', + ), + )); + + // Assert that first post of the the two topics are displayed in news feed + $this->assert_feeds(array( + 'news' => array( + array( + 'nb_entries' => 2, + 'contents' => array( + 1 => 'This is a test topic posted by the testing framework.', + 2 => 'This is a test topic posted by the testing framework.', + ), + ), + ), + )); + } + + public function test_create_sub_forum_topic() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + 'Feeds #1.1', + ), + )); + + $post = $this->create_topic($this->data['forums']['Feeds #1'], 'Feeds #1 - Topic #1', 'This is a test topic posted by the testing framework.'); + $this->data['topics']['Feeds #1 - Topic #1'] = (int) $post['topic_id']; + + $post = $this->create_topic($this->data['forums']['Feeds #1.1'], 'Feeds #1.1 - Topic #1', 'This is a test topic posted by the testing framework.'); + $this->data['topics']['Feeds #1.1 - Topic #1'] = (int) $post['topic_id']; + } + + public function test_feeds_sub_forum() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + )); + + // The topics of the sub-forum shouldn't be displayed + $this->assert_feeds(array( + 'f' => array( + array( + 'nb_entries' => 1, + 'id' => $this->data['forums']['Feeds #1'], + ), + ), + ), 'admin'); + } + + public function test_create_softdelete_post() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + )); + + $post = $this->create_topic($this->data['forums']['Feeds #1'], 'Feeds #1 - Topic #2', 'This is a test topic posted by the testing framework.'); + $this->data['topics']['Feeds #1 - Topic #2'] = (int) $post['topic_id']; + + // Test creating a reply + $post2 = $this->create_post($this->data['forums']['Feeds #1'], $post['topic_id'], 'Re: Feeds #1 - Topic #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: Feeds #1 - Topic #2', $crawler->filter('html')->text()); + $this->data['posts']['Re: Feeds #1 - Topic #2'] = (int) $post2['post_id']; + } + + public function test_softdelete_post() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + 'topics' => array( + 'Feeds #1 - Topic #2', + ), + 'posts' => array( + 'Re: Feeds #1 - Topic #2', + ), + )); + $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}"); + $this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text()); + + $form = $crawler->selectButton('Yes')->form(); + $crawler = self::submit($form); + $this->assertContainsLang('POST_DELETED', $crawler->text()); + + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Feeds #1 - Topic #2']}&sid={$this->sid}"); + $this->assertContains($this->lang('POST_DISPLAY', '', ''), $crawler->text()); + } + + public function test_feeds_softdeleted_post_admin() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + 'topics' => array( + 'Feeds #1 - Topic #2', + ), + )); + + // Assert that the soft-deleted post is marked as soft-delete for users that have the right to see it. + $this->assert_feeds(array( + 'f' => array( + array( + 'nb_entries' => 3, + 'id' => $this->data['forums']['Feeds #1'], + 'contents_lang' => array( + 1 => 'POST_DELETED', + ), + ), + ), + 't' => array( + array( + 'nb_entries' => 2, + 'id' => $this->data['topics']['Feeds #1 - Topic #2'], + 'contents_lang' => array( + 1 => 'POST_DELETED', + ), + ), + ), + 'overall' => array( + array( + 'nb_entries' => 8, + 'contents_lang' => array( + 1 => 'POST_DELETED', + ), + ), + ), + ), 'admin'); + } + + public function test_feeds_softdeleted_post_guest() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + 'topics' => array( + 'Feeds #1 - Topic #2', + ), + )); + + // Assert that the soft-deleted post is marked as soft-delete for users that have the right to see it. + $this->assert_feeds(array( + 'f' => array( + array( + 'nb_entries' => 2, + 'id' => $this->data['forums']['Feeds #1'], + ), + ), + 't' => array( + array( + 'nb_entries' => 1, + 'id' => $this->data['topics']['Feeds #1 - Topic #2'], + ), + ), + 'overall' => array( + array( + 'nb_entries' => 7, + ), + ), + )); + } + + public function test_softdelete_topic() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + 'topics' => array( + 'Feeds #1 - Topic #2', + ), + )); + + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Feeds #1 - Topic #2']}&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']['Feeds #1 - Topic #2']}&sid={$this->sid}"); + $this->assertContains('Feeds #1 - Topic #2', $crawler->filter('h2')->text()); + } + + public function test_feeds_softdeleted_topic_admin() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + 'topics' => array( + 'Feeds #1 - Topic #2', + ), + )); + + // Assert that the soft-deleted post is marked as soft-delete for users that have the right to see it. + $this->assert_feeds(array( + 'f' => array( + array( + 'nb_entries' => 3, + 'id' => $this->data['forums']['Feeds #1'], + 'contents_lang' => array( + 1 => 'POST_DELETED', + 2 => 'POST_DELETED', + ), + ), + ), + 't' => array( + array( + 'nb_entries' => 2, + 'id' => $this->data['topics']['Feeds #1 - Topic #2'], + 'contents_lang' => array( + 1 => 'POST_DELETED', + 2 => 'POST_DELETED', + ), + ), + ), + 'overall' => array( + array( + 'nb_entries' => 8, + 'contents_lang' => array( + 1 => 'POST_DELETED', + 2 => 'POST_DELETED', + ), + ), + ), + 'topics' => array( + array( + 'nb_entries' => 6, + 'contents_lang' => array( + 1 => 'TOPIC_DELETED', + ), + ), + ), + 'topics_new' => array( + array( + 'nb_entries' => 6, + 'contents_lang' => array( + 1 => 'TOPIC_DELETED', + ), + ), + ), + 'topics_active' => array( + array( + 'nb_entries' => 6, + 'contents_lang' => array( + 1 => 'TOPIC_DELETED', + ), + ), + ), + ), 'admin'); + } + + public function test_feeds_softdeleted_topic_guest() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + 'topics' => array( + 'Feeds #1 - Topic #2', + ), + )); + + $this->assert_feeds(array( + 'f' => array( + array( + 'nb_entries' => 1, + 'id' => $this->data['forums']['Feeds #1'], + ), + ), + 't' => array( + array( + 'id' => $this->data['topics']['Feeds #1 - Topic #2'], + 'contents_lang' => array('SORRY_AUTH_READ'), + 'invalid' => true, + ), + ), + 'overall' => array( + array( + 'nb_entries' => 6, + ), + ), + 'topics' => array( + array( + 'nb_entries' => 5, + ), + ), + 'topics_new' => array( + array( + 'nb_entries' => 5, + ), + ), + 'topics_active' => array( + array( + 'nb_entries' => 5, + ), + ), + )); + } + + public function test_create_unapproved_post() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1.1', + ), + )); + + $this->login('admin'); + $post = $this->create_topic($this->data['forums']['Feeds #1.1'], 'Feeds #1.1 - Topic #2', 'This is a test topic posted by the testing framework.'); + $this->data['topics']['Feeds #1.1 - Topic #2'] = (int) $post['topic_id']; + $this->logout(); + + // Test creating a reply + $this->login("disapprove_user"); + $post2 = $this->create_post($this->data['forums']['Feeds #1.1'], $post['topic_id'], 'Re: Feeds #1.1 - Topic #2', 'This is a test post posted by the testing framework.', array(), 'POST_STORED_MOD'); + + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Feeds #1.1 - Topic #2']}&sid={$this->sid}"); + $this->assertNotContains('Re: Feeds #1.1 - Topic #2', $crawler->filter('html')->text()); + } + + public function test_feeds_unapproved_post_admin() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1.1', + ), + 'topics' => array( + 'Feeds #1.1 - Topic #2', + ), + )); + + // Assert that the unapproved post is marked as unapproved for users that have the right to see it. + $this->assert_feeds(array( + 'f' => array( + array( + 'nb_entries' => 3, + 'id' => $this->data['forums']['Feeds #1.1'], + 'contents_lang' => array( + 1 => 'POST_UNAPPROVED', + ), + ), + ), + 't' => array( + array( + 'nb_entries' => 2, + 'id' => $this->data['topics']['Feeds #1.1 - Topic #2'], + 'contents_lang' => array( + 1 => 'POST_UNAPPROVED', + ), + ), + ), + 'overall' => array( + array( + 'nb_entries' => 10, + 'contents_lang' => array( + 1 => 'POST_UNAPPROVED', + ), + ), + ), + ), 'admin'); + } + + public function test_feeds_unapproved_post_disapprove_user() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1.1', + ), + 'topics' => array( + 'Feeds #1.1 - Topic #2', + ), + )); + + // Assert that the unapproved isn't displayed for regular users + $this->assert_feeds(array( + 'f' => array( + array( + 'nb_entries' => 2, + 'id' => $this->data['forums']['Feeds #1.1'], + ), + ), + 't' => array( + array( + 'nb_entries' => 1, + 'id' => $this->data['topics']['Feeds #1.1 - Topic #2'], + ), + ), + 'overall' => array( + array( + 'nb_entries' => 7, + ), + ), + ), 'disapprove_user'); + } + + public function test_create_unapproved_topic() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1.1', + ), + )); + + // We have to wait because of the flood interval. + sleep(15); + + $this->login("disapprove_user"); + $post = $this->create_topic($this->data['forums']['Feeds #1.1'], 'Feeds #1.1 - Topic #3', 'This is a test topic posted by the testing framework.', array(), 'POST_STORED_MOD'); + $this->data['topics']['Feeds #1 - Topic #3'] = (int) $post['topic_id']; + $crawler = self::request('GET', "viewforum.php?f={$this->data['forums']['Feeds #1.1']}&sid={$this->sid}"); + + $this->assertNotContains('Feeds #1.1 - Topic #3', $crawler->filter('html')->text()); + } + + public function test_feeds_unapproved_topic_admin() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1.1', + ), + 'topics' => array( + 'Feeds #1.1 - Topic #3', + ), + )); + + // Assert that the unapproved topic is marked as unapproved for users that have the right to see it. + $this->assert_feeds(array( + 'f' => array( + array( + 'nb_entries' => 4, + 'id' => $this->data['forums']['Feeds #1.1'], + 'contents_lang' => array( + 1 => 'POST_UNAPPROVED', + ), + ), + ), + 't' => array( + array( + 'nb_entries' => 1, + 'id' => $this->data['topics']['Feeds #1.1 - Topic #3'], + 'contents_lang' => array( + 1 => 'POST_UNAPPROVED', + ), + ), + ), + 'overall' => array( + array( + 'nb_entries' => 11, + 'contents_lang' => array( + 1 => 'POST_UNAPPROVED', + ), + ), + ), + 'topics' => array( + array( + 'nb_entries' => 8, + 'contents_lang' => array( + 1 => 'TOPIC_UNAPPROVED', + ), + ), + ), + 'topics_new' => array( + array( + 'nb_entries' => 8, + 'contents_lang' => array( + 1 => 'TOPIC_UNAPPROVED', + ), + ), + ), + 'topics_active' => array( + array( + 'nb_entries' => 8, + 'contents_lang' => array( + 1 => 'TOPIC_UNAPPROVED', + ), + ), + ), + ), 'admin'); + } + + public function test_feeds_unapproved_topic_disapprove_user() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1.1', + ), + 'topics' => array( + 'Feeds #1.1 - Topic #3', + ), + )); + + $this->assert_feeds(array( + 'f' => array( + array( + 'nb_entries' => 2, + 'id' => $this->data['forums']['Feeds #1.1'], + ), + ), + 't' => array( + array( + 'id' => $this->data['topics']['Feeds #1.1 - Topic #3'], + 'contents_lang' => array('SORRY_AUTH_READ'), + 'invalid' => true, + ), + ), + 'overall' => array( + array( + 'nb_entries' => 7, + ), + ), + 'topics' => array( + array( + 'nb_entries' => 6, + ), + ), + 'topics_new' => array( + array( + 'nb_entries' => 6, + ), + ), + 'topics_active' => array( + array( + 'nb_entries' => 6, + ), + ), + ), 'disapprove_user'); + } + + public function test_create_attachment_topic() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + )); + + // Test creating a topic with 1 attachment + $post = $this->create_topic($this->data['forums']['Feeds #1'], 'Feeds #1 - Topic #3', 'This is a test topic posted by the testing framework. [attachment=0]Attachment #0[/attachment]', array('upload_files' => 1)); + $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}"); + + $this->assertContains('Feeds #1 - Topic #3', $crawler->filter('html')->text()); + $this->data['topics']['Feeds #1 - Topic #3'] = (int) $post['topic_id']; + } + + public function test_feeds_attachment_admin() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + 'topics' => array( + 'Feeds #1 - Topic #3', + ), + 'posts' => array( + 'Feeds #1 - Topic #3', + ), + 'attachments' => true, + )); + + $this->assert_feeds(array( + 'f' => array( + array( + 'nb_entries' => 4, + 'id' => $this->data['forums']['Feeds #1'], + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => true, + ), + ), + ), + ), + ), + 't' => array( + array( + 'nb_entries' => 1, + 'id' => $this->data['topics']['Feeds #1 - Topic #3'], + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => true, + ), + ), + ), + ), + ), + 'overall' => array( + array( + 'nb_entries' => 12, + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => true, + ), + ), + ), + ), + ), + 'topics' => array( + array( + 'nb_entries' => 9, + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => true, + ), + ), + ), + ), + ), + 'topics_new' => array( + array( + 'nb_entries' => 9, + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => true, + ), + ), + ), + ), + ), + 'topics_active' => array( + array( + 'nb_entries' => 9, + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => true, + ), + ), + ), + ), + ), + ), 'admin'); + } + + public function test_feeds_attachment_guest() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + 'topics' => array( + 'Feeds #1 - Topic #3', + ), + 'posts' => array( + 'Feeds #1 - Topic #3', + ), + 'attachments' => true, + )); + + $this->assert_feeds(array( + 'f' => array( + array( + 'nb_entries' => 2, + 'id' => $this->data['forums']['Feeds #1'], + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => false, + ), + ), + ), + ), + ), + 't' => array( + array( + 'nb_entries' => 1, + 'id' => $this->data['topics']['Feeds #1 - Topic #3'], + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => false, + ), + ), + ), + ), + ), + 'overall' => array( + array( + 'nb_entries' => 8, + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => false, + ), + ), + ), + ), + ), + 'topics' => array( + array( + 'nb_entries' => 7, + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => false, + ), + ), + ), + ), + ), + 'topics_new' => array( + array( + 'nb_entries' => 7, + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => false, + ), + ), + ), + ), + ), + 'topics_active' => array( + array( + 'nb_entries' => 7, + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => false, + ), + ), + ), + ), + ), + )); + } + + // Disabled until PHPBB3-12418 is fixed and merged + /*public function test_create_missing_attachment_post() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + 'topics' => array( + 'Feeds #1 - Topic #3', + ), + )); + + // Test creating a reply with 1 missing attachment + $post2 = $this->create_post($this->data['forums']['Feeds #1'], $this->data['topics']['Feeds #1 - Topic #3'], 'Re: Feeds #1 - Topic #3-1', 'This is a test post posted by the testing framework. [attachment=0]Attachment #0[/attachment]'); + $crawler = self::request('GET', "viewtopic.php?t={$post2['topic_id']}&sid={$this->sid}"); + + $this->assertContains('Re: Feeds #1 - Topic #3-1', $crawler->filter('html')->text()); + $this->data['posts']['Re: Feeds #1 - Topic #3-1'] = (int) $post2['post_id']; + } + + public function test_feeds_missing_attachment_admin() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + 'topics' => array( + 'Feeds #1 - Topic #3', + ), + 'posts' => array( + 'Feeds #1 - Topic #3', + ), + )); + + $this->add_lang('viewtopic'); + + $this->assert_feeds(array( + 'f' => array( + array( + 'nb_entries' => 5, + 'id' => $this->data['forums']['Feeds #1'], + 'contents' => array( + 1 => 'Attachment #0', + ), + ), + ), + 't' => array( + array( + 'nb_entries' => 2, + 'id' => $this->data['topics']['Feeds #1 - Topic #3'], + 'contents' => array( + 1 => 'Attachment #0', + ), + ), + ), + 'overall' => array( + array( + 'nb_entries' => 13, + 'contents' => array( + 1 => 'Attachment #0', + ), + ), + ), + 'topics' => array( + array( + 'nb_entries' => 9, + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => false, + ), + ), + ), + ), + ), + 'topics_new' => array( + array( + 'nb_entries' => 9, + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => false, + ), + ), + ), + ), + ), + 'topics_active' => array( + array( + 'nb_entries' => 9, + 'contents' => array( + 1 => 'Attachment #0', + ), + ), + ), + ), 'admin'); + }*/ + + protected function assert_feeds($data, $username = false) + { + if ($username) + { + $this->login($username); + } + + foreach ($data as $mode => $feeds) + { + foreach ($feeds as $feed_data) + { + if ($mode === 'f' || $mode === 't') + { + $params = "?{$mode}={$feed_data['id']}"; + $this->assert_feed($params, $feed_data); + } + else + { + $params = "?mode={$mode}"; + $this->assert_feed($params, $feed_data); + } + } + } + } + + protected function assert_feed($params, $data) + { + $crawler = self::request('GET', 'feed.php' . $params, array(), false); + + if (!(isset($data['invalid']) && $data['invalid'])) + { + self::assert_response_xml(); + $this->assertEquals($data['nb_entries'], $crawler->filter('entry')->count(), "Tested feed : 'feed.php{$params}'"); + + if (sizeof($data['xpath'])) { + foreach($data['xpath'] as $xpath => $count_expected) + { + $this->assertCount($count_expected, $crawler->filterXPath($xpath), "Tested feed : 'feed.php{$params}', Search for {$xpath}"); + } + } + + if (sizeof($data['contents'])) { + foreach($data['contents'] as $entry_id => $string) + { + $content = $crawler->filterXPath("//entry[{$entry_id}]/content")->text(); + $this->assertContains($string, $content, "Tested feed : 'feed.php{$params}'"); + } + } + + if (sizeof($data['contents_lang'])) { + foreach($data['contents_lang'] as $entry_id => $string) + { + $content = $crawler->filterXPath("//entry[{$entry_id}]/content")->text(); + $this->assertContainsLang($string, $content, "Tested feed : 'feed.php{$params}'"); + } + } + + if (sizeof($data['attachments'])) { + foreach($data['attachments'] as $entry_id => $attachments) + { + foreach ($attachments as $i => $attachment) + { + $content = $crawler->filterXPath("//entry[{$entry_id}]/content")->text(); + $url = "./download/file.php?id={$attachment['id']}"; + $string = "Attachment #{$i}"; + + if ($attachment['displayed']) + { + $this->assertContains($url, $content, "Tested feed : 'feed.php{$params}'"); + // $this->assertNotContains($string, $content, "Tested feed : 'feed.php{$params}'"); + } + else + { + // Disabled until PHPBB3-12421 is fixed and merged + // $this->assertContains($string, $content, "Tested feed : 'feed.php{$params}'"); + // $this->assertNotContains($url, $content, "Tested feed : 'feed.php{$params}'"); + } + } + } + } + } + else + { + self::assert_response_html(); + + if (sizeof($data['contents_lang'])) { + foreach($data['contents_lang'] as $string) + { + $content = $crawler->filter("html")->text(); + $this->assertContainsLang($string, $content, "Tested feed : 'feed.php{$params}'"); + } + } + } + } + + protected 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); + } + + $post_ids = array(); + 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']; + $post_ids[] = (int) $row['post_id']; + } + } + $this->db->sql_freeresult($result); + + if (isset($data['attachments'])) + { + $sql = 'SELECT * + FROM phpbb_attachments + WHERE in_message = 0 AND ' . $this->db->sql_in_set('post_msg_id', $post_ids); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $this->data['attachments'][(int) $row['post_msg_id']][] = (int) $row['attach_id']; + } + $this->db->sql_freeresult($result); + } + } + } +} -- cgit v1.2.1 From 13d939b7e104425dc6710c6b3e71e8c3acb95321 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 21 Apr 2014 01:39:12 +0200 Subject: [ticket/12413] Useing @depends to transmit the state of the board the state of the board is calculate in the first test and transmit to the others thanks to the @depends annotation. PHPBB3-12413 --- tests/functional/feed_test.php | 418 ++++++++++++++++++++++++++++++++--------- 1 file changed, 328 insertions(+), 90 deletions(-) diff --git a/tests/functional/feed_test.php b/tests/functional/feed_test.php index 9aff0340f4..c6d4fee8fd 100644 --- a/tests/functional/feed_test.php +++ b/tests/functional/feed_test.php @@ -14,8 +14,110 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case { protected $data = array(); - public function test_setup_forums() + private $init_values = array(); + + public function test_setup_config_before_state() + { + $this->login(); + $this->admin_login(); + + $crawler = self::request('GET', "adm/index.php?sid={$this->sid}&i=acp_board&mode=feed"); + + $form = $crawler->selectButton('Submit')->form(); + $values = $form->getValues(); + + $this->init_values['post_base_items'] = (int)$values['config[feed_limit_post]']; + $this->init_values['topic_base_items'] = (int)$values['config[feed_limit_topic]']; + + // Enable all feeds + $values["config[feed_enable]"] = true; + $values["config[feed_forum]"] = true; + $values["config[feed_item_statistics]"] = true; + $values["config[feed_overall]"] = true; + $values["config[feed_overall_forums]"] = true; + $values["config[feed_topic]"] = true; + $values["config[feed_topics_active]"] = true; + $values["config[feed_topics_new]"] = true; + + $form->setValues($values); + + $crawler = self::submit($form); + $this->assertGreaterThan(0, $crawler->filter('.successbox')->count()); + + // Special config (Guest can't see attachments) + $this->add_lang('acp/permissions'); + + $crawler = self::request('GET', "adm/index.php?i=acp_permissions&sid={$this->sid}&icat=16&mode=setting_group_global&group_id[0]=1"); + $this->assertContains($this->lang('ACL_SET'), $crawler->filter('h1')->eq(1)->text()); + + $form = $crawler->selectButton($this->lang('APPLY_PERMISSIONS'))->form(); + $form["setting[1][0][u_download]"]->select(-1); + + $crawler = self::submit($form); + $this->assertGreaterThan(0, $crawler->filter('.successbox')->count()); + + return $this->init_values; + } + + /** + * @depends test_setup_config_before_state + */ + public function test_dump_board_state($init_values) + { + $this->init_values = $init_values; + + $crawler = self::request('GET', 'feed.php?mode=forums', array(), false); + self::assert_response_xml(); + $this->init_values['disapprove_user']['forums_value'] = (int)$crawler->filterXPath("//entry")->count(); + + $crawler = self::request('GET', 'feed.php?mode=overall', array(), false); + self::assert_response_xml(); + $this->init_values['disapprove_user']['overall_value'] = $crawler->filterXPath("//entry")->count(); + + $crawler = self::request('GET', 'feed.php?mode=topics', array(), false); + self::assert_response_xml(); + $this->init_values['disapprove_user']['topics_value'] = $crawler->filterXPath("//entry")->count(); + + $crawler = self::request('GET', 'feed.php?mode=topics_new', array(), false); + self::assert_response_xml(); + $this->init_values['disapprove_user']['topics_new_value'] = $crawler->filterXPath("//entry")->count(); + + $crawler = self::request('GET', 'feed.php?mode=topics_active', array(), false); + self::assert_response_xml(); + $this->init_values['disapprove_user']['topics_active_value'] = $crawler->filterXPath("//entry")->count(); + + $this->login(); + + $crawler = self::request('GET', 'feed.php?mode=forums', array(), false); + self::assert_response_xml(); + $this->init_values['admin']['forums_value'] = (int)$crawler->filterXPath("//entry")->count(); + + $crawler = self::request('GET', 'feed.php?mode=overall', array(), false); + self::assert_response_xml(); + $this->init_values['admin']['overall_value'] = $crawler->filterXPath("//entry")->count(); + + $crawler = self::request('GET', 'feed.php?mode=topics', array(), false); + self::assert_response_xml(); + $this->init_values['admin']['topics_value'] = $crawler->filterXPath("//entry")->count(); + + $crawler = self::request('GET', 'feed.php?mode=topics_new', array(), false); + self::assert_response_xml(); + $this->init_values['admin']['topics_new_value'] = $crawler->filterXPath("//entry")->count(); + + $crawler = self::request('GET', 'feed.php?mode=topics_active', array(), false); + self::assert_response_xml(); + $this->init_values['admin']['topics_active_value'] = $crawler->filterXPath("//entry")->count(); + + return $this->init_values; + } + + /** + * @depends test_dump_board_state + */ + public function test_setup_forums($init_values) { + $this->init_values = $init_values; + $this->login(); $this->admin_login(); $this->create_user("disapprove_user"); @@ -71,8 +173,13 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $crawler = self::submit($form); } - public function test_setup_config() + /** + * @depends test_dump_board_state + */ + public function test_setup_config_after_forums($init_values) { + $this->init_values = $init_values; + $this->login(); $this->admin_login(); @@ -86,19 +193,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $crawler = self::request('GET', "adm/index.php?sid={$this->sid}&i=acp_board&mode=feed"); $form = $crawler->selectButton('Submit')->form(); - $values = $form->getValues(); - - // Enable all feeds - $values["config[feed_enable]"] = true; - $values["config[feed_forum]"] = true; - $values["config[feed_item_statistics]"] = true; - $values["config[feed_overall]"] = true; - $values["config[feed_overall_forums]"] = true; - $values["config[feed_topic]"] = true; - $values["config[feed_topics_active]"] = true; - $values["config[feed_topics_new]"] = true; - - $form->setValues($values); // News/Exclude's forums config $form['feed_news_id']->select(array($this->data['forums']['Feeds #news'])); @@ -106,22 +200,14 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $crawler = self::submit($form); $this->assertGreaterThan(0, $crawler->filter('.successbox')->count()); - - // News special config (Guest can't see attachments) - $this->add_lang('acp/permissions'); - - $crawler = self::request('GET', "adm/index.php?i=acp_permissions&sid={$this->sid}&icat=16&mode=setting_group_global&group_id[0]=1"); - $this->assertContains($this->lang('ACL_SET'), $crawler->filter('h1')->eq(1)->text()); - - $form = $crawler->selectButton($this->lang('APPLY_PERMISSIONS'))->form(); - $form["setting[1][0][u_download]"]->select(-1); - - $crawler = self::submit($form); - $this->assertGreaterThan(0, $crawler->filter('.successbox')->count()); } - public function test_feeds_empty() + /** + * @depends test_dump_board_state + */ + public function test_feeds_empty($init_values) { + $this->init_values = $init_values; $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -143,7 +229,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'forums' => array( array( - 'nb_entries' => 4, + 'nb_entries' => 3, 'xpath' => array( '//entry/category[@label="Feeds #exclude"]' => 0, ), @@ -157,8 +243,13 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'admin'); } - public function test_create_exclude_topic() + /** + * @depends test_dump_board_state + */ + public function test_create_exclude_topic($init_values) { + $this->init_values = $init_values; + $this->login(); $this->load_ids(array( 'forums' => array( @@ -170,8 +261,13 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $this->data['topics']['Feeds #exclude - Topic #1'] = (int) $post['topic_id']; } - public function test_feeds_exclude() + /** + * @depends test_dump_board_state + */ + public function test_feeds_exclude($init_values) { + $this->init_values = $init_values; + $this->load_ids(array( 'forums' => array( 'Feeds #exclude', @@ -199,7 +295,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'overall' => array( array( - 'nb_entries' => 1, + 'nb_entries' => 0, 'xpath' => array( '//entry/title[contains(., "#exclude")]' => 0, ), @@ -207,7 +303,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics' => array( array( - 'nb_entries' => 1, + 'nb_entries' => 0, 'xpath' => array( '//entry/title[contains(., "#exclude")]' => 0, ), @@ -215,7 +311,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_new' => array( array( - 'nb_entries' => 1, + 'nb_entries' => 0, 'xpath' => array( '//entry/title[contains(., "#exclude")]' => 0, ), @@ -223,7 +319,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_active' => array( array( - 'nb_entries' => 1, + 'nb_entries' => 0, 'xpath' => array( '//entry/title[contains(., "#exclude")]' => 0, ), @@ -232,8 +328,13 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'admin'); } - public function test_create_news_topics() + /** + * @depends test_dump_board_state + */ + public function test_create_news_topics($init_values) { + $this->init_values = $init_values; + $this->login(); $this->load_ids(array( 'forums' => array( @@ -259,8 +360,13 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $this->data['posts']['Re: Feeds #news - Topic #2'] = (int) $post2['post_id']; } - public function test_feeds_news_admin() + /** + * @depends test_dump_board_state + */ + public function test_feeds_news_admin($init_values) { + $this->init_values = $init_values; + $this->load_ids(array( 'forums' => array( 'Feeds #news', @@ -304,7 +410,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'overall' => array( array( - 'nb_entries' => 4, + 'nb_entries' => 3, 'xpath' => array( '//entry/title[contains(., "#news")]' => 3, ), @@ -312,7 +418,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics' => array( array( - 'nb_entries' => 3, + 'nb_entries' => 2, 'xpath' => array( '//entry/title[contains(., "#news")]' => 2, ), @@ -320,7 +426,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_new' => array( array( - 'nb_entries' => 3, + 'nb_entries' => 2, 'xpath' => array( '//entry/title[contains(., "#news")]' => 2, ), @@ -328,7 +434,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_active' => array( array( - 'nb_entries' => 3, + 'nb_entries' => 2, 'xpath' => array( '//entry/title[contains(., "#news")]' => 2, ), @@ -337,8 +443,13 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'admin'); } - public function test_feeds_news_guest() + /** + * @depends test_dump_board_state + */ + public function test_feeds_news_guest($init_values) { + $this->init_values = $init_values; + $this->load_ids(array( 'posts' => array( 'Feeds #news - Topic #2', @@ -359,8 +470,13 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case )); } - public function test_create_sub_forum_topic() + /** + * @depends test_dump_board_state + */ + public function test_create_sub_forum_topic($init_values) { + $this->init_values = $init_values; + $this->login(); $this->load_ids(array( 'forums' => array( @@ -376,8 +492,13 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $this->data['topics']['Feeds #1.1 - Topic #1'] = (int) $post['topic_id']; } - public function test_feeds_sub_forum() + /** + * @depends test_dump_board_state + */ + public function test_feeds_sub_forum($init_values) { + $this->init_values = $init_values; + $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -395,8 +516,13 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'admin'); } - public function test_create_softdelete_post() + /** + * @depends test_dump_board_state + */ + public function test_create_softdelete_post($init_values) { + $this->init_values = $init_values; + $this->login(); $this->load_ids(array( 'forums' => array( @@ -415,8 +541,13 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $this->data['posts']['Re: Feeds #1 - Topic #2'] = (int) $post2['post_id']; } - public function test_softdelete_post() + /** + * @depends test_dump_board_state + */ + public function test_softdelete_post($init_values) { + $this->init_values = $init_values; + $this->login(); $this->load_ids(array( 'forums' => array( @@ -442,8 +573,13 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $this->assertContains($this->lang('POST_DISPLAY', '', ''), $crawler->text()); } - public function test_feeds_softdeleted_post_admin() + /** + * @depends test_dump_board_state + */ + public function test_feeds_softdeleted_post_admin($init_values) { + $this->init_values = $init_values; + $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -475,7 +611,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'overall' => array( array( - 'nb_entries' => 8, + 'nb_entries' => 7, 'contents_lang' => array( 1 => 'POST_DELETED', ), @@ -484,8 +620,13 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'admin'); } - public function test_feeds_softdeleted_post_guest() + /** + * @depends test_dump_board_state + */ + public function test_feeds_softdeleted_post_guest($init_values) { + $this->init_values = $init_values; + $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -511,14 +652,19 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'overall' => array( array( - 'nb_entries' => 7, + 'nb_entries' => 6, ), ), )); } - public function test_softdelete_topic() + /** + * @depends test_dump_board_state + */ + public function test_softdelete_topic($init_values) { + $this->init_values = $init_values; + $this->login(); $this->load_ids(array( 'forums' => array( @@ -546,8 +692,13 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $this->assertContains('Feeds #1 - Topic #2', $crawler->filter('h2')->text()); } - public function test_feeds_softdeleted_topic_admin() + /** + * @depends test_dump_board_state + */ + public function test_feeds_softdeleted_topic_admin($init_values) { + $this->init_values = $init_values; + $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -581,7 +732,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'overall' => array( array( - 'nb_entries' => 8, + 'nb_entries' => 7, 'contents_lang' => array( 1 => 'POST_DELETED', 2 => 'POST_DELETED', @@ -590,7 +741,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics' => array( array( - 'nb_entries' => 6, + 'nb_entries' => 5, 'contents_lang' => array( 1 => 'TOPIC_DELETED', ), @@ -598,7 +749,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_new' => array( array( - 'nb_entries' => 6, + 'nb_entries' => 5, 'contents_lang' => array( 1 => 'TOPIC_DELETED', ), @@ -606,7 +757,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_active' => array( array( - 'nb_entries' => 6, + 'nb_entries' => 5, 'contents_lang' => array( 1 => 'TOPIC_DELETED', ), @@ -615,8 +766,13 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'admin'); } - public function test_feeds_softdeleted_topic_guest() + /** + * @depends test_dump_board_state + */ + public function test_feeds_softdeleted_topic_guest($init_values) { + $this->init_values = $init_values; + $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -642,29 +798,34 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'overall' => array( array( - 'nb_entries' => 6, + 'nb_entries' => 5, ), ), 'topics' => array( array( - 'nb_entries' => 5, + 'nb_entries' => 4, ), ), 'topics_new' => array( array( - 'nb_entries' => 5, + 'nb_entries' => 4, ), ), 'topics_active' => array( array( - 'nb_entries' => 5, + 'nb_entries' => 4, ), ), )); } - public function test_create_unapproved_post() + /** + * @depends test_dump_board_state + */ + public function test_create_unapproved_post($init_values) { + $this->init_values = $init_values; + $this->load_ids(array( 'forums' => array( 'Feeds #1.1', @@ -684,8 +845,13 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $this->assertNotContains('Re: Feeds #1.1 - Topic #2', $crawler->filter('html')->text()); } - public function test_feeds_unapproved_post_admin() + /** + * @depends test_dump_board_state + */ + public function test_feeds_unapproved_post_admin($init_values) { + $this->init_values = $init_values; + $this->load_ids(array( 'forums' => array( 'Feeds #1.1', @@ -717,7 +883,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'overall' => array( array( - 'nb_entries' => 10, + 'nb_entries' => 9, 'contents_lang' => array( 1 => 'POST_UNAPPROVED', ), @@ -726,8 +892,13 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'admin'); } - public function test_feeds_unapproved_post_disapprove_user() + /** + * @depends test_dump_board_state + */ + public function test_feeds_unapproved_post_disapprove_user($init_values) { + $this->init_values = $init_values; + $this->load_ids(array( 'forums' => array( 'Feeds #1.1', @@ -753,14 +924,19 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'overall' => array( array( - 'nb_entries' => 7, + 'nb_entries' => 6, ), ), ), 'disapprove_user'); } - public function test_create_unapproved_topic() + /** + * @depends test_dump_board_state + */ + public function test_create_unapproved_topic($init_values) { + $this->init_values = $init_values; + $this->load_ids(array( 'forums' => array( 'Feeds #1.1', @@ -778,8 +954,13 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $this->assertNotContains('Feeds #1.1 - Topic #3', $crawler->filter('html')->text()); } - public function test_feeds_unapproved_topic_admin() + /** + * @depends test_dump_board_state + */ + public function test_feeds_unapproved_topic_admin($init_values) { + $this->init_values = $init_values; + $this->load_ids(array( 'forums' => array( 'Feeds #1.1', @@ -811,7 +992,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'overall' => array( array( - 'nb_entries' => 11, + 'nb_entries' => 10, 'contents_lang' => array( 1 => 'POST_UNAPPROVED', ), @@ -819,7 +1000,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics' => array( array( - 'nb_entries' => 8, + 'nb_entries' => 7, 'contents_lang' => array( 1 => 'TOPIC_UNAPPROVED', ), @@ -827,7 +1008,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_new' => array( array( - 'nb_entries' => 8, + 'nb_entries' => 7, 'contents_lang' => array( 1 => 'TOPIC_UNAPPROVED', ), @@ -835,7 +1016,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_active' => array( array( - 'nb_entries' => 8, + 'nb_entries' => 7, 'contents_lang' => array( 1 => 'TOPIC_UNAPPROVED', ), @@ -844,8 +1025,13 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'admin'); } - public function test_feeds_unapproved_topic_disapprove_user() + /** + * @depends test_dump_board_state + */ + public function test_feeds_unapproved_topic_disapprove_user($init_values) { + $this->init_values = $init_values; + $this->load_ids(array( 'forums' => array( 'Feeds #1.1', @@ -871,29 +1057,34 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'overall' => array( array( - 'nb_entries' => 7, + 'nb_entries' => 6, ), ), 'topics' => array( array( - 'nb_entries' => 6, + 'nb_entries' => 5, ), ), 'topics_new' => array( array( - 'nb_entries' => 6, + 'nb_entries' => 5, ), ), 'topics_active' => array( array( - 'nb_entries' => 6, + 'nb_entries' => 5, ), ), ), 'disapprove_user'); } - public function test_create_attachment_topic() + /** + * @depends test_dump_board_state + */ + public function test_create_attachment_topic($init_values) { + $this->init_values = $init_values; + $this->login(); $this->load_ids(array( 'forums' => array( @@ -909,8 +1100,13 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $this->data['topics']['Feeds #1 - Topic #3'] = (int) $post['topic_id']; } - public function test_feeds_attachment_admin() + /** + * @depends test_dump_board_state + */ + public function test_feeds_attachment_admin($init_values) { + $this->init_values = $init_values; + $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -955,7 +1151,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'overall' => array( array( - 'nb_entries' => 12, + 'nb_entries' => 11, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -968,7 +1164,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics' => array( array( - 'nb_entries' => 9, + 'nb_entries' => 8, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -981,7 +1177,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_new' => array( array( - 'nb_entries' => 9, + 'nb_entries' => 8, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -994,7 +1190,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_active' => array( array( - 'nb_entries' => 9, + 'nb_entries' => 8, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1008,8 +1204,13 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'admin'); } - public function test_feeds_attachment_guest() + /** + * @depends test_dump_board_state + */ + public function test_feeds_attachment_guest($init_values) { + $this->init_values = $init_values; + $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -1054,7 +1255,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'overall' => array( array( - 'nb_entries' => 8, + 'nb_entries' => 7, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1067,7 +1268,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics' => array( array( - 'nb_entries' => 7, + 'nb_entries' => 6, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1080,7 +1281,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_new' => array( array( - 'nb_entries' => 7, + 'nb_entries' => 6, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1093,7 +1294,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_active' => array( array( - 'nb_entries' => 7, + 'nb_entries' => 6, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1108,8 +1309,13 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case } // Disabled until PHPBB3-12418 is fixed and merged - /*public function test_create_missing_attachment_post() + /** + * @depends test_dump_board_state + */ + /*public function test_create_missing_attachment_post($init_values) { + $this->init_values = $init_values; + $this->login(); $this->load_ids(array( 'forums' => array( @@ -1128,8 +1334,13 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $this->data['posts']['Re: Feeds #1 - Topic #3-1'] = (int) $post2['post_id']; } - public function test_feeds_missing_attachment_admin() + /** + * @depends test_dump_board_state + * / + public function test_feeds_missing_attachment_admin($init_values) { + $this->init_values = $init_values; + $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -1213,6 +1424,11 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case if ($username) { $this->login($username); + $init_values = $this->init_values[$username]; + } + else + { + $init_values = $this->init_values['disapprove_user']; } foreach ($data as $mode => $feeds) @@ -1226,6 +1442,28 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case } else { + switch ($mode) { + case 'forums': + $feed_data['nb_entries'] = ((int)$feed_data['nb_entries'] + $init_values['forums_value']); + break; + case 'overall': + $feed_data['nb_entries'] = min($feed_data['nb_entries'] + $init_values['overall_value'], $this->init_values['post_base_items']); + break; + case 'topics': + $feed_data['nb_entries'] = min($feed_data['nb_entries'] + $init_values['topics_value'], $this->init_values['topic_base_items']); + break; + case 'topics_new': + $feed_data['nb_entries'] = min($feed_data['nb_entries'] + $init_values['topics_new_value'], $this->init_values['topic_base_items']); + break; + case 'topics_active': + $feed_data['nb_entries'] = min($feed_data['nb_entries'] + $init_values['topics_active_value'], $this->init_values['topic_base_items']); + break; + case 'news': + break; + default: + $this->fail('Unsupported feed.'); + } + $params = "?mode={$mode}"; $this->assert_feed($params, $feed_data); } -- cgit v1.2.1 From 6c58f8cdeef5793c8ad5f2762ad81ad6e02bf9e7 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 21 Apr 2014 13:15:15 +0200 Subject: [ticket/12413] Using static attribute instead of @depends Using a static attribute to store the initial state of the feeds instead of transmit it with the @depends annotation. This attribute is also added to backupStaticAttributesBlackList PHPBB3-12413 --- tests/functional/feed_test.php | 253 ++++++++++------------------------------- 1 file changed, 59 insertions(+), 194 deletions(-) diff --git a/tests/functional/feed_test.php b/tests/functional/feed_test.php index c6d4fee8fd..2612d5a138 100644 --- a/tests/functional/feed_test.php +++ b/tests/functional/feed_test.php @@ -14,7 +14,16 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case { protected $data = array(); - private $init_values = array(); + static public $init_values = array(); + + public function __construct($name = NULL, array $data = array(), $dataName = '') + { + parent::__construct($name, $data, $dataName); + + $this->backupStaticAttributesBlacklist += array( + 'phpbb_functional_feed_test' => array('init_values'), + ); + } public function test_setup_config_before_state() { @@ -26,8 +35,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $form = $crawler->selectButton('Submit')->form(); $values = $form->getValues(); - $this->init_values['post_base_items'] = (int)$values['config[feed_limit_post]']; - $this->init_values['topic_base_items'] = (int)$values['config[feed_limit_topic]']; + self::$init_values['post_base_items'] = (int)$values['config[feed_limit_post]']; + self::$init_values['topic_base_items'] = (int)$values['config[feed_limit_topic]']; // Enable all feeds $values["config[feed_enable]"] = true; @@ -56,68 +65,58 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $crawler = self::submit($form); $this->assertGreaterThan(0, $crawler->filter('.successbox')->count()); - return $this->init_values; + } - /** - * @depends test_setup_config_before_state - */ - public function test_dump_board_state($init_values) + public function test_dump_board_state() { - $this->init_values = $init_values; - $crawler = self::request('GET', 'feed.php?mode=forums', array(), false); self::assert_response_xml(); - $this->init_values['disapprove_user']['forums_value'] = (int)$crawler->filterXPath("//entry")->count(); + self::$init_values['disapprove_user']['forums_value'] = (int)$crawler->filterXPath("//entry")->count(); $crawler = self::request('GET', 'feed.php?mode=overall', array(), false); self::assert_response_xml(); - $this->init_values['disapprove_user']['overall_value'] = $crawler->filterXPath("//entry")->count(); + self::$init_values['disapprove_user']['overall_value'] = $crawler->filterXPath("//entry")->count(); $crawler = self::request('GET', 'feed.php?mode=topics', array(), false); self::assert_response_xml(); - $this->init_values['disapprove_user']['topics_value'] = $crawler->filterXPath("//entry")->count(); + self::$init_values['disapprove_user']['topics_value'] = $crawler->filterXPath("//entry")->count(); $crawler = self::request('GET', 'feed.php?mode=topics_new', array(), false); self::assert_response_xml(); - $this->init_values['disapprove_user']['topics_new_value'] = $crawler->filterXPath("//entry")->count(); + self::$init_values['disapprove_user']['topics_new_value'] = $crawler->filterXPath("//entry")->count(); $crawler = self::request('GET', 'feed.php?mode=topics_active', array(), false); self::assert_response_xml(); - $this->init_values['disapprove_user']['topics_active_value'] = $crawler->filterXPath("//entry")->count(); + self::$init_values['disapprove_user']['topics_active_value'] = $crawler->filterXPath("//entry")->count(); $this->login(); $crawler = self::request('GET', 'feed.php?mode=forums', array(), false); self::assert_response_xml(); - $this->init_values['admin']['forums_value'] = (int)$crawler->filterXPath("//entry")->count(); + self::$init_values['admin']['forums_value'] = (int)$crawler->filterXPath("//entry")->count(); $crawler = self::request('GET', 'feed.php?mode=overall', array(), false); self::assert_response_xml(); - $this->init_values['admin']['overall_value'] = $crawler->filterXPath("//entry")->count(); + self::$init_values['admin']['overall_value'] = $crawler->filterXPath("//entry")->count(); $crawler = self::request('GET', 'feed.php?mode=topics', array(), false); self::assert_response_xml(); - $this->init_values['admin']['topics_value'] = $crawler->filterXPath("//entry")->count(); + self::$init_values['admin']['topics_value'] = $crawler->filterXPath("//entry")->count(); $crawler = self::request('GET', 'feed.php?mode=topics_new', array(), false); self::assert_response_xml(); - $this->init_values['admin']['topics_new_value'] = $crawler->filterXPath("//entry")->count(); + self::$init_values['admin']['topics_new_value'] = $crawler->filterXPath("//entry")->count(); $crawler = self::request('GET', 'feed.php?mode=topics_active', array(), false); self::assert_response_xml(); - $this->init_values['admin']['topics_active_value'] = $crawler->filterXPath("//entry")->count(); + self::$init_values['admin']['topics_active_value'] = $crawler->filterXPath("//entry")->count(); + - return $this->init_values; } - /** - * @depends test_dump_board_state - */ - public function test_setup_forums($init_values) + public function test_setup_forums() { - $this->init_values = $init_values; - $this->login(); $this->admin_login(); $this->create_user("disapprove_user"); @@ -173,13 +172,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $crawler = self::submit($form); } - /** - * @depends test_dump_board_state - */ - public function test_setup_config_after_forums($init_values) + public function test_setup_config_after_forums() { - $this->init_values = $init_values; - $this->login(); $this->admin_login(); @@ -202,12 +196,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $this->assertGreaterThan(0, $crawler->filter('.successbox')->count()); } - /** - * @depends test_dump_board_state - */ - public function test_feeds_empty($init_values) + public function test_feeds_empty() { - $this->init_values = $init_values; $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -243,13 +233,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'admin'); } - /** - * @depends test_dump_board_state - */ - public function test_create_exclude_topic($init_values) + public function test_create_exclude_topic() { - $this->init_values = $init_values; - $this->login(); $this->load_ids(array( 'forums' => array( @@ -261,13 +246,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $this->data['topics']['Feeds #exclude - Topic #1'] = (int) $post['topic_id']; } - /** - * @depends test_dump_board_state - */ - public function test_feeds_exclude($init_values) + public function test_feeds_exclude() { - $this->init_values = $init_values; - $this->load_ids(array( 'forums' => array( 'Feeds #exclude', @@ -328,13 +308,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'admin'); } - /** - * @depends test_dump_board_state - */ - public function test_create_news_topics($init_values) + public function test_create_news_topics() { - $this->init_values = $init_values; - $this->login(); $this->load_ids(array( 'forums' => array( @@ -360,13 +335,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $this->data['posts']['Re: Feeds #news - Topic #2'] = (int) $post2['post_id']; } - /** - * @depends test_dump_board_state - */ - public function test_feeds_news_admin($init_values) + public function test_feeds_news_admin() { - $this->init_values = $init_values; - $this->load_ids(array( 'forums' => array( 'Feeds #news', @@ -443,13 +413,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'admin'); } - /** - * @depends test_dump_board_state - */ - public function test_feeds_news_guest($init_values) + public function test_feeds_news_guest() { - $this->init_values = $init_values; - $this->load_ids(array( 'posts' => array( 'Feeds #news - Topic #2', @@ -470,13 +435,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case )); } - /** - * @depends test_dump_board_state - */ - public function test_create_sub_forum_topic($init_values) + public function test_create_sub_forum_topic() { - $this->init_values = $init_values; - $this->login(); $this->load_ids(array( 'forums' => array( @@ -492,13 +452,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $this->data['topics']['Feeds #1.1 - Topic #1'] = (int) $post['topic_id']; } - /** - * @depends test_dump_board_state - */ - public function test_feeds_sub_forum($init_values) + public function test_feeds_sub_forum() { - $this->init_values = $init_values; - $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -516,13 +471,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'admin'); } - /** - * @depends test_dump_board_state - */ - public function test_create_softdelete_post($init_values) + public function test_create_softdelete_post() { - $this->init_values = $init_values; - $this->login(); $this->load_ids(array( 'forums' => array( @@ -541,13 +491,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $this->data['posts']['Re: Feeds #1 - Topic #2'] = (int) $post2['post_id']; } - /** - * @depends test_dump_board_state - */ - public function test_softdelete_post($init_values) + public function test_softdelete_post() { - $this->init_values = $init_values; - $this->login(); $this->load_ids(array( 'forums' => array( @@ -573,13 +518,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $this->assertContains($this->lang('POST_DISPLAY', '', ''), $crawler->text()); } - /** - * @depends test_dump_board_state - */ - public function test_feeds_softdeleted_post_admin($init_values) + public function test_feeds_softdeleted_post_admin() { - $this->init_values = $init_values; - $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -620,13 +560,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'admin'); } - /** - * @depends test_dump_board_state - */ - public function test_feeds_softdeleted_post_guest($init_values) + public function test_feeds_softdeleted_post_guest() { - $this->init_values = $init_values; - $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -658,13 +593,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case )); } - /** - * @depends test_dump_board_state - */ - public function test_softdelete_topic($init_values) + public function test_softdelete_topic() { - $this->init_values = $init_values; - $this->login(); $this->load_ids(array( 'forums' => array( @@ -692,13 +622,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $this->assertContains('Feeds #1 - Topic #2', $crawler->filter('h2')->text()); } - /** - * @depends test_dump_board_state - */ - public function test_feeds_softdeleted_topic_admin($init_values) + public function test_feeds_softdeleted_topic_admin() { - $this->init_values = $init_values; - $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -766,13 +691,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'admin'); } - /** - * @depends test_dump_board_state - */ - public function test_feeds_softdeleted_topic_guest($init_values) + public function test_feeds_softdeleted_topic_guest() { - $this->init_values = $init_values; - $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -819,13 +739,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case )); } - /** - * @depends test_dump_board_state - */ - public function test_create_unapproved_post($init_values) + public function test_create_unapproved_post() { - $this->init_values = $init_values; - $this->load_ids(array( 'forums' => array( 'Feeds #1.1', @@ -845,13 +760,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $this->assertNotContains('Re: Feeds #1.1 - Topic #2', $crawler->filter('html')->text()); } - /** - * @depends test_dump_board_state - */ - public function test_feeds_unapproved_post_admin($init_values) + public function test_feeds_unapproved_post_admin() { - $this->init_values = $init_values; - $this->load_ids(array( 'forums' => array( 'Feeds #1.1', @@ -892,13 +802,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'admin'); } - /** - * @depends test_dump_board_state - */ - public function test_feeds_unapproved_post_disapprove_user($init_values) + public function test_feeds_unapproved_post_disapprove_user() { - $this->init_values = $init_values; - $this->load_ids(array( 'forums' => array( 'Feeds #1.1', @@ -930,13 +835,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'disapprove_user'); } - /** - * @depends test_dump_board_state - */ - public function test_create_unapproved_topic($init_values) + public function test_create_unapproved_topic() { - $this->init_values = $init_values; - $this->load_ids(array( 'forums' => array( 'Feeds #1.1', @@ -954,13 +854,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $this->assertNotContains('Feeds #1.1 - Topic #3', $crawler->filter('html')->text()); } - /** - * @depends test_dump_board_state - */ - public function test_feeds_unapproved_topic_admin($init_values) + public function test_feeds_unapproved_topic_admin() { - $this->init_values = $init_values; - $this->load_ids(array( 'forums' => array( 'Feeds #1.1', @@ -1025,13 +920,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'admin'); } - /** - * @depends test_dump_board_state - */ - public function test_feeds_unapproved_topic_disapprove_user($init_values) + public function test_feeds_unapproved_topic_disapprove_user() { - $this->init_values = $init_values; - $this->load_ids(array( 'forums' => array( 'Feeds #1.1', @@ -1078,13 +968,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'disapprove_user'); } - /** - * @depends test_dump_board_state - */ - public function test_create_attachment_topic($init_values) + public function test_create_attachment_topic() { - $this->init_values = $init_values; - $this->login(); $this->load_ids(array( 'forums' => array( @@ -1100,13 +985,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $this->data['topics']['Feeds #1 - Topic #3'] = (int) $post['topic_id']; } - /** - * @depends test_dump_board_state - */ - public function test_feeds_attachment_admin($init_values) + public function test_feeds_attachment_admin() { - $this->init_values = $init_values; - $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -1204,13 +1084,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'admin'); } - /** - * @depends test_dump_board_state - */ - public function test_feeds_attachment_guest($init_values) + public function test_feeds_attachment_guest() { - $this->init_values = $init_values; - $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -1309,13 +1184,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case } // Disabled until PHPBB3-12418 is fixed and merged - /** - * @depends test_dump_board_state - */ - /*public function test_create_missing_attachment_post($init_values) + /*public function test_create_missing_attachment_post() { - $this->init_values = $init_values; - $this->login(); $this->load_ids(array( 'forums' => array( @@ -1334,13 +1204,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $this->data['posts']['Re: Feeds #1 - Topic #3-1'] = (int) $post2['post_id']; } - /** - * @depends test_dump_board_state - * / - public function test_feeds_missing_attachment_admin($init_values) + public function test_feeds_missing_attachment_admin() { - $this->init_values = $init_values; - $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -1424,11 +1289,11 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case if ($username) { $this->login($username); - $init_values = $this->init_values[$username]; + $init_values = self::$init_values[$username]; } else { - $init_values = $this->init_values['disapprove_user']; + $init_values = self::$init_values['disapprove_user']; } foreach ($data as $mode => $feeds) @@ -1447,16 +1312,16 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $feed_data['nb_entries'] = ((int)$feed_data['nb_entries'] + $init_values['forums_value']); break; case 'overall': - $feed_data['nb_entries'] = min($feed_data['nb_entries'] + $init_values['overall_value'], $this->init_values['post_base_items']); + $feed_data['nb_entries'] = min($feed_data['nb_entries'] + $init_values['overall_value'], self::$init_values['post_base_items']); break; case 'topics': - $feed_data['nb_entries'] = min($feed_data['nb_entries'] + $init_values['topics_value'], $this->init_values['topic_base_items']); + $feed_data['nb_entries'] = min($feed_data['nb_entries'] + $init_values['topics_value'], self::$init_values['topic_base_items']); break; case 'topics_new': - $feed_data['nb_entries'] = min($feed_data['nb_entries'] + $init_values['topics_new_value'], $this->init_values['topic_base_items']); + $feed_data['nb_entries'] = min($feed_data['nb_entries'] + $init_values['topics_new_value'], self::$init_values['topic_base_items']); break; case 'topics_active': - $feed_data['nb_entries'] = min($feed_data['nb_entries'] + $init_values['topics_active_value'], $this->init_values['topic_base_items']); + $feed_data['nb_entries'] = min($feed_data['nb_entries'] + $init_values['topics_active_value'], self::$init_values['topic_base_items']); break; case 'news': break; -- cgit v1.2.1 From edf0fd0fbd4e76e57bb3899aaffeee730eec8261 Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Tue, 22 Apr 2014 19:07:03 +0200 Subject: [ticket/12413] Adding the missing visibilities PHPBB3-12413 --- phpBB/phpbb/feed/attachments_base.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/phpBB/phpbb/feed/attachments_base.php b/phpBB/phpbb/feed/attachments_base.php index b497d3b3f7..b8c72a7fb1 100644 --- a/phpBB/phpbb/feed/attachments_base.php +++ b/phpBB/phpbb/feed/attachments_base.php @@ -21,15 +21,10 @@ abstract class attachments_base extends \phpbb\feed\base */ protected $attachments = array(); - function open() - { - $this->fetch_attachments(); - } - /** * Retrieve the list of attachments that may be displayed */ - function fetch_attachments() + protected function fetch_attachments() { global $db; @@ -68,13 +63,18 @@ abstract class attachments_base extends \phpbb\feed\base $db->sql_freeresult($result); } + public function open() + { + $this->fetch_attachments(); + } + /** * Get attachments related to a given post * - * @param $post_id Post id - * @return mixed Attachments related to $post_id + * @param $post_id int Post id + * @return mixed Attachments related to $post_id */ - function get_attachments($post_id) + public function get_attachments($post_id) { return $this->attachments[$post_id]; } -- cgit v1.2.1 From ac59b6a19914a86bc434fd8ac6aae4f901c72f98 Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Thu, 24 Apr 2014 00:52:04 +0200 Subject: [ticket/12413] Fixing the failed test The test was failing because travis is too fast: 2 posts had the same timestamp. PHPBB3-12413 --- tests/functional/feed_test.php | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/tests/functional/feed_test.php b/tests/functional/feed_test.php index 2612d5a138..98a3bf2aa4 100644 --- a/tests/functional/feed_test.php +++ b/tests/functional/feed_test.php @@ -1,15 +1,15 @@ create_topic($this->data['forums']['Feeds #news'], 'Feeds #news - Topic #1', 'This is a test topic posted by the testing framework.'); $this->data['topics']['Feeds #news - Topic #1'] = (int) $post['topic_id']; + // Travis is too fast, so we have to wait + sleep(1); + $post = $this->create_topic($this->data['forums']['Feeds #news'], 'Feeds #news - Topic #2', 'This is a test topic posted by the testing framework.'); $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}"); + // Travis is too fast, so we have to wait + sleep(1); + $this->assertContains('Feeds #news - Topic #2', $crawler->filter('html')->text()); $this->data['topics']['Feeds #news - Topic #2'] = (int) $post['topic_id']; $this->data['posts']['Feeds #news - Topic #2'] = (int) $this->get_parameter_from_link($crawler->filter('.post')->selectLink($this->lang('POST', '', ''))->link()->getUri(), 'p'); @@ -448,6 +454,9 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $post = $this->create_topic($this->data['forums']['Feeds #1'], 'Feeds #1 - Topic #1', 'This is a test topic posted by the testing framework.'); $this->data['topics']['Feeds #1 - Topic #1'] = (int) $post['topic_id']; + // Travis is too fast, so we have to wait + sleep(1); + $post = $this->create_topic($this->data['forums']['Feeds #1.1'], 'Feeds #1.1 - Topic #1', 'This is a test topic posted by the testing framework.'); $this->data['topics']['Feeds #1.1 - Topic #1'] = (int) $post['topic_id']; } @@ -483,6 +492,9 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $post = $this->create_topic($this->data['forums']['Feeds #1'], 'Feeds #1 - Topic #2', 'This is a test topic posted by the testing framework.'); $this->data['topics']['Feeds #1 - Topic #2'] = (int) $post['topic_id']; + // Travis is too fast, so we have to wait + sleep(1); + // Test creating a reply $post2 = $this->create_post($this->data['forums']['Feeds #1'], $post['topic_id'], 'Re: Feeds #1 - Topic #2', 'This is a test post posted by the testing framework.'); $crawler = self::request('GET', "viewtopic.php?t={$post2['topic_id']}&sid={$this->sid}"); -- cgit v1.2.1 From 7d8d8394fc36b1564ea083447329ab9f54a3db01 Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Fri, 25 Apr 2014 17:00:24 +0200 Subject: [ticket/12413] Fix: coding style PHPBB3-12413 --- phpBB/phpbb/feed/attachments_base.php | 19 +++++++++--------- phpBB/phpbb/feed/post_base.php | 37 ----------------------------------- tests/functional/feed_test.php | 16 +++++++-------- 3 files changed, 18 insertions(+), 54 deletions(-) diff --git a/phpBB/phpbb/feed/attachments_base.php b/phpBB/phpbb/feed/attachments_base.php index b8c72a7fb1..e61d637afa 100644 --- a/phpBB/phpbb/feed/attachments_base.php +++ b/phpBB/phpbb/feed/attachments_base.php @@ -26,8 +26,6 @@ abstract class attachments_base extends \phpbb\feed\base */ protected function fetch_attachments() { - global $db; - $sql_array = array( 'SELECT' => 'a.*', 'FROM' => array( @@ -39,7 +37,7 @@ abstract class attachments_base extends \phpbb\feed\base if (isset($this->topic_id)) { - $sql_array['WHERE'] .= 'AND a.topic_id = ' . (int)$this->topic_id; + $sql_array['WHERE'] .= 'AND a.topic_id = ' . (int) $this->topic_id; } else if (isset($this->forum_id)) { @@ -49,22 +47,25 @@ abstract class attachments_base extends \phpbb\feed\base 'ON' => 'a.topic_id = t.topic_id', ) ); - $sql_array['WHERE'] .= 'AND t.forum_id = ' . (int)$this->forum_id; + $sql_array['WHERE'] .= 'AND t.forum_id = ' . (int) $this->forum_id; } - $sql = $db->sql_build_query('SELECT', $sql_array); - $result = $db->sql_query($sql); + $sql = $this->db->sql_build_query('SELECT', $sql_array); + $result = $this->db->sql_query($sql); // Set attachments in feed items - while ($row = $db->sql_fetchrow($result)) + while ($row = $this->db->sql_fetchrow($result)) { $this->attachments[$row['post_msg_id']][] = $row; } - $db->sql_freeresult($result); + $this->db->sql_freeresult($result); } - + /** + * {@inheritDoc} + */ public function open() { + parent::open(); $this->fetch_attachments(); } diff --git a/phpBB/phpbb/feed/post_base.php b/phpBB/phpbb/feed/post_base.php index 57eb70ea12..de98f446f3 100644 --- a/phpBB/phpbb/feed/post_base.php +++ b/phpBB/phpbb/feed/post_base.php @@ -49,41 +49,4 @@ abstract class post_base extends \phpbb\feed\attachments_base . (($this->is_moderator_approve_forum($row['forum_id']) && $row['post_visibility'] !== ITEM_APPROVED) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POST_UNAPPROVED'] : ''); } } - - function fetch_attachments() - { - $sql_array = array( - 'SELECT' => 'a.*', - 'FROM' => array( - ATTACHMENTS_TABLE => 'a' - ), - 'WHERE' => 'a.in_message = 0 ', - 'ORDER_BY' => 'a.filetime DESC, a.post_msg_id ASC', - ); - - if (isset($this->topic_id)) - { - $sql_array['WHERE'] .= 'AND a.topic_id = ' . (int) $this->topic_id; - } - else if (isset($this->forum_id)) - { - $sql_array['LEFT_JOIN'] = array( - array( - 'FROM' => array(TOPICS_TABLE => 't'), - 'ON' => 'a.topic_id = t.topic_id', - ) - ); - $sql_array['WHERE'] .= 'AND t.forum_id = ' . (int) $this->forum_id; - } - - $sql = $this->db->sql_build_query('SELECT', $sql_array); - $result = $this->db->sql_query($sql); - - // Set attachments in feed items - while ($row = $this->db->sql_fetchrow($result)) - { - $this->attachments[$row['post_msg_id']][] = $row; - } - $this->db->sql_freeresult($result); - } } diff --git a/tests/functional/feed_test.php b/tests/functional/feed_test.php index 98a3bf2aa4..17847422b3 100644 --- a/tests/functional/feed_test.php +++ b/tests/functional/feed_test.php @@ -1,15 +1,15 @@ Date: Tue, 29 Apr 2014 23:27:43 +0200 Subject: [ticket/12413] Fix coding style PHPBB3-12413 --- phpBB/phpbb/feed/attachments_base.php | 1 + phpBB/phpbb/feed/forum.php | 4 ++-- phpBB/phpbb/feed/topic.php | 4 ++-- tests/functional/feed_test.php | 29 ++++++++++++++++++----------- 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/phpBB/phpbb/feed/attachments_base.php b/phpBB/phpbb/feed/attachments_base.php index e61d637afa..a9a8175928 100644 --- a/phpBB/phpbb/feed/attachments_base.php +++ b/phpBB/phpbb/feed/attachments_base.php @@ -60,6 +60,7 @@ abstract class attachments_base extends \phpbb\feed\base } $this->db->sql_freeresult($result); } + /** * {@inheritDoc} */ diff --git a/phpBB/phpbb/feed/forum.php b/phpBB/phpbb/feed/forum.php index 06e87ec21c..5699a2632c 100644 --- a/phpBB/phpbb/feed/forum.php +++ b/phpBB/phpbb/feed/forum.php @@ -37,6 +37,8 @@ class forum extends \phpbb\feed\post_base function open() { + parent::open(); + // Check if forum exists $sql = 'SELECT forum_id, forum_name, forum_password, forum_type, forum_options FROM ' . FORUMS_TABLE . ' @@ -80,8 +82,6 @@ class forum extends \phpbb\feed\post_base unset($forum_ids_passworded); } - - $this->fetch_attachments(); } function get_sql() diff --git a/phpBB/phpbb/feed/topic.php b/phpBB/phpbb/feed/topic.php index 3c2b3405f6..627ae1ffeb 100644 --- a/phpBB/phpbb/feed/topic.php +++ b/phpBB/phpbb/feed/topic.php @@ -37,6 +37,8 @@ class topic extends \phpbb\feed\post_base function open() { + parent::open(); + $sql = 'SELECT f.forum_options, f.forum_password, t.topic_id, t.forum_id, t.topic_visibility, t.topic_title, t.topic_time, t.topic_views, t.topic_posts_approved, t.topic_type FROM ' . TOPICS_TABLE . ' t LEFT JOIN ' . FORUMS_TABLE . ' f @@ -83,8 +85,6 @@ class topic extends \phpbb\feed\post_base unset($forum_ids_passworded); } - - $this->fetch_attachments(); } function get_sql() diff --git a/tests/functional/feed_test.php b/tests/functional/feed_test.php index 17847422b3..64f8f237d7 100644 --- a/tests/functional/feed_test.php +++ b/tests/functional/feed_test.php @@ -1195,9 +1195,9 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case )); } - // Disabled until PHPBB3-12418 is fixed and merged - /*public function test_create_missing_attachment_post() + public function test_create_missing_attachment_post() { + $this->markIncomplete('Missing attachments in posts/topics are not marked in feeds yet, see PHPBB3-12418'); $this->login(); $this->load_ids(array( 'forums' => array( @@ -1218,6 +1218,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_feeds_missing_attachment_admin() { + $this->markIncomplete('Missing attachments in posts/topics are not marked in feeds yet, see PHPBB3-12418'); $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -1294,7 +1295,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), ), ), 'admin'); - }*/ + } protected function assert_feeds($data, $username = false) { @@ -1338,7 +1339,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case case 'news': break; default: - $this->fail('Unsupported feed.'); + $this->fail('Unsupported feed mode: ' . $mode); } $params = "?mode={$mode}"; @@ -1352,19 +1353,22 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case { $crawler = self::request('GET', 'feed.php' . $params, array(), false); - if (!(isset($data['invalid']) && $data['invalid'])) + if (empty($data['invalid'])) { self::assert_response_xml(); $this->assertEquals($data['nb_entries'], $crawler->filter('entry')->count(), "Tested feed : 'feed.php{$params}'"); - if (sizeof($data['xpath'])) { + if (!empty($data['xpath'])) + { + foreach($data['xpath'] as $xpath => $count_expected) { $this->assertCount($count_expected, $crawler->filterXPath($xpath), "Tested feed : 'feed.php{$params}', Search for {$xpath}"); } } - if (sizeof($data['contents'])) { + if (!empty($data['contents'])) + { foreach($data['contents'] as $entry_id => $string) { $content = $crawler->filterXPath("//entry[{$entry_id}]/content")->text(); @@ -1372,7 +1376,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case } } - if (sizeof($data['contents_lang'])) { + if (!empty($data['contents_lang'])) + { foreach($data['contents_lang'] as $entry_id => $string) { $content = $crawler->filterXPath("//entry[{$entry_id}]/content")->text(); @@ -1380,7 +1385,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case } } - if (sizeof($data['attachments'])) { + if (!empty($data['attachments'])) + { foreach($data['attachments'] as $entry_id => $attachments) { foreach ($attachments as $i => $attachment) @@ -1408,10 +1414,11 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case { self::assert_response_html(); - if (sizeof($data['contents_lang'])) { + if (!empty($data['contents_lang'])) + { foreach($data['contents_lang'] as $string) { - $content = $crawler->filter("html")->text(); + $content = $crawler->filter('html')->text(); $this->assertContainsLang($string, $content, "Tested feed : 'feed.php{$params}'"); } } -- cgit v1.2.1 From ff2d26e7e8e9aa47fdbc40aada5bef3d5f07d034 Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Tue, 29 Apr 2014 23:48:08 +0200 Subject: [ticket/12413] Coding style again PHPBB3-12413 --- tests/functional/feed_test.php | 54 +++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/tests/functional/feed_test.php b/tests/functional/feed_test.php index 64f8f237d7..b50196fb18 100644 --- a/tests/functional/feed_test.php +++ b/tests/functional/feed_test.php @@ -16,7 +16,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case static public $init_values = array(); - public function __construct($name = NULL, array $data = array(), $dataName = '') + public function __construct($name = null, array $data = array(), $dataName = '') { parent::__construct($name, $data, $dataName); @@ -35,18 +35,18 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $form = $crawler->selectButton('Submit')->form(); $values = $form->getValues(); - self::$init_values['post_base_items'] = (int)$values['config[feed_limit_post]']; - self::$init_values['topic_base_items'] = (int)$values['config[feed_limit_topic]']; + self::$init_values['post_base_items'] = (int) $values['config[feed_limit_post]']; + self::$init_values['topic_base_items'] = (int) $values['config[feed_limit_topic]']; // Enable all feeds - $values["config[feed_enable]"] = true; - $values["config[feed_forum]"] = true; - $values["config[feed_item_statistics]"] = true; - $values["config[feed_overall]"] = true; - $values["config[feed_overall_forums]"] = true; - $values["config[feed_topic]"] = true; - $values["config[feed_topics_active]"] = true; - $values["config[feed_topics_new]"] = true; + $values['config[feed_enable]'] = true; + $values['config[feed_forum]'] = true; + $values['config[feed_item_statistics]'] = true; + $values['config[feed_overall]'] = true; + $values['config[feed_overall_forums]'] = true; + $values['config[feed_topic]'] = true; + $values['config[feed_topics_active]'] = true; + $values['config[feed_topics_new]'] = true; $form->setValues($values); @@ -60,7 +60,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $this->assertContains($this->lang('ACL_SET'), $crawler->filter('h1')->eq(1)->text()); $form = $crawler->selectButton($this->lang('APPLY_PERMISSIONS'))->form(); - $form["setting[1][0][u_download]"]->select(-1); + $form['setting[1][0][u_download]']->select(-1); $crawler = self::submit($form); $this->assertGreaterThan(0, $crawler->filter('.successbox')->count()); @@ -72,45 +72,45 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case { $crawler = self::request('GET', 'feed.php?mode=forums', array(), false); self::assert_response_xml(); - self::$init_values['disapprove_user']['forums_value'] = (int)$crawler->filterXPath("//entry")->count(); + self::$init_values['disapprove_user']['forums_value'] = (int)$crawler->filterXPath('//entry')->count(); $crawler = self::request('GET', 'feed.php?mode=overall', array(), false); self::assert_response_xml(); - self::$init_values['disapprove_user']['overall_value'] = $crawler->filterXPath("//entry")->count(); + self::$init_values['disapprove_user']['overall_value'] = $crawler->filterXPath('//entry')->count(); $crawler = self::request('GET', 'feed.php?mode=topics', array(), false); self::assert_response_xml(); - self::$init_values['disapprove_user']['topics_value'] = $crawler->filterXPath("//entry")->count(); + self::$init_values['disapprove_user']['topics_value'] = $crawler->filterXPath('//entry')->count(); $crawler = self::request('GET', 'feed.php?mode=topics_new', array(), false); self::assert_response_xml(); - self::$init_values['disapprove_user']['topics_new_value'] = $crawler->filterXPath("//entry")->count(); + self::$init_values['disapprove_user']['topics_new_value'] = $crawler->filterXPath('//entry')->count(); $crawler = self::request('GET', 'feed.php?mode=topics_active', array(), false); self::assert_response_xml(); - self::$init_values['disapprove_user']['topics_active_value'] = $crawler->filterXPath("//entry")->count(); + self::$init_values['disapprove_user']['topics_active_value'] = $crawler->filterXPath('//entry')->count(); $this->login(); $crawler = self::request('GET', 'feed.php?mode=forums', array(), false); self::assert_response_xml(); - self::$init_values['admin']['forums_value'] = (int)$crawler->filterXPath("//entry")->count(); + self::$init_values['admin']['forums_value'] = (int)$crawler->filterXPath('//entry')->count(); $crawler = self::request('GET', 'feed.php?mode=overall', array(), false); self::assert_response_xml(); - self::$init_values['admin']['overall_value'] = $crawler->filterXPath("//entry")->count(); + self::$init_values['admin']['overall_value'] = $crawler->filterXPath('//entry')->count(); $crawler = self::request('GET', 'feed.php?mode=topics', array(), false); self::assert_response_xml(); - self::$init_values['admin']['topics_value'] = $crawler->filterXPath("//entry")->count(); + self::$init_values['admin']['topics_value'] = $crawler->filterXPath('//entry')->count(); $crawler = self::request('GET', 'feed.php?mode=topics_new', array(), false); self::assert_response_xml(); - self::$init_values['admin']['topics_new_value'] = $crawler->filterXPath("//entry")->count(); + self::$init_values['admin']['topics_new_value'] = $crawler->filterXPath('//entry')->count(); $crawler = self::request('GET', 'feed.php?mode=topics_active', array(), false); self::assert_response_xml(); - self::$init_values['admin']['topics_active_value'] = $crawler->filterXPath("//entry")->count(); + self::$init_values['admin']['topics_active_value'] = $crawler->filterXPath('//entry')->count(); } @@ -119,7 +119,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case { $this->login(); $this->admin_login(); - $this->create_user("disapprove_user"); + $this->create_user('disapprove_user'); $this->add_user_group('NEWLY_REGISTERED', array('disapprove_user')); $crawler = self::request('GET', "adm/index.php?i=acp_forums&mode=manage&sid={$this->sid}"); @@ -765,7 +765,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $this->logout(); // Test creating a reply - $this->login("disapprove_user"); + $this->login('disapprove_user'); $post2 = $this->create_post($this->data['forums']['Feeds #1.1'], $post['topic_id'], 'Re: Feeds #1.1 - Topic #2', 'This is a test post posted by the testing framework.', array(), 'POST_STORED_MOD'); $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Feeds #1.1 - Topic #2']}&sid={$this->sid}"); @@ -858,7 +858,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case // We have to wait because of the flood interval. sleep(15); - $this->login("disapprove_user"); + $this->login('disapprove_user'); $post = $this->create_topic($this->data['forums']['Feeds #1.1'], 'Feeds #1.1 - Topic #3', 'This is a test topic posted by the testing framework.', array(), 'POST_STORED_MOD'); $this->data['topics']['Feeds #1 - Topic #3'] = (int) $post['topic_id']; $crawler = self::request('GET', "viewforum.php?f={$this->data['forums']['Feeds #1.1']}&sid={$this->sid}"); @@ -1197,7 +1197,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_create_missing_attachment_post() { - $this->markIncomplete('Missing attachments in posts/topics are not marked in feeds yet, see PHPBB3-12418'); + $this->markTestIncomplete('Missing attachments in posts/topics are not marked in feeds yet, see PHPBB3-12418'); $this->login(); $this->load_ids(array( 'forums' => array( @@ -1218,7 +1218,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_feeds_missing_attachment_admin() { - $this->markIncomplete('Missing attachments in posts/topics are not marked in feeds yet, see PHPBB3-12418'); + $this->markTestIncomplete('Missing attachments in posts/topics are not marked in feeds yet, see PHPBB3-12418'); $this->load_ids(array( 'forums' => array( 'Feeds #1', -- cgit v1.2.1 From 21e2f5c517040e872507c0f6d7e2c10c8a8f51b2 Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Tue, 29 Apr 2014 23:49:04 +0200 Subject: [ticket/12413] Move parent:open() call to the end of the function PHPBB3-12413 --- phpBB/phpbb/feed/forum.php | 4 ++-- phpBB/phpbb/feed/topic.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/phpbb/feed/forum.php b/phpBB/phpbb/feed/forum.php index 5699a2632c..8e6490923d 100644 --- a/phpBB/phpbb/feed/forum.php +++ b/phpBB/phpbb/feed/forum.php @@ -37,8 +37,6 @@ class forum extends \phpbb\feed\post_base function open() { - parent::open(); - // Check if forum exists $sql = 'SELECT forum_id, forum_name, forum_password, forum_type, forum_options FROM ' . FORUMS_TABLE . ' @@ -82,6 +80,8 @@ class forum extends \phpbb\feed\post_base unset($forum_ids_passworded); } + + parent::open(); } function get_sql() diff --git a/phpBB/phpbb/feed/topic.php b/phpBB/phpbb/feed/topic.php index 627ae1ffeb..fb49aa65cc 100644 --- a/phpBB/phpbb/feed/topic.php +++ b/phpBB/phpbb/feed/topic.php @@ -37,8 +37,6 @@ class topic extends \phpbb\feed\post_base function open() { - parent::open(); - $sql = 'SELECT f.forum_options, f.forum_password, t.topic_id, t.forum_id, t.topic_visibility, t.topic_title, t.topic_time, t.topic_views, t.topic_posts_approved, t.topic_type FROM ' . TOPICS_TABLE . ' t LEFT JOIN ' . FORUMS_TABLE . ' f @@ -85,6 +83,8 @@ class topic extends \phpbb\feed\post_base unset($forum_ids_passworded); } + + parent::open(); } function get_sql() -- cgit v1.2.1 From dcadc04b182cb820cfa9bdddee3bc8661c817c4b Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Wed, 30 Apr 2014 00:14:28 +0200 Subject: [ticket/12413] Disabled unapproved and solftdeleted tests PHPBB3-12413 --- tests/functional/feed_test.php | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/tests/functional/feed_test.php b/tests/functional/feed_test.php index b50196fb18..32a25fd390 100644 --- a/tests/functional/feed_test.php +++ b/tests/functional/feed_test.php @@ -482,6 +482,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_create_softdelete_post() { + $this->markTestIncomplete('Softdeleted posts/topics are not marked in feeds yet, see PHPBB3-12460'); $this->login(); $this->load_ids(array( 'forums' => array( @@ -505,6 +506,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_softdelete_post() { + $this->markTestIncomplete('Softdeleted posts/topics are not marked in feeds yet, see PHPBB3-12460'); $this->login(); $this->load_ids(array( 'forums' => array( @@ -532,6 +534,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_feeds_softdeleted_post_admin() { + $this->markTestIncomplete('Softdeleted posts/topics are not marked in feeds yet, see PHPBB3-12460'); $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -574,6 +577,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_feeds_softdeleted_post_guest() { + $this->markTestIncomplete('Softdeleted posts/topics are not marked in feeds yet, see PHPBB3-12460'); $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -607,6 +611,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_softdelete_topic() { + $this->markTestIncomplete('Softdeleted posts/topics are not marked in feeds yet, see PHPBB3-12460'); $this->login(); $this->load_ids(array( 'forums' => array( @@ -636,6 +641,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_feeds_softdeleted_topic_admin() { + $this->markTestIncomplete('Softdeleted posts/topics are not marked in feeds yet, see PHPBB3-12460'); $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -705,6 +711,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_feeds_softdeleted_topic_guest() { + $this->markTestIncomplete('Softdeleted posts/topics are not marked in feeds yet, see PHPBB3-12460'); $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -753,6 +760,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_create_unapproved_post() { + $this->markTestIncomplete('Unapproved posts/topics are not marked in feeds yet, see PHPBB3-12459'); $this->load_ids(array( 'forums' => array( 'Feeds #1.1', @@ -774,6 +782,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_feeds_unapproved_post_admin() { + $this->markTestIncomplete('Unapproved posts/topics are not marked in feeds yet, see PHPBB3-12459'); $this->load_ids(array( 'forums' => array( 'Feeds #1.1', @@ -816,6 +825,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_feeds_unapproved_post_disapprove_user() { + $this->markTestIncomplete('Unapproved posts/topics are not marked in feeds yet, see PHPBB3-12459'); $this->load_ids(array( 'forums' => array( 'Feeds #1.1', @@ -849,6 +859,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_create_unapproved_topic() { + $this->markTestIncomplete('Unapproved posts/topics are not marked in feeds yet, see PHPBB3-12459'); $this->load_ids(array( 'forums' => array( 'Feeds #1.1', @@ -868,6 +879,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_feeds_unapproved_topic_admin() { + $this->markTestIncomplete('Unapproved posts/topics are not marked in feeds yet, see PHPBB3-12459'); $this->load_ids(array( 'forums' => array( 'Feeds #1.1', @@ -934,6 +946,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_feeds_unapproved_topic_disapprove_user() { + $this->markTestIncomplete('Unapproved posts/topics are not marked in feeds yet, see PHPBB3-12459'); $this->load_ids(array( 'forums' => array( 'Feeds #1.1', @@ -1015,7 +1028,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $this->assert_feeds(array( 'f' => array( array( - 'nb_entries' => 4, + 'nb_entries' => 2, 'id' => $this->data['forums']['Feeds #1'], 'attachments' => array( 1 => array( // First entry @@ -1043,7 +1056,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'overall' => array( array( - 'nb_entries' => 11, + 'nb_entries' => 6, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1056,7 +1069,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics' => array( array( - 'nb_entries' => 8, + 'nb_entries' => 5, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1069,7 +1082,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_new' => array( array( - 'nb_entries' => 8, + 'nb_entries' => 5, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1082,7 +1095,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_active' => array( array( - 'nb_entries' => 8, + 'nb_entries' => 5, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1142,7 +1155,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'overall' => array( array( - 'nb_entries' => 7, + 'nb_entries' => 6, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1155,7 +1168,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics' => array( array( - 'nb_entries' => 6, + 'nb_entries' => 5, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1168,7 +1181,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_new' => array( array( - 'nb_entries' => 6, + 'nb_entries' => 5, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1181,7 +1194,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_active' => array( array( - 'nb_entries' => 6, + 'nb_entries' => 5, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch -- cgit v1.2.1 From 87fe1e613639e7bcb0549024f31565acc3426143 Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Wed, 30 Apr 2014 00:50:11 +0200 Subject: [ticket/12413] Remove unnecessary casts PHPBB3-12413 --- tests/functional/feed_test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/functional/feed_test.php b/tests/functional/feed_test.php index 32a25fd390..97ba848b4f 100644 --- a/tests/functional/feed_test.php +++ b/tests/functional/feed_test.php @@ -72,7 +72,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case { $crawler = self::request('GET', 'feed.php?mode=forums', array(), false); self::assert_response_xml(); - self::$init_values['disapprove_user']['forums_value'] = (int)$crawler->filterXPath('//entry')->count(); + self::$init_values['disapprove_user']['forums_value'] = $crawler->filterXPath('//entry')->count(); $crawler = self::request('GET', 'feed.php?mode=overall', array(), false); self::assert_response_xml(); @@ -94,7 +94,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $crawler = self::request('GET', 'feed.php?mode=forums', array(), false); self::assert_response_xml(); - self::$init_values['admin']['forums_value'] = (int)$crawler->filterXPath('//entry')->count(); + self::$init_values['admin']['forums_value'] = $crawler->filterXPath('//entry')->count(); $crawler = self::request('GET', 'feed.php?mode=overall', array(), false); self::assert_response_xml(); -- cgit v1.2.1 From 2bc4c0e39fcf48bb6e52588a62d9c2e883353880 Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Wed, 30 Apr 2014 01:02:11 +0200 Subject: [ticket/12413] Update init PHPBB3-12413 --- tests/functional/feed_test.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/functional/feed_test.php b/tests/functional/feed_test.php index 97ba848b4f..bc494d6f05 100644 --- a/tests/functional/feed_test.php +++ b/tests/functional/feed_test.php @@ -63,9 +63,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $form['setting[1][0][u_download]']->select(-1); $crawler = self::submit($form); - $this->assertGreaterThan(0, $crawler->filter('.successbox')->count()); - - + $this->assertContainsLang('AUTH_UPDATED', $crawler->filter('.successbox')->text()); } public function test_dump_board_state() -- cgit v1.2.1 From 8812cfcfbf4ae82eb0270c268d227ba729b42107 Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Fri, 2 May 2014 13:24:38 +0200 Subject: [ticket/12413] Update configuration's asserts PHPBB3-12413 --- tests/functional/feed_test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/functional/feed_test.php b/tests/functional/feed_test.php index bc494d6f05..fbcbfa3943 100644 --- a/tests/functional/feed_test.php +++ b/tests/functional/feed_test.php @@ -51,7 +51,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $form->setValues($values); $crawler = self::submit($form); - $this->assertGreaterThan(0, $crawler->filter('.successbox')->count()); + $this->assertContainsLang('CONFIG_UPDATED', $crawler->filter('.successbox')->text()); // Special config (Guest can't see attachments) $this->add_lang('acp/permissions'); @@ -191,7 +191,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $form['feed_exclude_id']->select(array($this->data['forums']['Feeds #exclude'])); $crawler = self::submit($form); - $this->assertGreaterThan(0, $crawler->filter('.successbox')->count()); + $this->assertContainsLang('CONFIG_UPDATED', $crawler->filter('.successbox')->text()); } public function test_feeds_empty() -- cgit v1.2.1