Passed
Push — master ( 0838e7...46b6ee )
by Caen
04:34 queued 14s
created

IntegrationTest::test404()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
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