Welcome to mirror list, hosted at ThFree Co, Russian Federation.

CreateTableTest.php « Display « classes « test - github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f962a376d84b8c745d35d05b7c855d58a31db6b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
/**
 * tests for PhpMyAdmin\Display\CreateTable
 *
 * @package PhpMyAdmin-test
 */
declare(strict_types=1);

namespace PhpMyAdmin\Tests\Display;

use PhpMyAdmin\Display\CreateTable;
use PhpMyAdmin\Html\Generator;
use PhpMyAdmin\Theme;
use PhpMyAdmin\Url;
use PhpMyAdmin\Util;
use PHPUnit\Framework\TestCase;

/**
 * PhpMyAdmin\Tests\Display\CreateTableTest class
 *
 * this class is for testing PhpMyAdmin\Display\CreateTable methods
 *
 * @package PhpMyAdmin-test
 */
class CreateTableTest extends TestCase
{
    /**
     * Test for setUp
     *
     * @return void
     */
    protected function setUp(): void
    {
        //$GLOBALS
        $GLOBALS['server'] = 0;
        $GLOBALS['cfg']['Server']['DisableIS'] = false;
        $GLOBALS['cfg']['DBG']['sql'] = false;
        $GLOBALS['cfg']['MaxRows'] = 10;
        $GLOBALS['cfg']['ServerDefault'] = 'PMA_server';
        $GLOBALS['cfg']['TableNavigationLinksMode'] = 'icons';
        $GLOBALS['cfg']['LimitChars'] = 100;
        $GLOBALS['cfg']['ActionLinksMode'] = 'icons';
        $GLOBALS['cfg']['Server']['host'] = 'localhost';
        $GLOBALS['cfg']['Server']['user'] = 'pma_user';
        $GLOBALS['cfg']['ShowHint'] = true;
        $GLOBALS['cfg']['ActionLinksMode'] = 'icons';
        $GLOBALS['PMA_PHP_SELF'] = Url::getFromRoute('/server/privileges');

        //$_SESSION
        $_SESSION['relation'][$GLOBALS['server']] = 'relation';
    }

    /**
     * Test for CreateTable::getHtml
     *
     * @return void
     */
    public function testPMAGetHtmlForCreateTable()
    {
        $db = 'pma_db';

        //Call the test function
        $html = CreateTable::getHtml($db);

        //getImage
        $this->assertStringContainsString(
            Generator::getImage('b_table_add'),
            $html
        );

        //__('Create table')
        $this->assertStringContainsString(
            __('Create table'),
            $html
        );

        //Url::getHiddenInputs
        $this->assertStringContainsString(
            Url::getHiddenInputs($db),
            $html
        );
        //label
        $this->assertStringContainsString(
            __('Name'),
            $html
        );
        $this->assertStringContainsString(
            __('Number of columns'),
            $html
        );

        //button
        $this->assertStringContainsString(
            __('Go'),
            $html
        );
    }
}