Skip to content

Commit

Permalink
Update connect tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dpanta94 committed Dec 5, 2024
1 parent bdba320 commit 310f638
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/wpunit/Auth/Admin/ConnectControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public function test_it_stores_basic_token_data(): void {

$this->assertSame( $token, $this->token_manager->get( $this->plugin ) );
$this->assertEquals( 1, did_action( 'stellarwp/uplink/' . Config::get_hook_prefix() . '/' . $this->slug . '/connected' ) );
$this->assertEquals( 1, did_action( 'stellarwp/uplink/' . Config::get_hook_prefix() . '/connected' ) );
}

public function test_it_sets_additional_license_key(): void {
Expand Down Expand Up @@ -113,6 +114,7 @@ public function test_it_sets_additional_license_key(): void {
$this->assertSame( $token, $this->token_manager->get( $this->plugin ) );
$this->assertSame( $this->plugin->get_license_key(), $license );
$this->assertEquals( 1, did_action( 'stellarwp/uplink/' . Config::get_hook_prefix() . '/' . $this->slug . '/connected' ) );
$this->assertEquals( 1, did_action( 'stellarwp/uplink/' . Config::get_hook_prefix() . '/connected' ) );
}

public function test_it_does_not_store_with_an_invalid_nonce(): void {
Expand All @@ -134,6 +136,7 @@ public function test_it_does_not_store_with_an_invalid_nonce(): void {

$this->assertNull( $this->token_manager->get( $this->plugin ) );
$this->assertEmpty( did_action( 'stellarwp/uplink/' . Config::get_hook_prefix() . '/' . $this->slug . '/connected' ) );
$this->assertEmpty( did_action( 'stellarwp/uplink/' . Config::get_hook_prefix() . '/connected' ) );
}

public function test_it_does_not_store_an_invalid_token(): void {
Expand All @@ -159,6 +162,7 @@ public function test_it_does_not_store_an_invalid_token(): void {

$this->assertNull( $this->token_manager->get( $this->plugin ) );
$this->assertEmpty( did_action( 'stellarwp/uplink/' . Config::get_hook_prefix() . '/' . $this->slug . '/connected' ) );
$this->assertEmpty( did_action( 'stellarwp/uplink/' . Config::get_hook_prefix() . '/connected' ) );
}

public function test_it_does_not_stores_token_or_license_with_a_slug_that_does_not_exist(): void {
Expand Down Expand Up @@ -224,6 +228,7 @@ public function test_it_stores_token_but_not_license_without_a_license(): void {
$this->assertSame( $token, $this->token_manager->get( $this->plugin ) );
$this->assertEmpty( $this->plugin->get_license_key() );
$this->assertEquals( 1, did_action( 'stellarwp/uplink/' . Config::get_hook_prefix() . '/' . $this->slug . '/connected' ) );
$this->assertEquals( 1, did_action( 'stellarwp/uplink/' . Config::get_hook_prefix() . '/connected' ) );
}

/**
Expand Down Expand Up @@ -266,6 +271,7 @@ public function test_it_sets_token_and_additional_license_key_on_multisite_netwo
$this->assertSame( $token, $this->token_manager->get( $this->plugin ) );
$this->assertSame( $this->plugin->get_license_key( 'network' ), $license );
$this->assertEquals( 1, did_action( 'stellarwp/uplink/' . Config::get_hook_prefix() . '/' . $this->slug . '/connected' ) );
$this->assertEquals( 1, did_action( 'stellarwp/uplink/' . Config::get_hook_prefix() . '/connected' ) );
}

/**
Expand Down Expand Up @@ -310,6 +316,7 @@ public function test_it_stores_token_data_on_subfolder_subsite(): void {
$this->assertSame( $token, $this->token_manager->get( $this->plugin ) );
$this->assertSame( $this->plugin->get_license_key( 'network' ), $license );
$this->assertEquals( 1, did_action( 'stellarwp/uplink/' . Config::get_hook_prefix() . '/' . $this->slug . '/connected' ) );
$this->assertEquals( 1, did_action( 'stellarwp/uplink/' . Config::get_hook_prefix() . '/connected' ) );
}

}

0 comments on commit 310f638

Please sign in to comment.