Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions tests/Unit/CookieNoticeDeprecationNoticeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand All @@ -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' ) );
}

/**
Expand Down
Loading