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

SyntaxHighlighterStringsTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 53
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\SyntaxHighlighterStrings;
16
17
/**
18
 * SyntaxHightlighter strings test.
19
 *
20
 * @author webeweb <https://github.com/webeweb/>
21
 * @package WBW\Bundle\SyntaxHighlighterBundle\Tests\API
22
 * @final
23
 */
24
final class SyntaxHighlighterStringsTest extends PHPUnit_Framework_TestCase {
25
26
    /**
27
     * Tests the __construct() method.
28
     *
29
     * @return void
30
     */
31
    public function testConstruct() {
32
33
        $obj = new SyntaxHighlighterStrings();
34
35
        $this->assertEquals("SyntaxHighlighter\n\n", $obj->getAlert());
36
        $this->assertEquals("Brush wasn't made for html-script option:", $obj->getBrushNotHtmlScript());
37
        $this->assertEquals("copy to clipboard", $obj->getCopyToClipboard());
38
        $this->assertEquals("The code is in your clipboard now", $obj->getCopyToClipboardConfirmation());
39
        $this->assertEquals("+ expand source", $obj->getExpandSource());
40
        $this->assertEquals("?", $obj->getHelp());
41
        $this->assertEquals("Can't find brush for:", $obj->getNoBrush());
42
        $this->assertEquals("print", $obj->getPrint());
43
        $this->assertEquals("view source", $obj->getViewSource());
44
    }
45
46
    /**
47
     * Tests the __toString() method.
48
     *
49
     * @return void
50
     */
51
    public function testToString() {
52
53
        $obj = new SyntaxHighlighterStrings();
54
55
        $obj->setAlert("SyntaxHighlighter bundle");
56
        $obj->setBrushNotHtmlScript("Brush wasn't made for HTML-Script option :");
57
        $obj->setCopyToClipboard("Copy to clipboard");
58
        $obj->setCopyToClipboardConfirmation("Operation success");
59
        $obj->setExpandSource("Expand source");
60
        $obj->setHelp("Help");
61
        $obj->setNoBrush("Can't find brush for :");
62
        $obj->setPrint("Print");
63
        $obj->setViewSource("View source");
64
65
        $res   = [];
66
        $res[] = "SyntaxHighlighter.config.strings.alert = \"SyntaxHighlighter bundle\";";
67
        $res[] = "SyntaxHighlighter.config.strings.brushNotHtmlScript = \"Brush wasn't made for HTML-Script option :\";";
68
        $res[] = "SyntaxHighlighter.config.strings.copyToClipboard = \"Copy to clipboard\";";
69
        $res[] = "SyntaxHighlighter.config.strings.copyToClipboardConfirmation = \"Operation success\";";
70
        $res[] = "SyntaxHighlighter.config.strings.expandSource = \"Expand source\";";
71
        $res[] = "SyntaxHighlighter.config.strings.help = \"Help\";";
72
        $res[] = "SyntaxHighlighter.config.strings.noBrush = \"Can't find brush for :\";";
73
        $res[] = "SyntaxHighlighter.config.strings.print = \"Print\";";
74
        $res[] = "SyntaxHighlighter.config.strings.viewSource = \"View source\";";
75
76
        $this->assertEquals(implode("\n", $res), (string) $obj);
77
    }
78
79
}
80