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

SyntaxHighlighterDefaultsTest::testToString()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 28
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 23
nc 1
nop 0
dl 0
loc 28
rs 8.8571
c 0
b 0
f 0
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\SyntaxHighlighterDefaults;
16
17
/**
18
 * SyntaxHighlighter defaults test.
19
 *
20
 * @author webeweb <https://github.com/webeweb/>
21
 * @package WBW\Bundle\SyntaxHighlighterBundle\Tests\API
22
 * @final
23
 */
24
final class SyntaxHighlighterDefaultsTest extends PHPUnit_Framework_TestCase {
25
26
    /**
27
     * Tests the __construct() method.
28
     *
29
     * @return void
30
     */
31
    public function testConstruct() {
32
33
        $obj = new SyntaxHighlighterDefaults();
34
35
        $this->assertEquals(true, $obj->getAutoLinks());
36
        $this->assertEquals("", $obj->getClassName());
37
        $this->assertEquals(false, $obj->getCollapse());
38
        $this->assertEquals(1, $obj->getFirstLine());
39
        $this->assertEquals(true, $obj->getGutter());
40
        $this->assertEquals(null, $obj->getHighlight());
41
        $this->assertEquals(false, $obj->getHtmlScript());
42
        $this->assertEquals(true, $obj->getSmartTabs());
43
        $this->assertEquals(4, $obj->getTabSize());
44
        $this->assertEquals(true, $obj->getToolbar());
45
    }
46
47
    /**
48
     * Tests the __toString() method.
49
     *
50
     * @return void
51
     */
52
    public function testToString() {
53
54
        $obj = new SyntaxHighlighterDefaults();
55
56
        $obj->setAutoLinks(false);
57
        $obj->setClassName("classname");
58
        $obj->setCollapse(true);
59
        $obj->setFirstLine(0);
60
        $obj->setGutter(false);
61
        $obj->setHighlight([1, 2, 3]);
62
        $obj->setHtmlScript(true);
63
        $obj->setSmartTabs(false);
64
        $obj->setTabSize(8);
65
        $obj->setToolbar(false);
66
67
        $res    = [];
68
        $res [] = "SyntaxHighlighter.defaults['auto-links'] = false;";
69
        $res [] = "SyntaxHighlighter.defaults['class-name'] = \"classname\";";
70
        $res [] = "SyntaxHighlighter.defaults['collapse'] = true;";
71
        $res [] = "SyntaxHighlighter.defaults['first-line'] = 0;";
72
        $res [] = "SyntaxHighlighter.defaults['gutter'] = false;";
73
        $res [] = "SyntaxHighlighter.defaults['highlight'] = [1, 2, 3];";
74
        $res [] = "SyntaxHighlighter.defaults['html-script'] = true;";
75
        $res [] = "SyntaxHighlighter.defaults['smart-tabs'] = false;";
76
        $res [] = "SyntaxHighlighter.defaults['tab-size'] = 8;";
77
        $res [] = "SyntaxHighlighter.defaults['toolbar'] = false;";
78
79
        $this->assertEquals(implode("\n", $res), (string) $obj);
80
    }
81
82
}
83