mirror of
https://github.com/opdavies/glassboxx-sdk-php.git
synced 2025-02-17 22:50:48 +00:00
Re-organise the src and tests directories
This commit is contained in:
parent
ae766763b2
commit
b238e6655a
26 changed files with 13 additions and 13 deletions
41
tests/Request/AuthTokenRequestTest.php
Normal file
41
tests/Request/AuthTokenRequestTest.php
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Opdavies\Glassboxx\Tests\Request;
|
||||
|
||||
use Opdavies\Glassboxx\Request\AuthTokenRequest;
|
||||
use Opdavies\Glassboxx\Tests\TestCase;
|
||||
use Symfony\Component\HttpClient\MockHttpClient;
|
||||
use Symfony\Contracts\HttpClient\ResponseInterface;
|
||||
|
||||
class AuthTokenRequestTest extends TestCase
|
||||
{
|
||||
public function testThatItGetsAnAuthCode(): void
|
||||
{
|
||||
$response = $this->getMockBuilder(ResponseInterface::class)
|
||||
->getMock();
|
||||
$response->method('getContent')->willReturn('"abc123"');
|
||||
|
||||
$client = $this->getMockBuilder(MockHttpClient::class)->getMock();
|
||||
$client->expects($this->once())
|
||||
->method('request')
|
||||
->with(
|
||||
'POST',
|
||||
AuthTokenRequest::ENDPOINT,
|
||||
[
|
||||
'query' => [
|
||||
'password' => 'secret',
|
||||
'username' => 'opdavies',
|
||||
],
|
||||
]
|
||||
)
|
||||
->willReturn($response);
|
||||
|
||||
$token = (new AuthTokenRequest($client))
|
||||
->withConfig($this->config)
|
||||
->getToken();
|
||||
|
||||
$this->assertSame('abc123', $token);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue