Failed Conditions
Push — master ( 008819...bd15c6 )
by Adrien
04:03
created

ActivityControllerTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 19
dl 0
loc 43
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testUserAction() 0 10 1
A testIndexAction() 0 10 1
A testMovieAction() 0 10 1
A assertCommonThings() 0 5 1
1
<?php
2
3
namespace mQueueTest\Controller;
4
5
class ActivityControllerTest extends AbstractControllerTestCase
6
{
7
    protected function assertCommonThings(array $params): void
8
    {
9
        $this->assertModule($params['module']);
10
        $this->assertController($params['controller']);
11
        $this->assertAction($params['action']);
12
    }
13
14
    public function testIndexAction(): void
15
    {
16
        $params = ['action' => 'index', 'controller' => 'activity', 'module' => 'default'];
17
        $url = $this->url($this->urlizeOptions($params));
18
        $this->dispatch($url);
19
20
        // assertions
21
        $this->assertCommonThings($params);
22
23
        $this->assertQueryContentContains('h2', 'Overall activity');
24
    }
25
26
    public function testUserAction(): void
27
    {
28
        $params = ['action' => 'index', 'controller' => 'activity', 'module' => 'default', 'user' => $this->testUser->id];
0 ignored issues
show
Bug Best Practice introduced by
The property id does not exist on mQueue\Model\User. Since you implemented __get, consider adding a @property annotation.
Loading history...
29
        $url = $this->url($this->urlizeOptions($params));
30
        $this->dispatch($url);
31
32
        // assertions
33
        $this->assertCommonThings($params);
34
35
        $this->assertQueryContentContains('h2', 'Activity for');
36
    }
37
38
    public function testMovieAction(): void
39
    {
40
        $params = ['action' => 'index', 'controller' => 'activity', 'module' => 'default', 'movie' => $this->movieData['id']];
41
        $url = $this->url($this->urlizeOptions($params));
42
        $this->dispatch($url);
43
44
        // assertions
45
        $this->assertCommonThings($params);
46
47
        $this->assertQueryContentContains('h2', 'Activity for ' . $this->movieData['title']);
48
    }
49
}
50