From 80b4a7f33726280f523ee84f11f11e852ef71db7 Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Tue, 29 Apr 2014 23:27:43 +0200 Subject: [PATCH] [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}'"); } }