<?php declare(strict_types=1);

use PHPUnit\Framework\TestCase;
use Neusta\IntexClient\Connection\Factory;
use Neusta\IntexClient\Connection\Model\CustomerConnection;

class FactoryTest extends TestCase
{
    /**
     * @var Factory
     */
    private $subject;

    public function setUp()
    {
        $this->subject = new Factory();
    }

    /**
     * @test
     */
    public function createMustReturnInstanceOfCustomerConnectionWithValidIdentifierGiven()
    {
        $expectedInstance = $this->subject->create('customer');

        self::assertInstanceOf(CustomerConnection::class, $expectedInstance);
    }

    /**
     * @test
     * @throws RuntimeException
     */
    public function createMustThrowRuntimeExceptionIfInvalidIdentifierIsGiven()
    {
        $unexpectedInstance = $this->subject->create('fooBar');

        self::expectException(RuntimeException::class);
    }
}
