Passed
Push — master ( 9f6375...4086bc )
by WEBEWEB
06:28
created

SyntaxHighlighterConfigTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 51
rs 10
c 0
b 0
f 0
wmc 2
1
<?php
2
3
/**
4
 * This file is part of the syntaxhighligter-bundle package.
5
 *
6
 * (c) 2017 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Bundle\SyntaxHighlighterBundle\Tests\API;
13
14
use PHPUnit_Framework_TestCase;
15
use WBW\Bundle\SyntaxHighlighterBundle\API\SyntaxHighlighterConfig;
16
use WBW\Bundle\SyntaxHighlighterBundle\API\SyntaxHighlighterStrings;
17
18
/**
19
 * SyntaxHighlighter config test.
20
 *
21
 * @author webeweb <https://github.com/webeweb/>
22
 * @package WBW\Bundle\SyntaxHighlighterBundle\Tests\API
23
 * @final
24
 */
25
final class SyntaxHighlighterConfigTest extends PHPUnit_Framework_TestCase {
26
27
    /**
28
     * Tests the __construct() method.
29
     *
30
     * @return void
31
     */
32
    public function testConstruct() {
33
34
        $obj = new SyntaxHighlighterConfig();
35
36
        $this->assertEquals(false, $obj->getBloggerMode());
37
        $this->assertEquals(null, $obj->getStrings());
38
        $this->assertEquals(false, $obj->getStripBrs());
39
        $this->assertEquals("pre", $obj->getTagName());
40
    }
41
42
    /**
43
     * Tests the __toString() method.
44
     *
45
     * @return void
46
     */
47
    public function testToString() {
48
49
        $obj = new SyntaxHighlighterConfig();
50
51
        $obj->setBloggerMode(true);
52
        $obj->setStripBrs(true);
53
        $obj->setTagName("blocquote");
54
55
        $res    = [];
56
        $res [] = "SyntaxHighlighter.config.bloggerMode = true;";
57
        $res [] = "SyntaxHighlighter.config.stripBrs = true;";
58
        $res [] = "SyntaxHighlighter.config.tagName = \"blocquote\";";
59
60
        $this->assertEquals(implode("\n", $res), (string) $obj);
61
62
        $obj->setStrings(new SyntaxHighlighterStrings());
63
64
        $res1   = $res;
65
        $res1[] = "SyntaxHighlighter.config.strings.alert = \"SyntaxHighlighter\n\n\";";
66
        $res1[] = "SyntaxHighlighter.config.strings.brushNotHtmlScript = \"Brush wasn't made for html-script option:\";";
67
        $res1[] = "SyntaxHighlighter.config.strings.copyToClipboard = \"copy to clipboard\";";
68
        $res1[] = "SyntaxHighlighter.config.strings.copyToClipboardConfirmation = \"The code is in your clipboard now\";";
69
        $res1[] = "SyntaxHighlighter.config.strings.expandSource = \"+ expand source\";";
70
        $res1[] = "SyntaxHighlighter.config.strings.help = \"?\";";
71
        $res1[] = "SyntaxHighlighter.config.strings.noBrush = \"Can't find brush for:\";";
72
        $res1[] = "SyntaxHighlighter.config.strings.print = \"print\";";
73
        $res1[] = "SyntaxHighlighter.config.strings.viewSource = \"view source\";";
74
75
        $this->assertEquals(implode("\n", $res1), (string) $obj);
76
    }
77
78
}
79