diff --git a/tests/Unit/CookieNoticeDeprecationNoticeTest.php b/tests/Unit/CookieNoticeDeprecationNoticeTest.php index eef2abc8..8435c1f9 100644 --- a/tests/Unit/CookieNoticeDeprecationNoticeTest.php +++ b/tests/Unit/CookieNoticeDeprecationNoticeTest.php @@ -87,9 +87,9 @@ public function test_promo_tab_hides_the_install_cta_without_install_plugins_cap } /** - * A user who does have the capability still sees the real install link. + * A user who does have the capability still sees the real install (or activate) link. */ - public function test_promo_tab_shows_the_install_cta_with_install_plugins_capability() { + public function test_promo_tab_shows_the_install_or_activate_cta_with_install_plugins_capability() { $user_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); wp_set_current_user( $user_id ); @@ -103,7 +103,12 @@ public function test_promo_tab_shows_the_install_cta_with_install_plugins_capabi $method->invoke( $settings ); $output = ob_get_clean(); - $this->assertStringContainsString( 'action=install-plugin', html_entity_decode( $output, ENT_QUOTES, 'UTF-8' ) ); + // The button installs FrontConsent, or activates it when a copy is already in the plugins folder (as on a + // development site), so the expectation follows what is on disk instead of assuming a clean install. + $installed = file_exists( WP_PLUGIN_DIR . '/frontconsent/frontconsent.php' ) || file_exists( WP_PLUGIN_DIR . '/front-consent/frontconsent.php' ); + $expected = $installed ? 'action=activate' : 'action=install-plugin'; + + $this->assertStringContainsString( $expected, html_entity_decode( $output, ENT_QUOTES, 'UTF-8' ) ); } /**