DefaultControllerTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 40
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A tearDown() 0 4 1
A getCrawlerForRequest() 0 7 1
A testHelloWorld() 0 9 1
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