Completed
Push — develop ( 82247e...95e034 )
by Victor
17:24 queued 10s
created

AdminControllerTest::testIndex()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 8
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 8
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: victor
5
 * Date: 17.01.16
6
 * Time: 17:58
7
 */
8
9
namespace AppBundle\Tests\Controller;
10
11
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
12
13
class AdminControllerTest extends WebTestCase
14
{
15 View Code Duplication
    public function testIndex(){
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
        $client = static::createClient();
17
18
        $crawler = $client->request('GET', '/admin/');
19
20
        $this->assertEquals(200, $client->getResponse()->getStatusCode());
21
        $this->assertContains('Statistic', $crawler->filter('h2')->text());
22
    }
23
24 View Code Duplication
    public function testArticles(){
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
25
        $client = static::createClient();
26
27
        $crawler = $client->request('GET', '/admin/articles');
28
29
        $this->assertEquals(200, $client->getResponse()->getStatusCode());
30
        $this->assertContains('Articles', $crawler->filter('h2')->text());
31
        $this->assertEquals(2, $crawler->filter('tr')->count());
32
    }
33
34 View Code Duplication
    public function testComments(){
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
35
        $client = static::createClient();
36
37
        $crawler = $client->request('GET', '/admin/comments');
38
39
        $this->assertEquals(200, $client->getResponse()->getStatusCode());
40
        $this->assertContains('Comments', $crawler->filter('h2')->text());
41
        $this->assertEquals(3, $crawler->filter('tr')->count());
42
    }
43
44 View Code Duplication
    public function testUsers(){
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
45
        $client = static::createClient();
46
47
        $crawler = $client->request('GET', '/admin/users');
48
49
        $this->assertEquals(200, $client->getResponse()->getStatusCode());
50
        $this->assertContains('Users', $crawler->filter('h2')->text());
51
        $this->assertEquals(2, $crawler->filter('tr')->count());
52
    }
53
54 View Code Duplication
    public function testUsersDelete(){
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
55
        $client = static::createClient();
56
57
        $crawler = $client->request('GET', '/admin/user/delete/1');
58
59
        $this->assertEquals(200, $client->getResponse()->getStatusCode());
60
        $this->assertContains('You want to delete user "User name" (id: 1). Related records: articles (count: 1), comments (count: 1). You must to delete related records before.',
61
            $crawler->filter('.alert')->text());
62
    }
63
64 View Code Duplication
    public function testRoles(){
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
65
        $client = static::createClient();
66
67
        $crawler = $client->request('GET', '/admin/roles');
68
69
        $this->assertEquals(200, $client->getResponse()->getStatusCode());
70
        $this->assertContains('Roles', $crawler->filter('h2')->text());
71
        $this->assertEquals(2, $crawler->filter('tr')->count());
72
    }
73
74 View Code Duplication
    public function testRolesDelete(){
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
75
        $client = static::createClient();
76
77
        $crawler = $client->request('GET', '/admin/role/delete/1');
78
79
        $this->assertEquals(200, $client->getResponse()->getStatusCode());
80
        $this->assertContains('You want to delete role "admin" (id: 1). Related records: users (count: 1). You must to delete related records before.',
81
            $crawler->filter('.alert')->text());
82
    }
83
}