Completed
Push — master ( 0c48af...84ef19 )
by Johannes
02:34
created

MarkdownDocumentTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 6
lcom 1
cbo 2
dl 0
loc 37
rs 10
c 1
b 0
f 1
1
<?php
2
/**
3
 * Lichtenwallner  (https://lichtenwallner.at)
4
 *
5
 * @see https://github.com/jolicht/markdown-cms for the canonical source repository
6
 * @license https://github.com/jolicht/markdown-cms/blob/master/LICENSE MIT
7
 * @copyright Copyright (c) Johannes Lichtenwallner
8
 */
9
declare(strict_types = 1);
10
namespace JolichtTest\MarkdownCms\Markdown;
11
12
use PHPUnit\Framework\TestCase;
13
use Jolicht\MarkdownCms\Markdown\MarkdownDocument;
14
15
class MarkdownDocumentTest extends TestCase
16
{
17
    private $document, $params;
18
19
    protected function setUp()
20
    {
21
        $this->params = [
22
            'id' => 'testId'
23
        ];
24
        $this->document = new MarkdownDocument($this->params, 'testContent');
25
    }
26
27
    public function testGetParams()
28
    {
29
        $this->assertSame($this->params, $this->document->getParams());
30
    }
31
32
    public function testGetContent()
33
    {
34
        $this->assertSame('testContent', $this->document->getContent());
35
    }
36
37
    public function testGetParam()
38
    {
39
        $this->assertSame('testId', $this->document->getParam('id'));
40
    }
41
42
    public function testGetParamNotExistingReturnsNull()
43
    {
44
        $this->assertNull($this->document->getParam('not-existing'));
45
    }
46
47
    public function testGetParamNotExistingReturnsGivenDefaultValue()
48
    {
49
        $this->assertSame('defaultValue', $this->document->getParam('not-existing', 'defaultValue'));
50
    }
51
}