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

ActivityControllerTest::testIndexAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 5
c 2
b 0
f 0
dl 0
loc 10
rs 10
cc 1
nc 1
nop 0
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