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

BlogEntryTest   A

Complexity

Total Complexity 13

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 13
lcom 1
cbo 3
dl 0
loc 73
rs 10
c 2
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\ContentType;
11
12
use PHPUnit\Framework\TestCase;
13
use Jolicht\MarkdownCms\ContentType\BlogEntry;
14
use Jolicht\MarkdownCms\Taxonomy\Tag;
15
16
class BlogEntryTest extends TestCase
17
{
18
    private $blogEntry, $created, $updated, $content;
19
20
    protected function setUp()
21
    {
22
        $this->created = new \DateTime();
23
        $this->updated = new \DateTime();
24
        $this->blogEntry = new BlogEntry('test-id', 'TestTitle', 'testContent', $this->created, $this->updated, true,
25
            'testTemplate', 'testExcerpt', 'testExtend');
26
    }
27
    public function testGetId()
28
    {
29
        $this->assertSame('test-id', $this->blogEntry->getId());
30
    }
31
32
    public function testGetTitle()
33
    {
34
        $this->assertSame('TestTitle', $this->blogEntry->getTitle());
35
    }
36
37
    public function testGetContent()
38
    {
39
        $this->assertSame('testContent', $this->blogEntry->getContent());
40
    }
41
42
    public function testGetExcerpt()
43
    {
44
        $this->assertSame('testExcerpt', $this->blogEntry->getExcerpt());
45
    }
46
47
    public function testGetExtend()
48
    {
49
        $this->assertSame('testExtend', $this->blogEntry->getExtend());
50
    }
51
52
    public function testGetCreated()
53
    {
54
        $this->assertSame($this->created, $this->blogEntry->getCreated());
55
    }
56
57
    public function testGetUpdated()
58
    {
59
        $this->assertSame($this->updated, $this->blogEntry->getUpdated());
60
    }
61
62
    public function testIsDraft()
63
    {
64
        $this->assertTrue($this->blogEntry->isDraft());
65
    }
66
67
    public function testGetTemplate()
68
    {
69
        $this->assertSame('testTemplate', $this->blogEntry->getTemplate());
70
    }
71
72
    public function testGetTags()
73
    {
74
        $this->assertSame([], $this->blogEntry->getTags());
75
    }
76
77
    public function testAddTag()
78
    {
79
        $tag = new Tag('testId', 'testTitle');
80
        $this->blogEntry->addTag($tag);
81
        $this->assertSame([$tag], $this->blogEntry->getTags());
82
    }
83
84
    public function testGetType()
85
    {
86
        $this->assertSame('blogEntry', $this->blogEntry->getType());
87
    }
88
}