Repository navigation
Expand file tree
/
Copy pathBasicPagesTest.php
More file actions
92 lines (74 loc) · 2.39 KB
/
Copy pathBasicPagesTest.php
File metadata and controls
92 lines (74 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
declare(strict_types=1);
use App\Libraries\GitHub;
use CodeIgniter\Test\DatabaseTestTrait;
use CodeIgniter\Test\FeatureTestTrait;
use Config\Services;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Psr7\Request;
use Tests\Support\ProjectTestCase;
/**
* @internal
*/
final class BasicPagesTest extends ProjectTestCase
{
use DatabaseTestTrait;
use FeatureTestTrait;
public function testCanViewHome()
{
$result = $this->get('/');
$result->assertStatus(200);
$result->assertSee('The small framework with powerful features');
}
public function testCanViewHomeWhenConnectException()
{
$github = $this->getMockBuilder(GitHub::class)
->disableOriginalConstructor()
->disableOriginalClone()
->onlyMethods(['getRepos'])
->getMock();
$github->method('getRepos')->willThrowException(
new ConnectException(
'cURL error 6: Could not resolve host: api.github.com (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://api.github.com/repos/bcit-ci/CodeIgniter',
new Request(
'GET',
'https://api.github.com/repos/bcit-ci/CodeIgniter',
),
),
);
Services::injectMock('github', $github);
$result = $this->get('/');
$result->assertStatus(200);
$result->assertSee('The small framework with powerful features');
}
public function testCanViewDiscuss()
{
$result = $this->get('/discuss');
$result->assertStatus(200);
$result->assertSee('Security issues should be reported');
}
public function testCanViewContribute()
{
$result = $this->get('/contribute');
$result->assertStatus(200);
$result->assertSee('Contribute to CodeIgniter');
}
public function testCanViewDownload()
{
$result = $this->get('/download');
$result->assertStatus(200);
$result->assertSee('Download');
}
public function testCanViewPolicies()
{
$result = $this->get('/policies');
$result->assertStatus(200);
$result->assertSee('Terms of Service');
}
public function testCanViewFinePrint()
{
$result = $this->get('/the-fine-print');
$result->assertStatus(200);
$result->assertSee('Trademarks');
}
}