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 @@ -108,7 +108,7 @@ private function get_default_menu_items(): array {
108108 ];
109109
110110 // Add Get Pro submenu item (only show if pro is not installed or license is not valid).
111- if ( ! defined ( 'EDACP_VERSION ' ) || ! EDAC_KEY_VALID ) {
111+ if ( ! defined ( 'EDACP_VERSION ' ) || ! defined ( ' EDAC_KEY_VALID ' ) || ! EDAC_KEY_VALID ) {
112112 $ pro_link = function_exists ( 'edac_generate_link_type ' )
113113 ? edac_generate_link_type ( [ 'utm_content ' => 'admin-toolbar ' ] )
114114 : 'https://equalizedigital.com/accessibility-checker/pricing/ ' ;
Original file line number Diff line number Diff line change @@ -95,6 +95,36 @@ public function test_get_default_menu_items_returns_array() {
9595 $ this ->assertArrayHasKey ( 'id ' , $ items [0 ] );
9696 }
9797
98+ /**
99+ * Test get_default_menu_items() handles missing EDAC_KEY_VALID when pro is defined.
100+ *
101+ * @runInSeparateProcess
102+ */
103+ public function test_get_default_menu_items_handles_missing_edac_key_valid_constant () {
104+ if ( defined ( 'EDAC_KEY_VALID ' ) ) {
105+ $ this ->markTestSkipped ( 'EDAC_KEY_VALID is already defined in this test environment. ' );
106+ }
107+ if ( ! defined ( 'EDACP_VERSION ' ) ) {
108+ define ( 'EDACP_VERSION ' , '1.0.0 ' );
109+ }
110+
111+ $ reflection = new \ReflectionClass ( Admin_Toolbar::class );
112+ $ method = $ reflection ->getMethod ( 'get_default_menu_items ' );
113+ $ method ->setAccessible ( true );
114+ $ toolbar = new Admin_Toolbar ();
115+ $ items = $ method ->invoke ( $ toolbar );
116+
117+ $ pro_item = null ;
118+ foreach ( $ items as $ item ) {
119+ if ( 'accessibility-checker-pro ' === $ item ['id ' ] ) {
120+ $ pro_item = $ item ;
121+ break ;
122+ }
123+ }
124+
125+ $ this ->assertNotNull ( $ pro_item );
126+ }
127+
98128 /**
99129 * Test pro menu link uses the expected UTM content parameter key.
100130 */
You can’t perform that action at this time.
0 commit comments