This commit is contained in:
Oliver Davies 2020-05-30 03:16:54 +01:00
parent b042256e45
commit de6527afd6
4 changed files with 24 additions and 6 deletions

View file

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Opdavies\Glassboxx;
class Config
final class Config implements ConfigInterface
{
/** @var int $vendorId */
private $vendorId;

View file

@ -0,0 +1,18 @@
<?php
namespace Opdavies\Glassboxx;
interface ConfigInterface
{
public function __construct(
int $vendorId,
string $username,
string $password
);
public function getPassword(): string;
public function getUsername(): string;
public function getVendorId(): int;
}

View file

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Opdavies\Glassboxx\Request;
use Opdavies\Glassboxx\Config;
use Opdavies\Glassboxx\ConfigInterface;
use Symfony\Component\HttpClient\HttpClient;
use Symfony\Contracts\HttpClient\HttpClientInterface;
@ -12,7 +12,7 @@ final class AuthTokenRequest extends AbstractRequest
{
public const ENDPOINT = '/integration/admin/token';
/** @var Config */
/** @var ConfigInterface */
private $config;
/** @var HttpClient */
@ -23,7 +23,7 @@ final class AuthTokenRequest extends AbstractRequest
$this->client = $client;
}
public function withConfig(Config $config): self
public function withConfig(ConfigInterface $config): self
{
$this->config = $config;

View file

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Opdavies\Glassboxx\Tests\Glassboxx\Request;
use Opdavies\Glassboxx\Config;
use Opdavies\Glassboxx\ConfigInterface;
use Opdavies\Glassboxx\Request\AuthTokenRequest;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpClient\MockHttpClient;
@ -14,7 +14,7 @@ class AuthTokenRequestTest extends TestCase
{
public function testThatItGetsAnAuthCode(): void
{
$config = $this->getMockBuilder(Config::class)
$config = $this->getMockBuilder(ConfigInterface::class)
->onlyMethods([])
->setConstructorArgs(
[