|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Hyde\RealtimeCompiler\Tests\Integration; |
|
4
|
|
|
|
|
5
|
|
|
class IntegrationTest extends IntegrationTestCase |
|
6
|
|
|
{ |
|
7
|
|
|
public function testWelcome() |
|
8
|
|
|
{ |
|
9
|
|
|
$this->get('/') |
|
10
|
|
|
->assertStatus(200) |
|
11
|
|
|
->assertSeeText("You're running on HydePHP"); |
|
12
|
|
|
} |
|
13
|
|
|
|
|
14
|
|
|
public function test404() |
|
15
|
|
|
{ |
|
16
|
|
|
$this->get('/non-existent-page') |
|
17
|
|
|
->assertStatus(404) |
|
18
|
|
|
->assertSeeText('RouteNotFoundException') |
|
19
|
|
|
->assertSeeText('Route [non-existent-page] not found.'); |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
public function testDynamicDocumentationSearchPages() |
|
23
|
|
|
{ |
|
24
|
|
|
file_put_contents($this->projectPath('_docs/index.md'), '# Documentation'); |
|
25
|
|
|
file_put_contents($this->projectPath('_docs/installation.md'), '# Installation'); |
|
26
|
|
|
|
|
27
|
|
|
$this->get('/docs/search') |
|
28
|
|
|
->assertStatus(200) |
|
29
|
|
|
->assertSeeText('Search the documentation site'); |
|
30
|
|
|
|
|
31
|
|
|
$this->get('/docs/search.json') |
|
32
|
|
|
->assertStatus(200) |
|
33
|
|
|
->assertHeader('Content-Type', 'application/json') |
|
34
|
|
|
->assertJson([ |
|
35
|
|
|
[ |
|
36
|
|
|
'slug' => 'index', |
|
37
|
|
|
'title' => 'Documentation', |
|
38
|
|
|
'content' => 'Documentation', |
|
39
|
|
|
'destination' => 'index.html', |
|
40
|
|
|
], |
|
41
|
|
|
[ |
|
42
|
|
|
'slug' => 'installation', |
|
43
|
|
|
'title' => 'Installation', |
|
44
|
|
|
'content' => 'Installation', |
|
45
|
|
|
'destination' => 'installation.html', |
|
46
|
|
|
], |
|
47
|
|
|
]); |
|
48
|
|
|
|
|
49
|
|
|
unlink($this->projectPath('_docs/index.md')); |
|
50
|
|
|
unlink($this->projectPath('_docs/installation.md')); |
|
51
|
|
|
} |
|
52
|
|
|
} |
|
53
|
|
|
|