Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 18
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
phpbb_functional_mcp_quickmod_tools_test
0.00% covered (danger)
0.00%
0 / 18
0.00% covered (danger)
0.00%
0 / 3
12
0.00% covered (danger)
0.00%
0 / 1
 test_post_new_topic
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
2
 test_handle_quickmod
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 test_move_post_to_topic
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3*
4* This file is part of the phpBB Forum Software package.
5*
6* @copyright (c) phpBB Limited <https://www.phpbb.com>
7* @license GNU General Public License, version 2 (GPL-2.0)
8*
9* For full copyright and license information, please see
10* the docs/CREDITS.txt file.
11*
12*/
13
14/**
15* @group functional
16*/
17class phpbb_functional_mcp_quickmod_tools_test extends phpbb_functional_test_case
18{
19    public function test_post_new_topic()
20    {
21        $this->login();
22
23        // Test creating topic
24        $post = $this->create_topic(2, 'Test Topic 2', 'Testing move post with "Move posts" option from Quick-Moderator Tools.');
25
26        $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}");
27        $this->assertStringContainsString('Testing move post with "Move posts" option from Quick-Moderator Tools.', $crawler->filter('html')->text());
28
29        return $crawler;
30    }
31
32    /**
33     * @depends test_post_new_topic
34     */
35    public function test_handle_quickmod($crawler)
36    {
37        $this->login();
38
39        // Test moving a post
40        return $this->get_quickmod_page(0, 'MERGE_POSTS', $crawler);
41    }
42
43    /**
44     * @depends test_handle_quickmod
45     */
46    public function test_move_post_to_topic($crawler)
47    {
48        $this->login();
49        $this->add_lang(['common', 'mcp']);
50
51        // Select the post in MCP
52        $form = $crawler->selectButton($this->lang('SUBMIT'))->form(array(
53            'to_topic_id'    => 1,
54        ));
55        $form['post_id_list'][0]->tick();
56        $crawler = self::submit($form);
57        $this->assertStringContainsString($this->lang('MERGE_POSTS_CONFIRM'), $crawler->filter('html')->text());
58
59        $form = $crawler->selectButton($this->lang('YES'))->form();
60        $crawler = self::submit($form);
61        $this->assertStringContainsString($this->lang('POSTS_MERGED_SUCCESS'), $crawler->text());
62    }
63}