@@ -29,20 +29,18 @@ public function controller_test_data()
2929 array (3 , 'duplicate ' , 'set_duplicate ' , true , true , 'true ' , 200 ), // ajax set duplicate success
3030 array (3 , 'duplicate ' , '' , true , false , 'false ' , 200 ), // ajax set duplicate fail
3131 array (4 , 'removevote ' , 'remove_vote ' , true , true , 'true ' , 200 ), // ajax remove vote success
32- array (4 , 'removevote ' , 'remove_vote ' , true , true , 'false ' , 200 , ['idea_status ' => \phpbb \ideas \factory \ideas ::$ statuses ['DUPLICATE ' ]]), // ajax remove vote not allowed
33- array (4 , 'removevote ' , 'remove_vote ' , true , true , 'false ' , 200 , ['idea_status ' => \phpbb \ideas \factory \ideas ::$ statuses ['IMPLEMENTED ' ]]), // ajax remove vote not allowed
32+ array (4 , 'removevote ' , 'remove_vote ' , true , true , 'false ' , 200 , ['idea_status ' => \phpbb \ideas \ext ::$ statuses ['DUPLICATE ' ]]), // ajax remove vote not allowed
33+ array (4 , 'removevote ' , 'remove_vote ' , true , true , 'false ' , 200 , ['idea_status ' => \phpbb \ideas \ext ::$ statuses ['IMPLEMENTED ' ]]), // ajax remove vote not allowed
3434 array (4 , 'removevote ' , '' , true , false , '"You do not have the necessary permissions to complete this operation." ' , 200 ), // ajax remove vote fail
3535 array (5 , 'rfc ' , 'set_rfc ' , true , true , 'true ' , 200 ), // ajax set rfc success
3636 array (5 , 'rfc ' , '' , true , false , 'false ' , 200 ), // ajax set rfc fail
37- array (6 , 'status ' , 'change_status ' , true , true , 'true ' , 200 ), // ajax set status success
37+ array (6 , 'status ' , 'set_status ' , true , true , 'true ' , 200 ), // ajax set status success
3838 array (6 , 'status ' , '' , true , false , 'false ' , 200 ), // ajax set status fail
3939 array (7 , 'ticket ' , 'set_ticket ' , true , true , 'true ' , 200 ), // ajax set ticket success
4040 array (7 , 'ticket ' , '' , true , false , 'false ' , 200 ), // ajax set ticket fail
41- array (8 , 'title ' , 'set_title ' , true , true , 'true ' , 200 ), // ajax set title success
42- array (8 , 'title ' , '' , true , false , 'false ' , 200 ), // ajax set title fail
4341 array (9 , 'vote ' , 'vote ' , true , true , 'true ' , 200 ), // ajax vote success
44- array (9 , 'vote ' , 'vote ' , true , true , 'false ' , 200 , ['idea_status ' => \phpbb \ideas \factory \ideas ::$ statuses ['DUPLICATE ' ]]), // ajax vote not allowed
45- array (9 , 'vote ' , 'vote ' , true , true , 'false ' , 200 , ['idea_status ' => \phpbb \ideas \factory \ideas ::$ statuses ['IMPLEMENTED ' ]]), // ajax vote not allowed
42+ array (9 , 'vote ' , 'vote ' , true , true , 'false ' , 200 , ['idea_status ' => \phpbb \ideas \ext ::$ statuses ['DUPLICATE ' ]]), // ajax vote not allowed
43+ array (9 , 'vote ' , 'vote ' , true , true , 'false ' , 200 , ['idea_status ' => \phpbb \ideas \ext ::$ statuses ['IMPLEMENTED ' ]]), // ajax vote not allowed
4644 array (9 , 'vote ' , '' , true , false , '"You do not have the necessary permissions to complete this operation." ' , 200 ), // ajax vote fail
4745 array (10 , 'implemented ' , 'set_implemented ' , true , true , 'true ' , 200 ), // ajax set implemented success
4846 array (10 , 'implemented ' , '' , true , false , 'false ' , 200 ), // ajax set implemented fail
@@ -56,20 +54,24 @@ public function controller_test_data()
5654 */
5755 public function test_controller ($ idea_id , $ mode , $ callback , $ is_ajax , $ authorised , $ expected , $ status_code , $ additional_data = [])
5856 {
57+ /** @var \phpbb\ideas\controller\idea_controller $controller */
58+ $ controller = $ this ->get_controller ('idea_controller ' , 'idea ' );
59+ $ this ->assertInstanceOf ('phpbb\ideas\controller\idea_controller ' , $ controller );
60+
5961 // mock some basic idea data
60- $ this ->ideas ->expects ($ this ->once ())
62+ $ this ->entity ->expects ($ this ->once ())
6163 ->method ('get_idea ' )
6264 ->willReturn (array_merge (array (
6365 'idea_id ' => $ idea_id ,
6466 'idea_author ' => 2 ,
65- 'idea_status ' => \phpbb \ideas \factory \ideas ::$ statuses ['NEW ' ]
67+ 'idea_status ' => \phpbb \ideas \ext ::$ statuses ['NEW ' ]
6668 ), $ additional_data )
6769 );
6870
6971 // mock a result from each method called by the idea controller
7072 if ($ expected === 'true ' )
7173 {
72- $ this ->ideas ->expects ($ this ->once ())
74+ $ this ->entity ->expects ($ this ->once ())
7375 ->method (($ callback ))
7476 ->willReturn ($ authorised );
7577 }
@@ -112,10 +114,6 @@ public function test_controller($idea_id, $mode, $callback, $is_ajax, $authorise
112114 $ this ->expectExceptionMessage ('NO_AUTH_OPERATION ' );
113115 }
114116
115- /** @var \phpbb\ideas\controller\idea_controller $controller */
116- $ controller = $ this ->get_controller ('idea_controller ' );
117- $ this ->assertInstanceOf ('phpbb\ideas\controller\idea_controller ' , $ controller );
118-
119117 $ response = $ controller ->idea ($ idea_id );
120118
121119 if ($ is_ajax )
@@ -155,7 +153,7 @@ public function test_controller_exception($idea_id, $forum, $status_code, $page_
155153 $ this ->config ['ideas_forum_id ' ] = $ forum ;
156154
157155 /** @var \phpbb\ideas\controller\idea_controller $controller */
158- $ controller = $ this ->get_controller ('idea_controller ' );
156+ $ controller = $ this ->get_controller ('idea_controller ' , ' idea ' );
159157 $ this ->assertInstanceOf ('phpbb\ideas\controller\idea_controller ' , $ controller );
160158
161159 try
0 commit comments