1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* (c) Kévin Dunglas <[email protected]> |
5
|
|
|
* |
6
|
|
|
* This source file is subject to the MIT license that is bundled |
7
|
|
|
* with this source code in the file LICENSE. |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace Dunglas\ActionBundle\Tests; |
11
|
|
|
|
12
|
|
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @author Kévin Dunglas <[email protected]> |
16
|
|
|
*/ |
17
|
|
|
class FunctionalTest extends WebTestCase |
18
|
|
|
{ |
19
|
|
|
public function testDummyAction() |
20
|
|
|
{ |
21
|
|
|
$client = static::createClient(); |
22
|
|
|
|
23
|
|
|
$crawler = $client->request('GET', '/'); |
24
|
|
|
$this->assertSame('Here we are!', $crawler->text()); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
public function testSensioFrameworkExtraActionAction() |
28
|
|
|
{ |
29
|
|
|
$client = static::createClient(); |
30
|
|
|
|
31
|
|
|
$crawler = $client->request('GET', '/extra'); |
32
|
|
|
$this->assertSame('How are you?', $crawler->text()); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
public function testRouteAnnotationAction() |
36
|
|
|
{ |
37
|
|
|
$client = static::createClient(); |
38
|
|
|
|
39
|
|
|
$crawler = $client->request('GET', '/annotation'); |
40
|
|
|
$this->assertSame('Hey, ho, let\'s go!', $crawler->text()); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function testOverrideAction() |
44
|
|
|
{ |
45
|
|
|
$client = static::createClient(); |
46
|
|
|
|
47
|
|
|
$crawler = $client->request('GET', '/override'); |
48
|
|
|
$this->assertSame('Override', $crawler->text()); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function testMultiController() |
52
|
|
|
{ |
53
|
|
|
$client = static::createClient(); |
54
|
|
|
|
55
|
|
|
$crawler = $client->request('GET', '/first'); |
56
|
|
|
$this->assertSame('first', $crawler->text()); |
57
|
|
|
|
58
|
|
|
$crawler = $client->request('GET', '/second'); |
59
|
|
|
$this->assertSame('second', $crawler->text()); |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|