Completed
Push — master ( d0850c...8e7bd8 )
by Maurício
07:52
created

TransformationOverviewControllerTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 36
dl 0
loc 62
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testIndexAction() 0 41 1
A setUp() 0 9 1
1
<?php
2
/* vim: set expandtab sw=4 ts=4 sts=4: */
3
/**
4
 * Holds TransformationOverviewControllerTest class
5
 *
6
 * @package PhpMyAdmin-test
7
 */
8
declare(strict_types=1);
9
10
namespace PhpMyAdmin\Tests\Controllers;
11
12
use PhpMyAdmin\Config;
13
use PhpMyAdmin\Controllers\TransformationOverviewController;
14
use PhpMyAdmin\Response;
15
use PhpMyAdmin\Transformations;
16
use PHPUnit\Framework\TestCase;
17
18
/**
19
 * Tests for TransformationOverviewController class
20
 *
21
 * @package PhpMyAdmin-test
22
 */
23
class TransformationOverviewControllerTest extends TestCase
24
{
25
    /**
26
     * Prepares environment for the test.
27
     *
28
     * @return void
29
     */
30
    protected function setUp(): void
31
    {
32
        $GLOBALS['PMA_Config'] = new Config();
33
        $GLOBALS['PMA_Config']->enableBc();
34
35
        $GLOBALS['server'] = 1;
36
        $GLOBALS['db'] = 'db';
37
        $GLOBALS['table'] = 'table';
38
        $GLOBALS['PMA_PHP_SELF'] = 'index.php';
39
    }
40
41
    /**
42
     * @return void
43
     */
44
    public function testIndexAction(): void
45
    {
46
        $controller = new TransformationOverviewController(
47
            Response::getInstance(),
48
            $GLOBALS['dbi'],
49
            new Transformations()
50
        );
51
52
        $actual = $controller->indexAction();
53
54
        $this->assertContains(
55
            __('Available MIME types'),
56
            $actual
57
        );
58
        $this->assertContains(
59
            'id="transformation">' . __('Available browser display transformations'),
60
            $actual
61
        );
62
        $this->assertContains(
63
            'id="input_transformation">' . __('Available input transformations'),
64
            $actual
65
        );
66
        $this->assertContains(
67
            'Text/Plain',
68
            $actual
69
        );
70
        $this->assertContains(
71
            'Image/JPEG: Inline',
72
            $actual
73
        );
74
        $this->assertContains(
75
            'Displays a clickable thumbnail.',
76
            $actual
77
        );
78
        $this->assertContains(
79
            'Image/JPEG: Upload',
80
            $actual
81
        );
82
        $this->assertContains(
83
            'Image upload functionality which also displays a thumbnail.',
84
            $actual
85
        );
86
    }
87
}
88