From dff1ad355fb1d936678c601127c1b495090b04e3 Mon Sep 17 00:00:00 2001 From: Casper Bakker Date: Mon, 11 Nov 2024 15:39:20 +0100 Subject: [PATCH] Fix tests --- tests/BaseClientTest.php | 24 +++++++++--------------- tests/ClientTest.php | 7 +++---- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/tests/BaseClientTest.php b/tests/BaseClientTest.php index d97327c..c13f86f 100644 --- a/tests/BaseClientTest.php +++ b/tests/BaseClientTest.php @@ -232,11 +232,10 @@ protected function authenticateByClientCredentials(?ResponseInterface $response $httpClientMock->method('request')->with('POST', 'https://login.bol.com/token', [ 'headers' => [ 'Accept' => 'application/json', - 'Authorization' => 'Basic ' . $credentials + 'Authorization' => 'Basic ' . $credentials, + 'Content-Type' => 'application/x-www-form-urlencoded' ], - 'query' => [ - 'grant_type' => 'client_credentials' - ] + 'body' => 'grant_type=client_credentials' ])->willReturn($response); // use the HttpClient mock created in this method for authentication, put the original one back afterwards @@ -373,13 +372,10 @@ protected function authenticateByAuthorizationCode(?ResponseInterface $response $httpClientMock->method('request')->with('POST', 'https://login.bol.com/token', [ 'headers' => [ 'Accept' => 'application/json', - 'Authorization' => 'Basic ' . $credentials + 'Authorization' => 'Basic ' . $credentials, + 'Content-Type' => 'application/x-www-form-urlencoded' ], - 'query' => [ - 'grant_type' => 'authorization_code', - 'code' => '123456', - 'redirect_uri' => 'http://someserver.xxx/redirect', - ] + 'body' => 'grant_type=authorization_code&code=123456&redirect_uri=http%3A%2F%2Fsomeserver.xxx%2Fredirect' ])->willReturn($response); // use the HttpClient mock created in this method for authentication, put the original one back afterwards @@ -428,12 +424,10 @@ protected function authenticateByRefreshToken(?ResponseInterface $response = nul $httpClientMock->method('request')->with('POST', 'https://login.bol.com/token', [ 'headers' => [ 'Accept' => 'application/json', - 'Authorization' => 'Basic ' . $credentials + 'Authorization' => 'Basic ' . $credentials, + 'Content-Type' => 'application/x-www-form-urlencoded' ], - 'query' => [ - 'grant_type' => 'refresh_token', - 'refresh_token' => $this->validRefreshToken->getToken() - ] + 'body' => 'grant_type=refresh_token&refresh_token=' . $this->validRefreshToken->getToken() ])->willReturn($response); // use the HttpClient mock created in this method for authentication, put the original one back afterwards diff --git a/tests/ClientTest.php b/tests/ClientTest.php index 96a73b2..4a49d53 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -41,11 +41,10 @@ protected function authenticateByClientCredentials() $httpClientMock->method('request')->with('POST', 'https://login.bol.com/token', [ 'headers' => [ 'Accept' => 'application/json', - 'Authorization' => 'Basic ' . $credentials + 'Authorization' => 'Basic ' . $credentials, + 'Content-Type' => 'application/x-www-form-urlencoded' ], - 'query' => [ - 'grant_type' => 'client_credentials' - ] + 'body' => 'grant_type=client_credentials' ])->willReturn($response); // use the HttpClient mock created in this method for authentication, put the original one back afterwards