Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
casperbakker committed Nov 11, 2024
1 parent d633a08 commit dff1ad3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
24 changes: 9 additions & 15 deletions tests/BaseClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions tests/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dff1ad3

Please sign in to comment.