Skip to content
This repository has been archived by the owner on Jan 6, 2020. It is now read-only.

Commit

Permalink
Refactor tests to fix new pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
supergrecko committed Jun 22, 2019
1 parent d674b92 commit 04e237e
Show file tree
Hide file tree
Showing 12 changed files with 73 additions and 95 deletions.
2 changes: 1 addition & 1 deletion phpunit.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/6.1/phpunit.xsd"
bootstrap="vendor/autoload.php"
bootstrap="tests/autoload.php"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
Expand Down
3 changes: 0 additions & 3 deletions tests/Collections/CollectionTest.php
Expand Up @@ -3,12 +3,9 @@
namespace RiotQuest\Tests\Collections;

use PHPUnit\Framework\TestCase;
use RiotQuest\Client;
use RiotQuest\Components\Collections\Collection;
use RiotQuest\Components\Collections\Match;

Client::boot();

/**
* Class CollectionTest
* @package RiotQuest\Tests\Collections
Expand Down
12 changes: 6 additions & 6 deletions tests/Endpoints/ChampionTest.php
Expand Up @@ -5,19 +5,19 @@
use PHPUnit\Framework\TestCase;
use RiotQuest\Client;
use RiotQuest\Components\Collections\ChampionInfo;
use RiotQuest\Contracts\LeagueException;

Client::boot();

/**
* Class ChampionTest
* @package RiotQuest\Tests\Endpoints
*/
class ChampionTest extends TestCase
{

/**
* Test the champion rotations endpoint
*
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \ReflectionException
* @throws \RiotQuest\Contracts\LeagueException
* @throws LeagueException
*/
public function testRequestRotation()
{
Expand Down
12 changes: 6 additions & 6 deletions tests/Endpoints/CodeTest.php
Expand Up @@ -4,19 +4,19 @@

use PHPUnit\Framework\TestCase;
use RiotQuest\Client;
use RiotQuest\Contracts\LeagueException;

Client::boot();

/**
* Class CodeTest
* @package RiotQuest\Tests\Endpoints
*/
class CodeTest extends TestCase
{

/**
* Assert that the code endpoint works
*
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \ReflectionException
* @throws \RiotQuest\Contracts\LeagueException
* @throws LeagueException
*/
public function testRequestCode()
{
Expand Down
25 changes: 11 additions & 14 deletions tests/Endpoints/LeagueTest.php
Expand Up @@ -6,19 +6,19 @@
use RiotQuest\Client;
use RiotQuest\Components\Collections\League;
use RiotQuest\Components\Collections\LeagueEntryList;
use RiotQuest\Contracts\LeagueException;

Client::boot();

/**
* Class LeagueTest
* @package RiotQuest\Tests\Endpoints
*/
class LeagueTest extends TestCase
{

/**
* Test the single league ID endpoint
*
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \ReflectionException
* @throws \RiotQuest\Contracts\LeagueException
* @throws LeagueException
*/
public function testRequestSingleLeague()
{
Expand All @@ -28,6 +28,9 @@ public function testRequestSingleLeague()
$this->assertInstanceOf(League::class, $collection);
}

/**
* @throws LeagueException
*/
public function testLeagueEntries() {
$collection = Client::league('euw')->entries('RANKED_SOLO_5x5', 'DIAMOND', 'I', 1);

Expand All @@ -37,10 +40,7 @@ public function testLeagueEntries() {
/**
* Test the apex league endpoints
*
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \ReflectionException
* @throws \RiotQuest\Contracts\LeagueException
* @throws LeagueException
*/
public function testRequestApexLeagues()
{
Expand All @@ -56,10 +56,7 @@ public function testRequestApexLeagues()
/**
* Test positions for summoner endpoint
*
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \ReflectionException
* @throws \RiotQuest\Contracts\LeagueException
* @throws LeagueException
*/
public function testRequestPositions()
{
Expand Down
22 changes: 8 additions & 14 deletions tests/Endpoints/MasteryTest.php
Expand Up @@ -6,19 +6,19 @@
use RiotQuest\Client;
use RiotQuest\Components\Collections\ChampionMastery;
use RiotQuest\Components\Collections\ChampionMasteryList;
use RiotQuest\Contracts\LeagueException;

Client::boot();

/**
* Class MasteryTest
* @package RiotQuest\Tests\Endpoints
*/
class MasteryTest extends TestCase
{

/**
* Tests the all masteries endpoint
*
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \ReflectionException
* @throws \RiotQuest\Contracts\LeagueException
* @throws LeagueException
*/
public function testRequestAllMasteries()
{
Expand All @@ -31,10 +31,7 @@ public function testRequestAllMasteries()
/**
* Tests the single mastery endpoint
*
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \ReflectionException
* @throws \RiotQuest\Contracts\LeagueException
* @throws LeagueException
*/
public function testRequestSingleMastery()
{
Expand All @@ -47,10 +44,7 @@ public function testRequestSingleMastery()
/**
* Test total mastery score endpoint
*
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \ReflectionException
* @throws \RiotQuest\Contracts\LeagueException
* @throws LeagueException
*/
public function testRequestTotalScore()
{
Expand Down
22 changes: 8 additions & 14 deletions tests/Endpoints/MatchTest.php
Expand Up @@ -7,19 +7,19 @@
use RiotQuest\Components\Collections\Match;
use RiotQuest\Components\Collections\MatchHistory;
use RiotQuest\Components\Collections\MatchTimeline;
use RiotQuest\Contracts\LeagueException;

Client::boot();

/**
* Class MatchTest
* @package RiotQuest\Tests\Endpoints
*/
class MatchTest extends TestCase
{

/**
* Tests match by id endpoint
*
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \ReflectionException
* @throws \RiotQuest\Contracts\LeagueException
* @throws LeagueException
*/
public function testRequestSingleId()
{
Expand All @@ -32,10 +32,7 @@ public function testRequestSingleId()
/**
* Tests the match history endpoint
*
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \ReflectionException
* @throws \RiotQuest\Contracts\LeagueException
* @throws LeagueException
*/
public function testRequestMatchList()
{
Expand All @@ -48,10 +45,7 @@ public function testRequestMatchList()
/**
* Tests the match timeline endpoint
*
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \ReflectionException
* @throws \RiotQuest\Contracts\LeagueException
* @throws LeagueException
*/
public function testRequestTimeline()
{
Expand Down
15 changes: 5 additions & 10 deletions tests/Endpoints/SpectatorTest.php
Expand Up @@ -8,18 +8,17 @@
use RiotQuest\Components\Collections\FeaturedGames;
use RiotQuest\Contracts\LeagueException;

Client::boot();

/**
* Class SpectatorTest
* @package RiotQuest\Tests\Endpoints
*/
class SpectatorTest extends TestCase
{

/**
* Tests the featured games endpoint
*
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \ReflectionException
* @throws \RiotQuest\Contracts\LeagueException
* @throws LeagueException
*/
public function testRequestFeaturedGames()
{
Expand All @@ -30,10 +29,6 @@ public function testRequestFeaturedGames()
/**
* Tests the live game endpoint
*
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \ReflectionException
* @throws \RiotQuest\Contracts\LeagueException
*/
public function testRequestActiveGame()
{
Expand Down
12 changes: 6 additions & 6 deletions tests/Endpoints/StatusTest.php
Expand Up @@ -5,19 +5,19 @@
use PHPUnit\Framework\TestCase;
use RiotQuest\Client;
use RiotQuest\Components\Collections\ShardStatus;
use RiotQuest\Contracts\LeagueException;

Client::boot();

/**
* Class StatusTest
* @package RiotQuest\Tests\Endpoints
*/
class StatusTest extends TestCase
{

/**
* Test the status endpoint
*
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \ReflectionException
* @throws \RiotQuest\Contracts\LeagueException
* @throws LeagueException
*/
public function testRequestShard()
{
Expand Down
27 changes: 9 additions & 18 deletions tests/Endpoints/SummonerTest.php
Expand Up @@ -5,19 +5,19 @@
use PHPUnit\Framework\TestCase;
use RiotQuest\Client;
use RiotQuest\Components\Collections\Summoner;
use RiotQuest\Contracts\LeagueException;

Client::boot();

/**
* Class SummonerTest
* @package RiotQuest\Tests\Endpoints
*/
class SummonerTest extends TestCase
{

/**
* Makes sure that the summoner by name endpoint works
*
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \ReflectionException
* @throws \RiotQuest\Contracts\LeagueException
* @throws LeagueException
*/
public function testRequestByName()
{
Expand All @@ -30,10 +30,7 @@ public function testRequestByName()
/**
* Make sure that the summoner by summoner id works
*
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \ReflectionException
* @throws \RiotQuest\Contracts\LeagueException
* @throws LeagueException
*/
public function testRequestById()
{
Expand All @@ -46,10 +43,7 @@ public function testRequestById()
/**
* Make sure that the summoner by account id endpoint works
*
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \ReflectionException
* @throws \RiotQuest\Contracts\LeagueException
* @throws LeagueException
*/
public function testRequestByAccount()
{
Expand All @@ -62,10 +56,7 @@ public function testRequestByAccount()
/**
* Make sure that the summoner by puuid endpoint works
*
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \ReflectionException
* @throws \RiotQuest\Contracts\LeagueException
* @throws LeagueException
*/
public function testRequestByUnique()
{
Expand Down
7 changes: 4 additions & 3 deletions tests/Framework/LibraryTest.php
Expand Up @@ -3,11 +3,12 @@
namespace RiotQuest\Tests\Framework;

use PHPUnit\Framework\TestCase;
use RiotQuest\Client;
use RiotQuest\Components\Engine\Utils;

Client::boot();

/**
* Class LibraryTest
* @package RiotQuest\Tests\Framework
*/
class LibraryTest extends TestCase
{

Expand Down
9 changes: 9 additions & 0 deletions tests/autoload.php
@@ -0,0 +1,9 @@
<?php /** @noinspection PhpUnhandledExceptionInspection */
/** @noinspection PhpUnhandledExceptionInspection */

require __DIR__ . '/../vendor/autoload.php';

use RiotQuest\Client;

/** @noinspection PhpUnhandledExceptionInspection */
Client::boot();

0 comments on commit 04e237e

Please sign in to comment.