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

IntegrationTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
eloc 27
dl 0
loc 46
rs 10
c 4
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testWelcome() 0 5 1
A testDynamicDocumentationSearchPages() 0 29 1
A test404() 0 6 1
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