Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecation #301

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ jobs:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"
- "8.4"
dependencies:
- lowest
- highest
Expand Down
6 changes: 3 additions & 3 deletions lib/commercetools-base/src/Client/ClientCredentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@
* 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 = null)
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;
$this->scope = $scope;
$this->cacheKey = sha1($clientId . (string)$scope);
$this->cacheKey = sha1($clientId . $scope);

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

View check run for this annotation

Codecov / codecov/patch

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

Added line #L46 was not covered by tests
}

public function getClientId(): string
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);
}
}
Loading