Passed
Branch master (1e39e8)
by Caen
03:01
created

PageModelGetAllFilesHelperTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 23
dl 0
loc 44
rs 10
c 0
b 0
f 0
wmc 4
1
<?php
2
3
namespace Hyde\Framework\Testing\Unit;
4
5
use Hyde\Framework\Hyde;
6
use Hyde\Framework\Models\Pages\BladePage;
7
use Hyde\Framework\Models\Pages\DocumentationPage;
8
use Hyde\Framework\Models\Pages\MarkdownPage;
9
use Hyde\Framework\Models\Pages\MarkdownPost;
10
use Hyde\Testing\TestCase;
11
12
/**
13
 * @see \Hyde\Framework\Concerns\AbstractPage::files()
14
 */
15
class PageModelGetAllFilesHelperTest extends TestCase
16
{
17
    public function test_blade_page_get_helper_returns_blade_page_array()
18
    {
19
        $array = BladePage::files();
20
        $this->assertCount(2, $array);
21
        $this->assertIsArray($array);
22
        $this->assertEquals(['404', 'index'], $array);
23
    }
24
25
    public function test_markdown_page_get_helper_returns_markdown_page_array()
26
    {
27
        Hyde::touch(('_pages/test-page.md'));
28
29
        $array = MarkdownPage::files();
30
        $this->assertCount(1, $array);
31
        $this->assertIsArray($array);
32
        $this->assertEquals(['test-page'], $array);
33
34
        unlink(Hyde::path('_pages/test-page.md'));
35
    }
36
37
    public function test_markdown_post_get_helper_returns_markdown_post_array()
38
    {
39
        Hyde::touch(('_posts/test-post.md'));
40
41
        $array = MarkdownPost::files();
42
        $this->assertCount(1, $array);
43
        $this->assertIsArray($array);
44
        $this->assertEquals(['test-post'], $array);
45
46
        unlink(Hyde::path('_posts/test-post.md'));
47
    }
48
49
    public function test_documentation_page_get_helper_returns_documentation_page_array()
50
    {
51
        Hyde::touch(('_docs/test-page.md'));
52
53
        $array = DocumentationPage::files();
54
        $this->assertCount(1, $array);
55
        $this->assertIsArray($array);
56
        $this->assertEquals(['test-page'], $array);
57
58
        unlink(Hyde::path('_docs/test-page.md'));
59
    }
60
}
61