DefaultControllerTest::tearDown()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace SumoCoders\FrameworkExampleBundle\Tests\Controller;
3
4
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
5
use Symfony\Bundle\FrameworkBundle\Client;
6
7
class DefaultControllerTest extends WebTestCase
8
{
9
    /**
10
     * @var Client
11
     */
12
    private $client = null;
13
14
    public function setUp()
15
    {
16
        $this->client = static::createClient();
17
    }
18
19
    public function tearDown()
20
    {
21
        $this->client = null;
22
    }
23
24
    /**
25
     * @param string $method
26
     * @param string $url
27
     * @return Crawler
28
     */
29
    private function getCrawlerForRequest($method, $url)
30
    {
31
        return $this->client->request(
32
            $method,
33
            $url
34
        );
35
    }
36
37
    public function testHelloWorld()
38
    {
39
        $crawler = $this->getCrawlerForRequest('GET', '/hello/world');
40
41
        $this->assertGreaterThan(
42
            0,
43
            $crawler->filter('#main .container:contains("Hello world")')->count()
44
        );
45
    }
46
}
47