AdminPerformanceControllerTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 38
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testPerformanceListAction() 0 9 1
A testPerformanceCreateAction() 0 8 1
A testPerformanceDeleteAction() 0 16 1
1
<?php
2
3
namespace App\Tests\Functional\Controller;
4
5
class AdminPerformanceControllerTest extends AbstractAdminController
6
{
7
    public function testPerformanceListAction()
8
    {
9
        $this->request('/admin/Performance/list', 'GET', 302);
10
11
        $this->logIn();
12
13
        $this->request('/admin/Performance/list', 'GET', 200);
14
        $this->assertAdminListPageHasColumns(['Main Picture', 'Title', 'Type', 'Seasons', 'Premiere', 'Festival']);
15
    }
16
17
    public function testPerformanceCreateAction()
18
    {
19
        $this->request('/admin/Performance/create', 'GET', 302);
20
21
        $this->logIn();
22
23
        $this->request('/admin/Performance/create', 'GET', 200);
24
    }
25
26
    public function testPerformanceDeleteAction()
27
    {
28
        $performance = $this->getEm()->getRepository('App:Performance')->findOneBy([]);
29
        $eventsCount1 = count($this->getEm()->getRepository('App:PerformanceEvent')->findAll());
30
        $rolesCount1 = count($this->getEm()->getRepository('App:Role')->findAll());
31
32
        $performanceRolesCount = $performance->getRoles()->count();
33
        $performanceEventsCount = $performance->getPerformanceEvents()->count();
34
        $this->processDeleteAction($performance);
35
36
        $eventsCount2 = count($this->getEm()->getRepository('App:PerformanceEvent')->findAll());
37
        $rolesCount2 = count($this->getEm()->getRepository('App:Role')->findAll());
38
39
        $this->assertEquals($eventsCount1 - $performanceEventsCount, $eventsCount2);
40
        $this->assertEquals($rolesCount1 - $performanceRolesCount, $rolesCount2);
41
    }
42
}
43