File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,6 +17,10 @@ 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
2226 */
@@ -32,7 +36,8 @@ public function setUp()
3236
3337 // Load/Mock classes required by the event listener class
3438 $ this ->config = new \phpbb \config \config (array ('googleanalytics_id ' => 'UA-000000-01 ' ));
35- $ this ->template = new \phpbb \googleanalytics \tests \mock \template ();
39+ $ this ->template = $ this ->getMockBuilder ('\phpbb\template\template ' )
40+ ->getMock ();
3641 $ this ->user = new \phpbb \user ('\phpbb\datetime ' );
3742 }
3843
@@ -76,13 +81,13 @@ public function test_load_google_analytics()
7681 {
7782 $ this ->set_listener ();
7883
84+ $ this ->template ->expects ($ this ->once ())
85+ ->method ('assign_var ' )
86+ ->with ('GOOGLEANALYTICS_ID ' , $ this ->config ['googleanalytics_id ' ]);
87+
7988 $ dispatcher = new \Symfony \Component \EventDispatcher \EventDispatcher ();
8089 $ dispatcher ->addListener ('core.page_header ' , array ($ this ->listener , 'load_google_analytics ' ));
8190 $ dispatcher ->dispatch ('core.page_header ' );
82-
83- $ this ->assertEquals (array (
84- 'GOOGLEANALYTICS_ID ' => $ this ->config ['googleanalytics_id ' ],
85- ), $ this ->template ->get_template_vars ());
8691 }
8792
8893 /**
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments