Skip to content

Commit 114a9dd

Browse files
committed
Merge remote-tracking branch 'origin/fix-invalid-api-credentials-test' into remove-rocket-loader
2 parents 64e7e5b + cfade16 commit 114a9dd

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

.github/workflows/tests.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ jobs:
4444

4545
# Defines the WordPress and PHP Versions matrix to run tests on.
4646
strategy:
47+
fail-fast: false
4748
matrix:
48-
wp-versions: [ '6.6-RC3' ] #[ 'latest', '6.1.1' ]
49+
wp-versions: [ 'latest' ] #[ 'latest', '6.1.1' ]
4950
php-versions: [ '7.4', '8.0', '8.1', '8.2', '8.3' ] #[ '7.4', '8.0', '8.1', '8.2' ]
5051

5152
# Steps to install, configure and run tests

tests/wpunit/APITest.php

+15-1
Original file line numberDiff line numberDiff line change
@@ -491,14 +491,28 @@ public function testRefreshTokenWithInvalidToken()
491491
$this->assertEquals($result->get_error_code(), 'convertkit_api_error');
492492
}
493493

494+
/**
495+
* Test that supplying no API credentials to the API class returns a WP_Error.
496+
*
497+
* @since 2.0.2
498+
*/
499+
public function testNoAPICredentials()
500+
{
501+
$api = new ConvertKit_API_V4( $_ENV['CONVERTKIT_OAUTH_CLIENT_ID'], $_ENV['CONVERTKIT_OAUTH_REDIRECT_URI'] );
502+
$result = $api->get_account();
503+
$this->assertInstanceOf(WP_Error::class, $result);
504+
$this->assertEquals($result->get_error_code(), $this->errorCode);
505+
$this->assertEquals($result->get_error_message(), 'Authentication Failed');
506+
}
507+
494508
/**
495509
* Test that supplying invalid API credentials to the API class returns a WP_Error.
496510
*
497511
* @since 1.0.0
498512
*/
499513
public function testInvalidAPICredentials()
500514
{
501-
$api = new ConvertKit_API_V4( $_ENV['CONVERTKIT_OAUTH_CLIENT_ID'], $_ENV['CONVERTKIT_OAUTH_REDIRECT_URI'] );
515+
$api = new ConvertKit_API_V4( $_ENV['CONVERTKIT_OAUTH_CLIENT_ID'], $_ENV['CONVERTKIT_OAUTH_REDIRECT_URI'], 'fakeAccessToken', 'fakeRefreshToken' );
502516
$result = $api->get_account();
503517
$this->assertInstanceOf(WP_Error::class, $result);
504518
$this->assertEquals($result->get_error_code(), $this->errorCode);

0 commit comments

Comments
 (0)