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\Page; |
14
|
|
|
|
15
|
|
|
class PageTest extends TestCase |
16
|
|
|
{ |
17
|
|
|
private $page, $created, $updated; |
|
|
|
|
18
|
|
|
|
19
|
|
|
protected function setUp() |
20
|
|
|
{ |
21
|
|
|
$this->created = new \DateTime(); |
22
|
|
|
$this->updated = new \DateTime(); |
23
|
|
|
$this->page = new Page('test-id', 'TestTitle', $this->created, $this->updated, true); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
public function testGetId() |
27
|
|
|
{ |
28
|
|
|
$this->assertSame('test-id', $this->page->getId()); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function testGetTitle() |
32
|
|
|
{ |
33
|
|
|
$this->assertSame('TestTitle', $this->page->getTitle()); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function testGetCreated() |
37
|
|
|
{ |
38
|
|
|
$this->assertSame($this->created, $this->page->getCreated()); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public function testGetUpdated() |
42
|
|
|
{ |
43
|
|
|
$this->assertSame($this->updated, $this->page->getUpdated()); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function testIsDraft() |
47
|
|
|
{ |
48
|
|
|
$this->assertTrue($this->page->isDraft()); |
49
|
|
|
} |
50
|
|
|
} |
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.