|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Hyde\Testing\Hyde; |
|
6
|
|
|
|
|
7
|
|
|
use Hyde\Hyde; |
|
8
|
|
|
use Hyde\Testing\UnitTestCase; |
|
9
|
|
|
|
|
10
|
|
|
class DefaultContentTest extends UnitTestCase |
|
11
|
|
|
{ |
|
12
|
|
|
public static function setUpBeforeClass(): void |
|
13
|
|
|
{ |
|
14
|
|
|
self::needsKernel(); |
|
15
|
|
|
} |
|
16
|
|
|
|
|
17
|
|
|
public function testDefaultPagesArePresent() |
|
18
|
|
|
{ |
|
19
|
|
|
$this->assertFileExists(Hyde::path('_pages/index.blade.php')); |
|
20
|
|
|
$this->assertFileExists(Hyde::path('_pages/404.blade.php')); |
|
21
|
|
|
|
|
22
|
|
|
$this->assertStringContainsString( |
|
23
|
|
|
'<title>Welcome to HydePHP!</title>', |
|
24
|
|
|
file_get_contents(Hyde::path('_pages/index.blade.php')) |
|
25
|
|
|
); |
|
26
|
|
|
|
|
27
|
|
|
$this->assertStringContainsString( |
|
28
|
|
|
'<title>404 - Page not found</title>', |
|
29
|
|
|
file_get_contents(Hyde::path('_pages/404.blade.php')) |
|
30
|
|
|
); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
public function testDefaultCompiledStylesheetIsPresent() |
|
34
|
|
|
{ |
|
35
|
|
|
$this->assertFileExists(Hyde::path('_media/app.css')); |
|
36
|
|
|
|
|
37
|
|
|
$this->assertStringContainsString( |
|
38
|
|
|
'https://tailwindcss.com', |
|
39
|
|
|
file_get_contents(Hyde::path('_media/app.css')) |
|
40
|
|
|
); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function testLaravelMixResourcesArePresent() |
|
44
|
|
|
{ |
|
45
|
|
|
$this->assertFileExists(Hyde::path('resources/assets/app.css')); |
|
46
|
|
|
$this->assertFileExists(Hyde::path('resources/assets/app.js')); |
|
47
|
|
|
|
|
48
|
|
|
$this->assertFileContainsString('@tailwind base;', Hyde::path('resources/assets/app.css')); |
|
49
|
|
|
$this->assertFileContainsString('@tailwind components;', Hyde::path('resources/assets/app.css')); |
|
50
|
|
|
$this->assertFileContainsString('@tailwind utilities;', Hyde::path('resources/assets/app.css')); |
|
51
|
|
|
|
|
52
|
|
|
$this->assertFileContainsString('This is the main JavaScript', Hyde::path('resources/assets/app.js')); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
protected function assertFileContainsString(string $string, string $file) |
|
56
|
|
|
{ |
|
57
|
|
|
$this->assertStringContainsString($string, file_get_contents($file)); |
|
58
|
|
|
} |
|
59
|
|
|
} |
|
60
|
|
|
|