<commit_before><?php

namespace Risan\OAuth1\Test\Unit;

use Risan\OAuth1\OAuth1;
use InvalidArgumentException;
use PHPUnit\Framework\TestCase;
use Risan\OAuth1\OAuth1Interface;
use Psr\Http\Message\UriInterface;
use Risan\OAuth1\HttpClientInterface;
use Psr\Http\Message\ResponseInterface;
use Risan\OAuth1\Request\RequestInterface;
use Risan\OAuth1\Credentials\TokenCredentials;
use Risan\OAuth1\Request\RequestFactoryInterface;
use Risan\OAuth1\Credentials\TemporaryCredentials;
use Risan\OAuth1\Credentials\CredentialsFactoryInterface;

class OAuth1Test extends TestCase
{
    private $httpClientStub;
    private $requestFactoryStub;
    private $credentialsFactoryStub;
    private $temporaryCredentialsStub;
    private $tokenCredentialsStub;
    private $oauth1;
    private $requestStub;
    private $responseStub;
    private $psrUriStub;

    function setUp()
    {
        $this->httpClientStub = $this->createMock(HttpClientInterface::class);
        $this->requestFactoryStub = $this->createMock(RequestFactoryInterface::class);
        $this->credentialsFactoryStub = $this->createMock(CredentialsFactoryInterface::class);
        $this->temporaryCredentialsStub = $this->createMock(TemporaryCredentials::class);
        $this->tokenCredentialsStub = $this->createMock(TokenCredentials::class);
        $this->requestStub = $this->createMock(RequestInterface::class);
        $this->responseStub = $this->createMock(ResponseInterface::class);
        $this->psrUriStub = $this->createMock(UriInterface::class);
        $this->oauth1 = new OAuth1($this->httpClientStub, $this->requestFactoryStub, $this->credentialsFactoryStub);
    }

    /** @test */
    function it_implements_oauth1_interface()
    {
        $this->assertInstanceOf(OAuth1Interface::class, $this->oauth1);
    }

    /** @test */
    function it_can_get_http_client()
    {
        $this->assertSame($this->httpClientStub, $this->oauth1->getHttpClient());
    }

    /** @test */
    function it_can_get_request_factory()
    {
        $this->assertSame($this->requestFactoryStub, $this->oauth1->getRequestFactory());
    }

    /** @test */
    function it_can_get_credentials_factory()
    {
        $this->assertSame($this->credentialsFactoryStub, $this->oauth1->getCredentialsFactory());
    }

    /** @test */
    function it_can_get_and_set_token_credentials()<commit_msg>:white_check_mark: Add test for getConfig.<commit_after><?php

namespace Risan\OAuth1\Test\Unit;

use Risan\OAuth1\OAuth1;
use InvalidArgumentException;
use PHPUnit\Framework\TestCase;
use Risan\OAuth1\OAuth1Interface;
use Psr\Http\Message\UriInterface;
use Risan\OAuth1\HttpClientInterface;
use Psr\Http\Message\ResponseInterface;
use Risan\OAuth1\Config\ConfigInterface;
use Risan\OAuth1\Request\RequestInterface;
use Risan\OAuth1\Credentials\TokenCredentials;
use Risan\OAuth1\Request\RequestFactoryInterface;
use Risan\OAuth1\Credentials\TemporaryCredentials;
use Risan\OAuth1\Credentials\CredentialsFactoryInterface;

class OAuth1Test extends TestCase
{
    private $httpClientStub;
    private $requestFactoryStub;
    private $configStub;
    private $credentialsFactoryStub;
    private $temporaryCredentialsStub;
    private $tokenCredentialsStub;
    private $oauth1;
    private $requestStub;
    private $responseStub;
    private $psrUriStub;

    function setUp()
    {
        $this->httpClientStub = $this->createMock(HttpClientInterface::class);
        $this->requestFactoryStub = $this->createMock(RequestFactoryInterface::class);
        $this->configStub = $this->createMock(ConfigInterface::class);
        $this->credentialsFactoryStub = $this->createMock(CredentialsFactoryInterface::class);
        $this->temporaryCredentialsStub = $this->createMock(TemporaryCredentials::class);
        $this->tokenCredentialsStub = $this->createMock(TokenCredentials::class);
        $this->requestStub = $this->createMock(RequestInterface::class);
        $this->responseStub = $this->createMock(ResponseInterface::class);
        $this->psrUriStub = $this->createMock(UriInterface::class);
        $this->oauth1 = new OAuth1($this->httpClientStub, $this->requestFactoryStub, $this->credentialsFactoryStub);
    }

    /** @test */
    function it_implements_oauth1_interface()
    {
        $this->assertInstanceOf(OAuth1Interface::class, $this->oauth1);
    }

    /** @test */
    function it_can_get_http_client()
    {
        $this->assertSame($this->httpClientStub, $this->oauth1->getHttpClient());
    }

    /** @test */
    function it_can_get_request_factory()
    {
        $this->assertSame($this->requestFactoryStub, $this->oauth1->getRequestFactory());
    }

    /** @test */
    function it_can_get_credentials_factory()
    {
        $this->assertSame($this->credentialsFactoryStub, $this->oauth1->getCredentialsFactory());
    }

    /** @test */
    function it_can_get_config()
    {
        $this->requestFactoryStub
            ->expects($this->once())
            ->method('getConfig')
            ->willReturn($this->configStub);

        $this->assertSame($this->configStub, $this->oauth1->getConfig());
    }

    /** @test */
    function it_can_get_and_set_token_credentials()
{'fraction_non_alphanumeric': 0.12929370899266693, 'fraction_numerical': 0.008490930142802007, 'mean_word_length': 4.230070635721494, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 83, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4408624', 'n_tokens_mistral': 1544, 'n_tokens_neox': 1606, 'n_words': 208}