@@ 16-29 (lines=14) @@ | ||
13 | $this->shouldHaveType(YamlFrontMatter::class); |
|
14 | } |
|
15 | ||
16 | public function it_can_parse_valid_front_matter() |
|
17 | { |
|
18 | $contents = " |
|
19 | --- |
|
20 | foo: bar |
|
21 | --- |
|
22 | ||
23 | Lorem ipsum. |
|
24 | "; |
|
25 | ||
26 | $this->parse($contents)->shouldHaveType(Document::class); |
|
27 | $this->parse($contents)->shouldHaveFrontMatter(['foo' => 'bar']); |
|
28 | $this->parse($contents)->shouldHaveBodyContaining('Lorem ipsum.'); |
|
29 | } |
|
30 | ||
31 | public function it_falls_back_to_empty_front_matter_with_the_original_as_body() |
|
32 | { |
|
@@ 31-45 (lines=15) @@ | ||
28 | $this->parse($contents)->shouldHaveBodyContaining('Lorem ipsum.'); |
|
29 | } |
|
30 | ||
31 | public function it_falls_back_to_empty_front_matter_with_the_original_as_body() |
|
32 | { |
|
33 | $contents = " |
|
34 | --- |
|
35 | foo: bar |
|
36 | -- |
|
37 | ||
38 | Lorem ipsum. |
|
39 | "; |
|
40 | ||
41 | $this->parse($contents)->shouldHaveType(Document::class); |
|
42 | $this->parse($contents)->shouldHaveFrontMatter([]); |
|
43 | $this->parse($contents)->shouldHaveBodyContaining('foo: bar'); |
|
44 | $this->parse($contents)->shouldHaveBodyContaining('Lorem ipsum.'); |
|
45 | } |
|
46 | ||
47 | public function getMatchers() : array |
|
48 | { |