forked from phpbb/ideas
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex_controller_test.php
More file actions
77 lines (68 loc) · 1.91 KB
/
index_controller_test.php
File metadata and controls
77 lines (68 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
/**
*
* Ideas extension for the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
*/
namespace phpbb\ideas\tests\controller;
class index_controller_test extends controller_base
{
/**
* Test data for the test_controller test
*
* @return array Array of test data
*/
public function controller_test_data()
{
return array(
array(200, '@phpbb_ideas/index_body.html'),
);
}
/**
* Basic controller test
*
* @dataProvider controller_test_data
*/
public function test_controller($status_code, $page_content)
{
/** @var \phpbb\ideas\controller\index_controller $controller */
$controller = $this->get_controller('index_controller', 'ideas');
self::assertInstanceOf('phpbb\ideas\controller\index_controller', $controller);
$this->entity->expects(self::atMost(4))
->method('get_ideas')
->willReturn([$this->initialized_idea_array()]);
$response = $controller->index();
self::assertInstanceOf('\Symfony\Component\HttpFoundation\Response', $response);
self::assertEquals($status_code, $response->getStatusCode());
self::assertEquals($page_content, $response->getContent());
}
/**
* Test data for the test_controller_exception test
*
* @return array Array of test data
*/
public function controller_exception_test_data()
{
return array(
array(0),
array(''),
);
}
/**
* Basic controller exception test
*
* @dataProvider controller_exception_test_data
*/
public function test_controller_exception($forum)
{
$this->expectException(\phpbb\exception\http_exception::class);
$this->config['ideas_forum_id'] = $forum;
/** @var \phpbb\ideas\controller\index_controller $controller */
$controller = $this->get_controller('index_controller', 'ideas');
self::assertInstanceOf('phpbb\ideas\controller\index_controller', $controller);
$controller->index();
}
}