@@ -106,6 +106,7 @@ public function test_construct()
106106 public function test_getSubscribedEvents ()
107107 {
108108 self ::assertEquals (array (
109+ 'core.page_header ' ,
109110 'core.viewforum_get_topic_data ' ,
110111 'core.viewtopic_modify_post_row ' ,
111112 'core.viewtopic_modify_page_title ' ,
@@ -117,6 +118,36 @@ public function test_getSubscribedEvents()
117118 ), array_keys (\phpbb \ideas \event \listener::getSubscribedEvents ()));
118119 }
119120
121+ public function global_template_vars_data ()
122+ {
123+ return [
124+ 'registered user ' => [true , false , true ],
125+ 'unregistered user ' => [false , false , false ],
126+ 'is bot user ' => [true , true , false ],
127+ 'is bot guest ' => [false , true , false ],
128+ ];
129+ }
130+
131+ /**
132+ * @dataProvider global_template_vars_data
133+ */
134+ public function test_global_template_vars ($ is_registered , $ is_bot , $ expected )
135+ {
136+ $ this ->user ->data ['is_registered ' ] = $ is_registered ;
137+ $ this ->user ->data ['is_bot ' ] = $ is_bot ;
138+
139+ $ this ->helper ->expects ($ expected ? $ this ->once () : $ this ->never ())
140+ ->method ('route ' )
141+ ->willReturn ('phpbb_ideas_list_controller ' );
142+
143+ $ this ->template ->expects ($ expected ? $ this ->once () : $ this ->never ())
144+ ->method ('assign_var ' )
145+ ->with ('U_SEARCH_MY_IDEAS ' , 'phpbb_ideas_list_controller ' );
146+
147+ $ listener = $ this ->get_listener ();
148+ $ listener ->global_template_vars ();
149+ }
150+
120151 public function show_idea_data ()
121152 {
122153 return [
0 commit comments