Passed
Push — master ( 5cb097...45deef )
by Caen
03:43 queued 14s
created

DefaultContentTest::assertFileContainsString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Hyde\Testing;
6
7
use Hyde\Hyde;
8
9
class DefaultContentTest extends UnitTestCase
0 ignored issues
show
Bug introduced by
The type Hyde\Testing\UnitTestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
{
11
    public static function setUpBeforeClass(): void
12
    {
13
        self::needsKernel();
14
    }
15
16
    public function testDefaultPagesArePresent()
17
    {
18
        $this->assertFileExists(Hyde::path('_pages/index.blade.php'));
0 ignored issues
show
Bug introduced by
The method path() does not exist on Hyde\Hyde. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

18
        $this->assertFileExists(Hyde::/** @scrutinizer ignore-call */ path('_pages/index.blade.php'));
Loading history...
19
        $this->assertFileExists(Hyde::path('_pages/404.blade.php'));
20
21
        $this->assertStringContainsString(
22
            '<title>Welcome to HydePHP!</title>',
23
            file_get_contents(Hyde::path('_pages/index.blade.php'))
24
        );
25
26
        $this->assertStringContainsString(
27
            '<title>404 - Page not found</title>',
28
            file_get_contents(Hyde::path('_pages/404.blade.php'))
29
        );
30
    }
31
32
    public function testDefaultCompiledStylesheetIsPresent()
33
    {
34
        $this->assertFileExists(Hyde::path('_media/app.css'));
35
36
        $this->assertStringContainsString(
37
            'https://tailwindcss.com',
38
            file_get_contents(Hyde::path('_media/app.css'))
39
        );
40
    }
41
42
    public function testLaravelMixResourcesArePresent()
43
    {
44
        $this->assertFileExists(Hyde::path('resources/assets/app.css'));
45
        $this->assertFileExists(Hyde::path('resources/assets/app.js'));
46
47
        $this->assertFileContainsString('@tailwind base;', Hyde::path('resources/assets/app.css'));
48
        $this->assertFileContainsString('@tailwind components;', Hyde::path('resources/assets/app.css'));
49
        $this->assertFileContainsString('@tailwind utilities;', Hyde::path('resources/assets/app.css'));
50
51
        $this->assertFileContainsString('This is the main JavaScript', Hyde::path('resources/assets/app.js'));
52
    }
53
54
    protected function assertFileContainsString(string $string, string $file)
55
    {
56
        $this->assertStringContainsString($string, file_get_contents($file));
57
    }
58
}
59