Skip to content

Commit

Permalink
Fix tests + rename test class
Browse files Browse the repository at this point in the history
  • Loading branch information
Miraeld committed Jun 28, 2024
1 parent ee9131d commit d26235d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions inc/Engine/License/API/UserClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ private function get_raw_user_data() {
? $this->options->get( 'consumer_email', '' )
: rocket_get_constant( 'WP_ROCKET_EMAIL', '' );

// Bail out if customer_key & email are empty.
if ( empty( $customer_key ) || empty( $customer_email ) ) {
return false;
}

$response = $this->send_post_request(
[
'body' => 'user_id=' . rawurlencode( $customer_email ) . '&consumer_key=' . sanitize_key( $customer_key ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public function set_up() {

public function tear_down() {
delete_transient( 'wp_rocket_customer_data' );
delete_transient( 'wpr_user_information_timeout_active' );
delete_transient( 'wpr_user_information_timeout' );
remove_filter( 'pre_get_rocket_option_consumer_email', [ $this, 'set_consumer_email' ] );
remove_filter( 'pre_get_rocket_option_consumer_key', [ $this, 'set_consumer_key' ] );
remove_filter( 'pre_http_request', [ $this, 'set_response' ] );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @group License
*/
class GetPricingData extends TestCase {
class GetUserData extends TestCase {
use ApiTrait;

protected static $api_credentials_config_file = 'license.php';
Expand Down

0 comments on commit d26235d

Please sign in to comment.