Passed
Push — master ( 84641f...5a8f0a )
by Caen
03:37
created

test_laravel_mix_resources_are_present()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 10
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Hyde\Testing\Hyde\Feature;
6
7
use Hyde\Hyde;
8
use Hyde\Testing\TestCase;
9
10
class DefaultContentTest extends TestCase
11
{
12
    public function test_default_pages_are_present()
13
    {
14
        $this->assertFileExists(Hyde::path('_pages/index.blade.php'));
15
        $this->assertFileExists(Hyde::path('_pages/404.blade.php'));
16
17
        $this->assertStringContainsString(
18
            '<title>Welcome to HydePHP!</title>',
19
            file_get_contents(Hyde::path('_pages/index.blade.php'))
20
        );
21
22
        $this->assertStringContainsString(
23
            '<title>404 - Page not found</title>',
24
            file_get_contents(Hyde::path('_pages/404.blade.php'))
25
        );
26
    }
27
28
    public function test_default_compiled_stylesheet_is_present()
29
    {
30
        $this->assertFileExists(Hyde::path('_media/app.css'));
31
32
        $this->assertStringContainsString(
33
            'https://tailwindcss.com',
34
            file_get_contents(Hyde::path('_media/app.css'))
35
        );
36
    }
37
38
    public function test_laravel_mix_resources_are_present()
39
    {
40
        $this->assertFileExists(Hyde::path('resources/assets/app.css'));
41
        $this->assertFileExists(Hyde::path('resources/assets/app.js'));
42
43
        $this->assertFileContainsString('@tailwind base;', Hyde::path('resources/assets/app.css'));
44
        $this->assertFileContainsString('@tailwind components;', Hyde::path('resources/assets/app.css'));
45
        $this->assertFileContainsString('@tailwind utilities;', Hyde::path('resources/assets/app.css'));
46
47
        $this->assertFileContainsString('This is the main JavaScript', Hyde::path('resources/assets/app.js'));
48
    }
49
50
    protected function assertFileContainsString(string $string, string $file)
51
    {
52
        $this->assertStringContainsString($string, file_get_contents($file));
53
    }
54
}
55