File tree Expand file tree Collapse file tree
tests/phpunit/includes/classes Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ private function get_default_menu_items(): array {
110110 // Add Get Pro submenu item (only show if pro is not installed or license is not valid).
111111 if ( ! defined ( 'EDACP_VERSION ' ) || ! EDAC_KEY_VALID ) {
112112 $ pro_link = function_exists ( 'edac_generate_link_type ' )
113- ? edac_generate_link_type ( [ 'utm-content ' => 'admin-toolbar ' ] )
113+ ? edac_generate_link_type ( [ 'utm_content ' => 'admin-toolbar ' ] )
114114 : 'https://equalizedigital.com/accessibility-checker/pricing/ ' ;
115115
116116 $ menu_items [] = [
Original file line number Diff line number Diff line change @@ -94,4 +94,31 @@ public function test_get_default_menu_items_returns_array() {
9494 $ this ->assertNotEmpty ( $ items );
9595 $ this ->assertArrayHasKey ( 'id ' , $ items [0 ] );
9696 }
97+
98+ /**
99+ * Test pro menu link uses the expected UTM content parameter key.
100+ */
101+ public function test_get_default_menu_items_pro_link_uses_utm_content () {
102+ if ( ! function_exists ( 'edac_generate_link_type ' ) ) {
103+ $ this ->markTestSkipped ( 'edac_generate_link_type is not available in this test environment. ' );
104+ }
105+
106+ $ reflection = new \ReflectionClass ( Admin_Toolbar::class );
107+ $ method = $ reflection ->getMethod ( 'get_default_menu_items ' );
108+ $ method ->setAccessible ( true );
109+ $ toolbar = new Admin_Toolbar ();
110+ $ items = $ method ->invoke ( $ toolbar );
111+
112+ $ pro_item = null ;
113+ foreach ( $ items as $ item ) {
114+ if ( 'accessibility-checker-pro ' === $ item ['id ' ] ) {
115+ $ pro_item = $ item ;
116+ break ;
117+ }
118+ }
119+
120+ $ this ->assertNotNull ( $ pro_item );
121+ $ this ->assertStringContainsString ( 'utm_content=admin-toolbar ' , $ pro_item ['href ' ] );
122+ $ this ->assertStringNotContainsString ( 'utm-content=admin-toolbar ' , $ pro_item ['href ' ] );
123+ }
97124}
You can’t perform that action at this time.
0 commit comments