CardGameControllerTest::testCardStart()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 22
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace App\Tests\Controller;
4
5
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
6
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
7
use Symfony\Component\Routing\RouterInterface;
8
9
class CardGameControllerTest extends WebTestCase
10
{
11
    /**
12
     * testCardStart
13
     *
14
     * Test card_start route
15
     *
16
     * @return void
17
     */
18
    public function testCardStart(): void
19
    {
20
        // Create a client to browse the application
21
        $client = static::createClient();
22
23
        // Retrieve router service
24
        /** @var RouterInterface $router */
25
        $router = static::getContainer()->get('router');
26
27
        //card_start
28
29
        // Generate URL from route name
30
        $url = $router->generate('card_start');
31
32
        // Send a GET request to the route
33
        $crawler = $client->request('GET', $url);
34
35
        // Assert the response status code
36
        $this->assertEquals(200, $client->getResponse()->getStatusCode());
37
38
        // Assert that certain content exists in the response
39
        $this->assertStringContainsString('Card Game:', $crawler->filter('title')->text());
40
    }
41
42
    /**
43
     * testCardSession
44
     *
45
     * Test card_session route
46
     *
47
     * @return void
48
     */
49
    public function testCardSession(): void
50
    {
51
        // Create a client to browse the application
52
        $client = static::createClient();
53
54
        // Retrieve router service
55
        /** @var RouterInterface $router */
56
        $router = static::getContainer()->get('router');
57
58
        //card_start
59
60
        // Generate URL from route name
61
        $url = $router->generate('card_session');
62
63
        // Send a GET request to the route
64
        $crawler = $client->request('GET', $url);
65
66
        // Assert the response status code
67
        $this->assertEquals(200, $client->getResponse()->getStatusCode());
68
69
        // Assert that certain content exists in the response
70
        $this->assertStringContainsString('Card Game: Session info', $crawler->filter('title')->text());
71
    }
72
73
    /**
74
     * testCardSessionDelete
75
     *
76
     * Test card_session_delete route
77
     *
78
     * @return void
79
     */
80
    public function testCardSessionDelete(): void
81
    {
82
        // Create a client to browse the application
83
        $client = static::createClient();
84
85
        // Retrieve router service
86
        /** @var RouterInterface $router */
87
        $router = static::getContainer()->get('router');
88
89
        //card_start
90
91
        // Generate URL from route name
92
        $url = $router->generate('card_session_delete');
93
94
        // Send a GET request to the route
95
        $crawler = $client->request('GET', $url);
96
97
        // Assert the response status code
98
        $this->assertEquals(200, $client->getResponse()->getStatusCode());
99
100
        // Assert that certain content exists in the response
101
        $this->assertStringContainsString('Card Game: Session info', $crawler->filter('title')->text());
102
    }
103
104
    /**
105
     * testCardDeck
106
     *
107
     * Test card_deck route
108
     *
109
     * @return void
110
     */
111
    public function testCardDeck(): void
112
    {
113
        // Create a client to browse the application
114
        $client = static::createClient();
115
116
        // Retrieve router service
117
        /** @var RouterInterface $router */
118
        $router = static::getContainer()->get('router');
119
120
        //card_start
121
122
        // Generate URL from route name
123
        $url = $router->generate('card_deck');
124
125
        // Send a GET request to the route
126
        $crawler = $client->request('GET', $url);
127
128
        // Assert the response status code
129
        $this->assertEquals(200, $client->getResponse()->getStatusCode());
130
131
        // Assert that certain content exists in the response
132
        $this->assertStringContainsString('Card Game: Deck', $crawler->filter('title')->text());
133
    }
134
135
    /**
136
     * testCardDeckShuffle
137
     *
138
     * Test card_deck_shuffle route
139
     *
140
     * @return void
141
     */
142
    public function testCardDeckShuffle(): void
143
    {
144
        // Create a client to browse the application
145
        $client = static::createClient();
146
147
        // Retrieve router service
148
        /** @var RouterInterface $router */
149
        $router = static::getContainer()->get('router');
150
151
        //card_start
152
153
        // Generate URL from route name
154
        $url = $router->generate('card_deck_shuffle');
155
156
        // Send a GET request to the route
157
        $crawler = $client->request('GET', $url);
158
159
        // Assert the response status code
160
        $this->assertEquals(200, $client->getResponse()->getStatusCode());
161
162
        // Assert that certain content exists in the response
163
        $this->assertStringContainsString('Card Game: Deck', $crawler->filter('title')->text());
164
    }
165
166
    /**
167
     * testCardDeckDraw
168
     *
169
     * Test card_deck_draw route
170
     *
171
     * @return void
172
     */
173
    public function testCardDeckDraw(): void
174
    {
175
        // Create a client to browse the application
176
        $client = static::createClient();
177
178
        // Retrieve router service
179
        /** @var RouterInterface $router */
180
        $router = static::getContainer()->get('router');
181
182
        //card_start
183
184
        // Generate URL from route name
185
        $url = $router->generate('card_deck_draw');
186
187
        // Send a GET request to the route
188
        $crawler = $client->request('GET', $url);
189
190
        // Assert the response status code
191
        $this->assertEquals(200, $client->getResponse()->getStatusCode());
192
193
        // Assert that certain content exists in the response
194
        $this->assertStringContainsString('Card Game: Draw', $crawler->filter('title')->text());
195
    }
196
197
    /**
198
     * testCardDeckDrawMany
199
     *
200
     * Test card_deck_draw_many route
201
     *
202
     * @return void
203
     */
204
    public function testCardDeckDrawMany(): void
205
    {
206
        // Create a client to browse the application
207
        $client = static::createClient();
208
209
        // Retrieve router service
210
        /** @var RouterInterface $router */
211
        $router = static::getContainer()->get('router');
212
213
        //card_start
214
215
        // Generate URL from route name
216
        $url = $router->generate('card_deck_draw_many', ['num' => 5]);
217
218
        // Send a GET request to the route
219
        $crawler = $client->request('GET', $url);
220
221
        // Assert the response status code
222
        $this->assertEquals(200, $client->getResponse()->getStatusCode());
223
224
        // Assert that certain content exists in the response
225
        $this->assertStringContainsString('Card Game: Draw', $crawler->filter('title')->text());
226
    }
227
}
228