From 8d312913494b337d2fc7eaefc63bc924760157b3 Mon Sep 17 00:00:00 2001 From: Jens Schulze Date: Tue, 21 Jan 2025 22:15:42 +0100 Subject: [PATCH] test: clientcredentials instance --- lib/commercetools-base/src/Client/ClientCredentials.php | 4 ++-- test/unit/MiscTest.php | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/commercetools-base/src/Client/ClientCredentials.php b/lib/commercetools-base/src/Client/ClientCredentials.php index 8525d34e6d1..ce310a7db4d 100644 --- a/lib/commercetools-base/src/Client/ClientCredentials.php +++ b/lib/commercetools-base/src/Client/ClientCredentials.php @@ -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: `:`. * Example: `manage_products:project1`. */ - public function __construct(string $clientId, string $clientSecret, ?string $scope) + public function __construct(string $clientId, string $clientSecret, ?string $scope = null) { $this->clientId = $clientId; $this->clientSecret = $clientSecret; diff --git a/test/unit/MiscTest.php b/test/unit/MiscTest.php index a7f616f51af..ba787cafbb1 100644 --- a/test/unit/MiscTest.php +++ b/test/unit/MiscTest.php @@ -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; @@ -289,4 +290,11 @@ public function testAddressDraft() json_encode($cart) ); } + + + public function testCredentials() + { + $credentials = new ClientCredentials("clientId", "clientSecret"); + $this->assertInstanceOf(ClientCredentials::class, $credentials); + } }