Failed Conditions
Push — master ( 1a6d63...dcbc0d )
by Adrien
05:26
created

ActivityControllerTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A assertCommonThings() 0 5 1
A testMovieAction() 0 10 1
A testIndexAction() 0 10 1
A testUserAction() 0 10 1
1
<?php
2
3
class ActivityControllerTest extends AbstractControllerTestCase
4
{
5
    protected function assertCommonThings(array $params): void
6
    {
7
        $this->assertModule($params['module']);
8
        $this->assertController($params['controller']);
9
        $this->assertAction($params['action']);
10
    }
11
12
    public function testIndexAction(): void
13
    {
14
        $params = ['action' => 'index', 'controller' => 'activity', 'module' => 'default'];
15
        $url = $this->url($this->urlizeOptions($params));
16
        $this->dispatch($url);
17
18
        // assertions
19
        $this->assertCommonThings($params);
20
21
        $this->assertQueryContentContains('h2', 'Overall activity');
22
    }
23
24
    public function testUserAction(): void
25
    {
26
        $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...
27
        $url = $this->url($this->urlizeOptions($params));
28
        $this->dispatch($url);
29
30
        // assertions
31
        $this->assertCommonThings($params);
32
33
        $this->assertQueryContentContains('h2', 'Activity for');
34
    }
35
36
    public function testMovieAction(): void
37
    {
38
        $params = ['action' => 'index', 'controller' => 'activity', 'module' => 'default', 'movie' => $this->movieData['id']];
39
        $url = $this->url($this->urlizeOptions($params));
40
        $this->dispatch($url);
41
42
        // assertions
43
        $this->assertCommonThings($params);
44
45
        $this->assertQueryContentContains('h2', 'Activity for ' . $this->movieData['title']);
46
    }
47
}
48