Skip to content

Commit

Permalink
test: clientcredentials instance
Browse files Browse the repository at this point in the history
  • Loading branch information
jenschude committed Jan 21, 2025
1 parent eb01ef2 commit 8d31291
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/commercetools-base/src/Client/ClientCredentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ class ClientCredentials
* The client id.
* @param string $clientSecret
* The client secret.
* @param string $scope
* @param ?string $scope
* Provide the scope when you want to request a specific ones for the client.
* Can be omitted to use all scopes of the oauth client.
* Format: `<the scope name>:<the project key>`.
* Example: `manage_products:project1`.
*/
public function __construct(string $clientId, string $clientSecret, ?string $scope)
public function __construct(string $clientId, string $clientSecret, ?string $scope = null)

Check warning on line 41 in lib/commercetools-base/src/Client/ClientCredentials.php

View check run for this annotation

Codecov / codecov/patch

lib/commercetools-base/src/Client/ClientCredentials.php#L41

Added line #L41 was not covered by tests
{
$this->clientId = $clientId;
$this->clientSecret = $clientSecret;
Expand Down
8 changes: 8 additions & 0 deletions test/unit/MiscTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
use Commercetools\Api\Models\Type\TypeReferenceBuilder;
use Commercetools\Api\Models\Type\TypeResourceIdentifierBuilder;
use Commercetools\Base\JsonObject;
use Commercetools\Client\ClientCredentials;
use Commercetools\Client\ClientFactory;
use GuzzleHttp\Psr7\Response;
use PHPUnit\Framework\TestCase;
Expand Down Expand Up @@ -289,4 +290,11 @@ public function testAddressDraft()
json_encode($cart)
);
}


public function testCredentials()
{
$credentials = new ClientCredentials("clientId", "clientSecret");
$this->assertInstanceOf(ClientCredentials::class, $credentials);
}
}

0 comments on commit 8d31291

Please sign in to comment.