diff options
Diffstat (limited to 'tests/functional')
-rw-r--r-- | tests/functional/extension_acp_test.php | 4 | ||||
-rw-r--r-- | tests/functional/feed_test.php | 52 | ||||
-rw-r--r-- | tests/functional/ucp_allow_pm_test.php | 70 | ||||
-rw-r--r-- | tests/functional/visibility_softdelete_test.php | 2 |
4 files changed, 91 insertions, 37 deletions
diff --git a/tests/functional/extension_acp_test.php b/tests/functional/extension_acp_test.php index 5f02158e20..8a724f2133 100644 --- a/tests/functional/extension_acp_test.php +++ b/tests/functional/extension_acp_test.php @@ -157,7 +157,7 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case $this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('div.main thead')->text()); $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid); - $this->assertContains($this->lang('EXTENSION_ENABLE_CONFIRM', 'phpBB Moo Extension'), $crawler->filter('.errorbox')->text()); + $this->assertContains($this->lang('EXTENSION_ENABLE_CONFIRM', 'phpBB Moo Extension'), $crawler->filter('#main')->text()); } public function test_disable_pre() @@ -169,7 +169,7 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case $this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('div.main thead')->text()); $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable_pre&ext_name=vendor2%2Ffoo&sid=' . $this->sid); - $this->assertContains($this->lang('EXTENSION_DISABLE_CONFIRM', 'phpBB Foo Extension'), $crawler->filter('.errorbox')->text()); + $this->assertContains($this->lang('EXTENSION_DISABLE_CONFIRM', 'phpBB Foo Extension'), $crawler->filter('#main')->text()); } public function test_delete_data_pre() diff --git a/tests/functional/feed_test.php b/tests/functional/feed_test.php index fbcbfa3943..86d3930a7b 100644 --- a/tests/functional/feed_test.php +++ b/tests/functional/feed_test.php @@ -480,7 +480,6 @@ 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( @@ -504,7 +503,6 @@ 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,7 +530,6 @@ 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', @@ -575,7 +572,6 @@ 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', @@ -609,7 +605,6 @@ 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( @@ -639,7 +634,6 @@ 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', @@ -709,7 +703,6 @@ 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', @@ -758,7 +751,6 @@ 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', @@ -780,7 +772,6 @@ 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', @@ -823,7 +814,6 @@ 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', @@ -857,7 +847,6 @@ 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', @@ -877,7 +866,6 @@ 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', @@ -944,7 +932,6 @@ 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', @@ -1026,7 +1013,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $this->assert_feeds(array( 'f' => array( array( - 'nb_entries' => 2, + 'nb_entries' => 4, 'id' => $this->data['forums']['Feeds #1'], 'attachments' => array( 1 => array( // First entry @@ -1054,7 +1041,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'overall' => array( array( - 'nb_entries' => 6, + 'nb_entries' => 11, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1067,7 +1054,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics' => array( array( - 'nb_entries' => 5, + 'nb_entries' => 8, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1080,7 +1067,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_new' => array( array( - 'nb_entries' => 5, + 'nb_entries' => 8, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1093,7 +1080,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_active' => array( array( - 'nb_entries' => 5, + 'nb_entries' => 8, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1153,7 +1140,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'overall' => array( array( - 'nb_entries' => 6, + 'nb_entries' => 7, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1166,7 +1153,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics' => array( array( - 'nb_entries' => 5, + 'nb_entries' => 6, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1179,7 +1166,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_new' => array( array( - 'nb_entries' => 5, + 'nb_entries' => 6, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1192,7 +1179,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_active' => array( array( - 'nb_entries' => 5, + 'nb_entries' => 6, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1208,7 +1195,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_create_missing_attachment_post() { - $this->markTestIncomplete('Missing attachments in posts/topics are not marked in feeds yet, see PHPBB3-12418'); $this->login(); $this->load_ids(array( 'forums' => array( @@ -1229,7 +1215,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_feeds_missing_attachment_admin() { - $this->markTestIncomplete('Missing attachments in posts/topics are not marked in feeds yet, see PHPBB3-12418'); $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -1265,7 +1250,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'overall' => array( array( - 'nb_entries' => 13, + 'nb_entries' => 12, 'contents' => array( 1 => 'Attachment #0', ), @@ -1273,12 +1258,12 @@ 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 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], - 'displayed' => false, + 'displayed' => true, ), ), ), @@ -1286,12 +1271,12 @@ 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 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], - 'displayed' => false, + 'displayed' => true, ), ), ), @@ -1299,7 +1284,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_active' => array( array( - 'nb_entries' => 9, + 'nb_entries' => 8, 'contents' => array( 1 => 'Attachment #0', ), @@ -1409,13 +1394,12 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case if ($attachment['displayed']) { $this->assertContains($url, $content, "Tested feed : 'feed.php{$params}'"); - // $this->assertNotContains($string, $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}'"); + $this->assertContains($string, $content, "Tested feed : 'feed.php{$params}'"); + $this->assertNotContains($url, $content, "Tested feed : 'feed.php{$params}'"); } } } diff --git a/tests/functional/ucp_allow_pm_test.php b/tests/functional/ucp_allow_pm_test.php new file mode 100644 index 0000000000..b433ec8e75 --- /dev/null +++ b/tests/functional/ucp_allow_pm_test.php @@ -0,0 +1,70 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2014 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @group functional +*/ +class phpbb_functional_ucp_allow_pm_test extends phpbb_functional_test_case +{ + static protected $data = array(); + + public function __construct() + { + parent::__construct(); + + $this->backupStaticAttributesBlacklist += array( + 'phpbb_functional_ucp_allow_pm_test' => array('data'), + ); + } + + // user A sends a PM to user B where B accepts PM + public function test_enabled_pm_user_to_user() + { + // setup + $this->create_user('test_ucp_allow_pm_sender'); + $this->login('test_ucp_allow_pm_sender'); + self::$data['recipient_id'] = $this->create_user('test_ucp_allow_pm_recipient'); + self::$data['pm_url'] = "ucp.php?i=pm&mode=compose&u=" . (int) self::$data['recipient_id'] . "&sid={$this->sid}"; + + // the actual test + $this->set_user_allow_pm(self::$data['recipient_id'], 1); + $crawler = self::request('GET', self::$data['pm_url']); + $this->assertNotContainsLang('PM_USERS_REMOVED_NO_PM', $crawler->filter('html')->text()); + } + + // user A sends a PM to user B where B does not accept PM + public function test_disabled_pm_user_to_user() + { + $this->login('test_ucp_allow_pm_sender'); + $this->set_user_allow_pm(self::$data['recipient_id'], 0); + $crawler = self::request('GET', self::$data['pm_url']); + $this->assertContainsLang('PM_USERS_REMOVED_NO_PM', $crawler->filter('.error')->text()); + } + + + // An admin sends a PM to user B where B does not accept PM, but cannot + // ignore a PM from an admin + public function test_disabled_pm_admin_to_user() + { + $this->login(); + $crawler = self::request('GET', self::$data['pm_url']); + $this->assertNotContainsLang('PM_USERS_REMOVED_NO_PM', $crawler->filter('html')->text()); + } + + // enable or disable PM for a user, like from ucp + protected function set_user_allow_pm($user_id, $allow) + { + $db = $this->get_db(); + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_allow_pm = " . $allow . " + WHERE user_id = " . $user_id; + $result = $db->sql_query($sql); + $db->sql_freeresult($result); + } +} diff --git a/tests/functional/visibility_softdelete_test.php b/tests/functional/visibility_softdelete_test.php index f8ada9687c..3d44476ff0 100644 --- a/tests/functional/visibility_softdelete_test.php +++ b/tests/functional/visibility_softdelete_test.php @@ -608,7 +608,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_ $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); $this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text()); - $this->assertContainsLang('POST_DELETED', $crawler->filter('body')->text()); + $this->assertContainsLang('POST_DELETED_ACTION', $crawler->filter('body')->text()); $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( 'forum_posts_approved' => 1, |