@@ -17,10 +17,12 @@ class event_listener_test extends \phpbb_test_case
1717 /** @var \phpbb\googleanalytics\event\listener */
1818 protected $ listener ;
1919
20+ protected $ config ;
21+ protected $ template ;
22+ protected $ user ;
23+
2024 /**
2125 * Setup test environment
22- *
23- * @access public
2426 */
2527 public function setUp ()
2628 {
@@ -34,14 +36,13 @@ public function setUp()
3436
3537 // Load/Mock classes required by the event listener class
3638 $ this ->config = new \phpbb \config \config (array ('googleanalytics_id ' => 'UA-000000-01 ' ));
37- $ this ->template = new \phpbb \googleanalytics \tests \mock \template ();
39+ $ this ->template = $ this ->getMockBuilder ('\phpbb\template\template ' )
40+ ->getMock ();
3841 $ this ->user = new \phpbb \user ('\phpbb\datetime ' );
3942 }
4043
4144 /**
4245 * Create our event listener
43- *
44- * @access protected
4546 */
4647 protected function set_listener ()
4748 {
@@ -54,8 +55,6 @@ protected function set_listener()
5455
5556 /**
5657 * Test the event listener is constructed correctly
57- *
58- * @access public
5958 */
6059 public function test_construct ()
6160 {
@@ -65,8 +64,6 @@ public function test_construct()
6564
6665 /**
6766 * Test the event listener is subscribing events
68- *
69- * @access public
7067 */
7168 public function test_getSubscribedEvents ()
7269 {
@@ -79,27 +76,24 @@ public function test_getSubscribedEvents()
7976
8077 /**
8178 * Test the load_google_analytics event
82- *
83- * @access public
8479 */
8580 public function test_load_google_analytics ()
8681 {
8782 $ this ->set_listener ();
8883
84+ $ this ->template ->expects ($ this ->once ())
85+ ->method ('assign_var ' )
86+ ->with ('GOOGLEANALYTICS_ID ' , $ this ->config ['googleanalytics_id ' ]);
87+
8988 $ dispatcher = new \Symfony \Component \EventDispatcher \EventDispatcher ();
9089 $ dispatcher ->addListener ('core.page_header ' , array ($ this ->listener , 'load_google_analytics ' ));
9190 $ dispatcher ->dispatch ('core.page_header ' );
92-
93- $ this ->assertEquals (array (
94- 'GOOGLEANALYTICS_ID ' => $ this ->config ['googleanalytics_id ' ],
95- ), $ this ->template ->get_template_vars ());
9691 }
9792
9893 /**
9994 * Data set for test_add_googleanalytics_configs
10095 *
10196 * @return array Array of test data
102- * @access public
10397 */
10498 public function add_googleanalytics_configs_data ()
10599 {
@@ -131,7 +125,6 @@ public function add_googleanalytics_configs_data()
131125 * Test the add_googleanalytics_configs event
132126 *
133127 * @dataProvider add_googleanalytics_configs_data
134- * @access public
135128 */
136129 public function test_add_googleanalytics_configs ($ mode , $ display_vars , $ expected_keys )
137130 {
@@ -160,7 +153,6 @@ public function test_add_googleanalytics_configs($mode, $display_vars, $expected
160153 * Data set for test_validate_googleanalytics_id
161154 *
162155 * @return array Array of test data
163- * @access public
164156 */
165157 public function validate_googleanalytics_id_data ()
166158 {
@@ -202,7 +194,6 @@ public function validate_googleanalytics_id_data()
202194 * Test the validate_googleanalytics_id event
203195 *
204196 * @dataProvider validate_googleanalytics_id_data
205- * @access public
206197 */
207198 public function test_validate_googleanalytics_id ($ cfg_array , $ expected_error )
208199 {
0 commit comments