Total Complexity | 4 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | class MarkdownFileParserTest extends TestCase |
||
11 | { |
||
12 | protected function setUp(): void |
||
13 | { |
||
14 | parent::setUp(); |
||
15 | |||
16 | file_put_contents(Hyde::path('_posts/test-post.md'), '--- |
||
17 | title: My New Post |
||
18 | category: blog |
||
19 | author: Mr. Hyde |
||
20 | --- |
||
21 | |||
22 | # My New Post |
||
23 | |||
24 | This is a post stub used in the automated tests |
||
25 | '); |
||
26 | } |
||
27 | |||
28 | protected function tearDown(): void |
||
29 | { |
||
30 | unlink(Hyde::path('_posts/test-post.md')); |
||
31 | |||
32 | parent::tearDown(); |
||
33 | } |
||
34 | |||
35 | public function test_can_parse_markdown_file() |
||
36 | { |
||
37 | $document = (new MarkdownFileParser(Hyde::path('_posts/test-post.md')))->get(); |
||
38 | $this->assertInstanceOf(MarkdownDocument::class, $document); |
||
39 | |||
40 | $this->assertEquals([ |
||
41 | 'title' => 'My New Post', |
||
42 | 'category' => 'blog', |
||
43 | 'author' => 'Mr. Hyde', |
||
44 | ], $document->matter); |
||
45 | |||
46 | $this->assertEquals( |
||
47 | '# My New PostThis is a post stub used in the automated tests', |
||
48 | str_replace(["\n", "\r"], '', $document->body) |
||
49 | ); |
||
50 | } |
||
51 | |||
52 | public function test_parsed_markdown_post_contains_valid_front_matter() |
||
58 | } |
||
59 | } |
||
60 |