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

PMA_config_functions_test.php « libraries « test - github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 07d830879d3529037ae7e7de6e84a2a353070433 (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
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * Tests for Config Functions
 *
 * @package PhpMyAdmin-test
 */

/*
 * Include to test.
 */
require_once 'libraries/config/config_functions.lib.php';
require_once 'libraries/sanitizing.lib.php';

/**
 * Tests for Config Functions
 *
 * @package PhpMyAdmin-test
 */
class PMA_Config_Functions_Test extends PHPUnit_Framework_TestCase
{
    /**
     * Test for PMA_lang
     *
     * @return void
     * @test
     */
    public function testPMALang()
    {
        $this->assertEquals(
            "&lt;a attr='value'&gt;test&lt;/a&gt;",
            PMA_lang("<a attr='value'>test</a>")
        );

        $GLOBALS["strConfiglangKeyFooBar"] = "<a attr='value'>[em]test[/em]</a>";

        $this->assertEquals(
            "&lt;a attr='value'&gt;<em>test</em>&lt;/a&gt;",
            PMA_lang("langKeyFooBar")
        );

        $this->assertEquals(
            "1988-08-01",
            PMA_lang("%04d-%02d-%02d", "1988", "8", "1")
        );
    }

    /**
     * Test for PMA_langName
     *
     * @return void
     * @test
     */
    public function testLangName()
    {
        $canonicalPath = "Servers/1/2test";

        $this->assertEquals(
            "Servers_2test_name",
            PMA_langName($canonicalPath)
        );

        $this->assertEquals(
            "returnsDefault",
            PMA_langName($canonicalPath, "name", "returnsDefault")
        );

        $GLOBALS["strConfigServers_2test_name"] = "<a>msg</a>";

        $this->assertEquals(
            "<a>msg</a>",
            PMA_langName($canonicalPath)
        );

        $GLOBALS["strConfigServers_2test_desc"] = "<a>msg</a>";

        $this->assertEquals(
            "&lt;a&gt;msg&lt;/a&gt;",
            PMA_langName($canonicalPath, "desc")
        );

    }

}