Completed
Pull Request — master (#14)
by Simon
01:56
created

LogFormatterTest::testEntryToUl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 13
nc 1
nop 0
1
<?php
2
3
namespace SilverLeague\LogViewer\Tests\Helper;
4
5
use SilverLeague\LogViewer\Deprecated\DeprecatedLogFormatter;
6
use SilverLeague\LogViewer\Helper\LogFormatter;
7
use SilverLeague\LogViewer\Model\LogEntry;
8
use SilverStripe\Core\Convert;
9
use SilverStripe\Dev\SapphireTest;
10
11
/**
12
 * @author Simon Erkelens <[email protected]>
13
 */
14
class LogFormatterTest extends SapphireTest
15
{
16
17
    /**
18
     * Test if the entrty is formatted nicely
19
     */
20
    public function testEntryToUl()
21
    {
22
        $entry = array(
23
            'Message'  => 'Something went wrong',
24
            'DateTime' => '2016-01-22 03:14:23'
25
        );
26
        $result = LogFormatter::entryToUl($entry);
27
        $expectedString = '<span style="color: #007700">[</span>'.
28
            '<ul style="margin-bottom: 0"><li class="list-unstyled">'.
29
            '<span style="color: #0000BB">Message</span><span style="color: #007700">: </span>'.
30
            '<span style="color: #DD0000">Something went wrong</span></li>'.
31
            '<li class="list-unstyled"><span style="color: #0000BB">DateTime</span>'.
32
            '<span style="color: #007700">: </span><span style="color: #DD0000">2016-01-22 03:14:23</span></li>'.
33
            '</ul><span style="color: #007700">]</span>';
34
35
        $this->assertEquals($expectedString, $result);
36
    }
37
38
}