From b7fb2e557e9d35cc292f38fc7dddfc2920068eb0 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 6 Jul 2014 00:00:58 +0200 Subject: [PATCH 1/4] [ticket/12818] Fix the conditions in the call to $log->delete() in mcp_logs PHPBB3-12818 --- phpBB/includes/mcp/mcp_logs.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/mcp/mcp_logs.php b/phpBB/includes/mcp/mcp_logs.php index 2945e1ec8a..92dcdb5499 100644 --- a/phpBB/includes/mcp/mcp_logs.php +++ b/phpBB/includes/mcp/mcp_logs.php @@ -115,7 +115,7 @@ class mcp_logs if ($deletemark && sizeof($marked)) { $conditions = array( - 'forum_id' => $forum_list, + 'forum_id' => array('IN' => $forum_list), 'log_id' => array('IN' => $marked), ); @@ -126,7 +126,7 @@ class mcp_logs $keywords = utf8_normalize_nfc(request_var('keywords', '', true)); $conditions = array( - 'forum_id' => $forum_list, + 'forum_id' => array('IN' => $forum_list), 'keywords' => $keywords, ); From 14e9c7695d113422ef7d49f11933fa935c74b979 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 7 Jul 2014 21:49:48 +0200 Subject: [PATCH 2/4] [ticket/12818] Add tests PHPBB3-12818 --- tests/functional/mcp_test.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/functional/mcp_test.php b/tests/functional/mcp_test.php index 31d835f4fa..5cccc5c180 100644 --- a/tests/functional/mcp_test.php +++ b/tests/functional/mcp_test.php @@ -64,4 +64,20 @@ class phpbb_functional_mcp_test extends phpbb_functional_test_case $crawler = self::submit($form); $this->assertContains($this->lang('POSTS_MERGED_SUCCESS'), $crawler->text()); } + + public function test_delete_logs() + { + $this->login(); + $crawler = self::request('GET', "mcp.php?i=149&sid={$this->sid}"); + $this->assertCount(1, $crawler->filter('input[type=checkbox]')); + + $this->add_lang('mcp'); + $form = $crawler->selectButton($this->lang('DELETE_ALL'))->form(); + $crawler = self::submit($form); + + $form = $crawler->selectButton('Yes')->form(); + $crawler = self::submit($form); + + $this->assertCount(0, $crawler->filter('input[type=checkbox]')); + } } From de1da3170cf814f3a45c6594dc3ca4f908d35a5e Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 7 Jul 2014 22:13:42 +0200 Subject: [PATCH 3/4] [ticket/12818] Don't use the id for i= PHPBB3-12818 --- tests/functional/mcp_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/mcp_test.php b/tests/functional/mcp_test.php index 5cccc5c180..67bb8ea24a 100644 --- a/tests/functional/mcp_test.php +++ b/tests/functional/mcp_test.php @@ -68,7 +68,7 @@ class phpbb_functional_mcp_test extends phpbb_functional_test_case public function test_delete_logs() { $this->login(); - $crawler = self::request('GET', "mcp.php?i=149&sid={$this->sid}"); + $crawler = self::request('GET', "mcp.php?i=mcp_logs&mode=front&sid={$this->sid}"); $this->assertCount(1, $crawler->filter('input[type=checkbox]')); $this->add_lang('mcp'); From 8de8cbab5e8c0beb4ee621a8527fd989e608e497 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Wed, 9 Jul 2014 00:12:57 +0200 Subject: [PATCH 4/4] [ticket/12818] Use assertGreaterThanOrEqual in the tests PHPBB3-12818 --- tests/functional/mcp_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/mcp_test.php b/tests/functional/mcp_test.php index 67bb8ea24a..40615d66a5 100644 --- a/tests/functional/mcp_test.php +++ b/tests/functional/mcp_test.php @@ -69,7 +69,7 @@ class phpbb_functional_mcp_test extends phpbb_functional_test_case { $this->login(); $crawler = self::request('GET', "mcp.php?i=mcp_logs&mode=front&sid={$this->sid}"); - $this->assertCount(1, $crawler->filter('input[type=checkbox]')); + $this->assertGreaterThanOrEqual(1, $crawler->filter('input[type=checkbox]')->count()); $this->add_lang('mcp'); $form = $crawler->selectButton($this->lang('DELETE_ALL'))->form();