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
|
|
|
|