1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Tests\Controller; |
4
|
|
|
|
5
|
|
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class LuckyControllerTwigTest |
9
|
|
|
*/ |
10
|
|
|
class LuckyControllerTwigTest extends WebTestCase |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* Test the /lucky/twig route renders successfully and contains a body tag. |
14
|
|
|
* |
15
|
|
|
* @return void |
16
|
|
|
*/ |
17
|
|
|
public function testLuckyTwig(): void |
18
|
|
|
{ |
19
|
|
|
$client = static::createClient(); |
20
|
|
|
$client->request('GET', '/lucky/twig'); |
21
|
|
|
|
22
|
|
|
$this->assertResponseIsSuccessful(); |
23
|
|
|
$this->assertSelectorExists('body'); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Test the home page (/) renders successfully and contains a body tag. |
28
|
|
|
* |
29
|
|
|
* @return void |
30
|
|
|
*/ |
31
|
|
|
public function testHome(): void |
32
|
|
|
{ |
33
|
|
|
$client = static::createClient(); |
34
|
|
|
$client->request('GET', '/'); |
35
|
|
|
|
36
|
|
|
$this->assertResponseIsSuccessful(); |
37
|
|
|
$this->assertSelectorExists('body'); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Test the /about route renders successfully and contains a body tag. |
42
|
|
|
* |
43
|
|
|
* @return void |
44
|
|
|
*/ |
45
|
|
|
public function testAbout(): void |
46
|
|
|
{ |
47
|
|
|
$client = static::createClient(); |
48
|
|
|
$client->request('GET', '/about'); |
49
|
|
|
|
50
|
|
|
$this->assertResponseIsSuccessful(); |
51
|
|
|
$this->assertSelectorExists('body'); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Test the /report route renders successfully and contains a body tag. |
56
|
|
|
* |
57
|
|
|
* @return void |
58
|
|
|
*/ |
59
|
|
|
public function testReport(): void |
60
|
|
|
{ |
61
|
|
|
$client = static::createClient(); |
62
|
|
|
$client->request('GET', '/report'); |
63
|
|
|
|
64
|
|
|
$this->assertResponseIsSuccessful(); |
65
|
|
|
$this->assertSelectorExists('body'); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Test the /api route renders successfully and contains a body tag. |
70
|
|
|
* |
71
|
|
|
* @return void |
72
|
|
|
*/ |
73
|
|
|
public function testApi(): void |
74
|
|
|
{ |
75
|
|
|
$client = static::createClient(); |
76
|
|
|
$client->request('GET', '/api'); |
77
|
|
|
|
78
|
|
|
$this->assertResponseIsSuccessful(); |
79
|
|
|
$this->assertSelectorExists('body'); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Test the /card route renders successfully. |
84
|
|
|
* |
85
|
|
|
* @return void |
86
|
|
|
*/ |
87
|
|
|
public function testCard(): void |
88
|
|
|
{ |
89
|
|
|
$client = static::createClient(); |
90
|
|
|
$client->request('GET', '/card'); |
91
|
|
|
|
92
|
|
|
$this->assertResponseIsSuccessful(); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Test the /game route renders successfully. |
97
|
|
|
* |
98
|
|
|
* @return void |
99
|
|
|
*/ |
100
|
|
|
public function testGame(): void |
101
|
|
|
{ |
102
|
|
|
$client = static::createClient(); |
103
|
|
|
$client->request('GET', '/game'); |
104
|
|
|
|
105
|
|
|
$this->assertResponseIsSuccessful(); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Test the /library route renders successfully. |
110
|
|
|
* |
111
|
|
|
* @return void |
112
|
|
|
*/ |
113
|
|
|
public function testLibrary(): void |
114
|
|
|
{ |
115
|
|
|
$client = static::createClient(); |
116
|
|
|
$client->request('GET', '/library'); |
117
|
|
|
|
118
|
|
|
$this->assertResponseIsSuccessful(); |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* Test the /metrics route renders successfully and contains a body tag. |
123
|
|
|
* |
124
|
|
|
* @return void |
125
|
|
|
*/ |
126
|
|
|
public function testMetrics(): void |
127
|
|
|
{ |
128
|
|
|
$client = static::createClient(); |
129
|
|
|
$client->request('GET', '/metrics'); |
130
|
|
|
|
131
|
|
|
$this->assertResponseIsSuccessful(); |
132
|
|
|
$this->assertSelectorExists('body'); |
133
|
|
|
} |
134
|
|
|
} |
135
|
|
|
|