1 | <?php |
||
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 | } |