1 | <?php |
||
8 | class Post extends atoum |
||
9 | { |
||
10 | public function testConstruct() |
||
11 | { |
||
12 | $post = new BasePost(self::getLoremIpsumFilepath(), 'a', '2016-01-01'); |
||
13 | } |
||
14 | |||
15 | public function testConstructBadFilepath() |
||
16 | { |
||
17 | $this |
||
18 | ->exception( |
||
19 | function () { |
||
20 | $border = new BasePost('random', 'a', 'b'); |
||
21 | } |
||
22 | )->hasMessage('random is not a file'); |
||
23 | } |
||
24 | |||
25 | public function testGetHtml() |
||
26 | { |
||
27 | $post = new BasePost(self::getShortFilepath(), 'a', '2016-01-01'); |
||
28 | |||
29 | $this |
||
30 | ->string($post->getHtml()) |
||
31 | ->isEqualTo('<p>Short file</p>'); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @return string |
||
36 | */ |
||
37 | public static function getLoremIpsumFilepath() |
||
38 | { |
||
39 | return __DIR__.'/../../data/lorem-ipsum.md'; |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * @return string |
||
44 | */ |
||
45 | public static function getShortFilepath() |
||
46 | { |
||
47 | return __DIR__.'/../../data/short-file.md'; |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @param int $count |
||
52 | * |
||
53 | * @return Post[] |
||
54 | */ |
||
55 | public static function buildPostMocks($count) |
||
56 | { |
||
57 | $result = []; |
||
58 | for ($i = 1; $i <= $count; ++$i) { |
||
59 | $name = 'a'.$i; |
||
60 | |||
61 | $result[$name] = new \mock\Matks\MarkdownBlogBundle\Blog\Post( |
||
62 | static::getLoremIpsumFilepath(), |
||
63 | $name, |
||
64 | 'b' |
||
65 | ); |
||
66 | } |
||
67 | |||
68 | return $result; |
||
69 | } |
||
70 | } |
||
71 |