Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
14 / 14
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
phpbb_console_searchindex_list_all_test
100.00% covered (success)
100.00%
14 / 14
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 get_command_tester
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
1 / 1
1
 test_list
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
1
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
14use phpbb\console\command\searchindex\list_all;
15use Symfony\Component\Console\Application;
16use Symfony\Component\Console\Command\Command;
17use Symfony\Component\Console\Tester\CommandTester;
18
19require_once __DIR__ . '/phpbb_console_searchindex_base.php';
20require_once __DIR__ . '/../../mock/search_backend_mock.php';
21
22class phpbb_console_searchindex_list_all_test extends phpbb_console_searchindex_base
23{
24    public function get_command_tester()
25    {
26        $application = new Application();
27        $application->add(new list_all(
28            $this->config,
29            $this->language,
30            $this->search_backend_collection,
31            $this->user
32        ));
33
34        $command = $application->find('searchindex:list');
35
36        return new CommandTester($command);
37    }
38
39    public function test_list()
40    {
41        $command_tester = $this->get_command_tester();
42
43        $command_tester->execute([]);
44
45        $this->assertEquals(Command::SUCCESS, $command_tester->getStatusCode());
46        $this->assertStringContainsString('Mock search backend', $command_tester->getDisplay());
47        $this->assertStringContainsString('ACTIVE', $command_tester->getDisplay());
48    }
49}