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