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

MovieControllerTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testIndexAction() 0 13 1
A testAddAction() 0 13 1
A testImportAction() 0 16 1
1
<?php
2
3
class MovieControllerTest extends AbstractControllerTestCase
4
{
5
    public function testIndexAction(): void
6
    {
7
        $params = ['action' => 'index', 'controller' => 'movie', 'module' => 'default'];
8
        $url = $this->url($this->urlizeOptions($params));
9
        $this->dispatch($url);
10
11
        // assertions
12
        $this->assertModule($params['module']);
13
        $this->assertController($params['controller']);
14
        $this->assertAction($params['action']);
15
16
        $this->assertQueryContentContains('legend', 'Filter');
17
        $this->assertQueryContentContains('th a', 'Title');
18
    }
19
20
    public function testAddAction(): void
21
    {
22
        $params = ['action' => 'add', 'controller' => 'movie', 'module' => 'default'];
23
        $url = $this->url($this->urlizeOptions($params));
24
        $this->dispatch($url);
25
26
        // assertions
27
        $this->assertModule($params['module']);
28
        $this->assertController($params['controller']);
29
        $this->assertAction($params['action']);
30
31
        $this->assertQueryContentContains('label', 'IMDb url or id');
32
        $this->assertQueryContentContains('.tips', 'learn how to add');
33
    }
34
35
    public function testImportAction(): void
36
    {
37
        $params = ['action' => 'import', 'controller' => 'movie', 'module' => 'default'];
38
        $url = $this->url($this->urlizeOptions($params));
39
        $this->dispatch($url);
40
41
        // assertions
42
        $this->assertModule($params['module']);
43
        $this->assertController($params['controller']);
44
        $this->assertAction($params['action']);
45
46
        $this->assertQueryContentContains('label', 'Vote History');
47
        $this->assertQueryContentContains('label', 'Minimum for favorite');
48
        $this->assertQueryContentContains('label', 'Minimum for excellent');
49
        $this->assertQueryContentContains('label', 'Minimum for ok');
50
        $this->assertQueryContentContains('.tips', 'learn how to add');
51
    }
52
}
53