Completed
Push — master ( 9b9083...4534a2 )
by Johannes
02:11
created

BlogEntryTest::testGetCreated()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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;
0 ignored issues
show
Coding Style introduced by
It is generally advisable to only define one property per statement.

Only declaring a single property per statement allows you to later on add doc comments more easily.

It is also recommended by PSR2, so it is a common style that many people expect.

Loading history...
19
20
    protected function setUp()
21
    {
22
        $this->content = 'testExcerpt' . PHP_EOL . BlogEntry::MORE_SEPARATOR . PHP_EOL . 'testExtend' . PHP_EOL;
23
24
        $this->created = new \DateTime();
25
        $this->updated = new \DateTime();
26
        $this->blogEntry = new BlogEntry('test-id', 'TestTitle', $this->content, $this->created, $this->updated, true);
27
    }
28
    public function testGetId()
29
    {
30
        $this->assertSame('test-id', $this->blogEntry->getId());
31
    }
32
33
    public function testGetTitle()
34
    {
35
        $this->assertSame('TestTitle', $this->blogEntry->getTitle());
36
    }
37
38
    public function testGetContent()
39
    {
40
        $this->assertSame($this->content, $this->blogEntry->getContent());
41
    }
42
43
    public function testGetExcerpt()
44
    {
45
        $this->assertSame('testExcerpt', $this->blogEntry->getExcerpt());
46
    }
47
48
    public function testGetExtend()
49
    {
50
        $this->assertSame('testExtend', $this->blogEntry->getExtend());
51
    }
52
53
    public function testGetCreated()
54
    {
55
        $this->assertSame($this->created, $this->blogEntry->getCreated());
56
    }
57
58
    public function testGetUpdated()
59
    {
60
        $this->assertSame($this->updated, $this->blogEntry->getUpdated());
61
    }
62
63
    public function testIsDraft()
64
    {
65
        $this->assertTrue($this->blogEntry->isDraft());
66
    }
67
68
    public function testGetTags()
69
    {
70
        $this->assertSame([], $this->blogEntry->getTags());
71
    }
72
73
    public function testAddTag()
74
    {
75
        $tag = new Tag('testId', 'testTitle');
76
        $this->blogEntry->addTag($tag);
77
        $this->assertSame([$tag], $this->blogEntry->getTags());
78
    }
79
}