diff --git a/.gitignore b/.gitignore index 8361f63..1a8fb3d 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,5 @@ build vendor # Composer lock composer.lock +# PHP Unit cache +.phpunit.result.cache diff --git a/.idea/php.xml b/.idea/php.xml index f9354ea..12c272a 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -14,7 +14,6 @@ - @@ -46,9 +45,11 @@ + + - + diff --git a/.idea/thetvdbapi.iml b/.idea/thetvdbapi.iml index 35b5e94..ba247e2 100644 --- a/.idea/thetvdbapi.iml +++ b/.idea/thetvdbapi.iml @@ -23,8 +23,8 @@ - + @@ -37,6 +37,7 @@ + diff --git a/.travis.yml b/.travis.yml index 44b40bf..ec23ad6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,10 +3,8 @@ language: php sudo: false php: - - 7.1 - - 7.1snapshot - 7.2 - - 7.2snapshot + - 7.3 - master before_install: diff --git a/composer.json b/composer.json index b7aa2ab..cdb2134 100644 --- a/composer.json +++ b/composer.json @@ -11,14 +11,15 @@ } ], "require": { - "php": ">=7.1", + "php": ">=7.2", "guzzlehttp/guzzle": "^6.2", "symfony/serializer": "^3.2", "symfony/property-access": "^3.3", - "symfony/property-info": "^3.3" + "symfony/property-info": "^3.3", + "ext-json": "*" }, "require-dev": { - "phpunit/phpunit": "^6.1" + "phpunit/phpunit": "^8" }, "autoload": { "psr-4": { diff --git a/tests/BaseUnitTest.php b/tests/BaseUnitTest.php deleted file mode 100644 index 2919624..0000000 --- a/tests/BaseUnitTest.php +++ /dev/null @@ -1,160 +0,0 @@ - - * - * Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby - * granted, provided that the above copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER - * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ -declare(strict_types = 1); - -namespace CanIHaveSomeCoffee\TheTVDbAPI\Tests; - -use PHPUnit\Framework\TestCase; - -/** - * Class BaseUnitTest - * - * @category Tests - * @package Coffee\CanIHaveSome\Framework\Tests - * @author Willem Van Iseghem (canihavesomecoffee) - * @license See start of document - * @link https://canihavesome.coffee/projects/theTVDbAPI - */ -abstract class BaseUnitTest extends TestCase -{ - /** - * Asserts that a private attribute (array type) has a given key. - * - * @param string $key The key to search for in the attribute - * @param string $attributeName The name of the attribute - * @param mixed $classOrObject The instance of the object to search into - * - * @return void - */ - public static function assertAttributeHasKey(string $key, string $attributeName, $classOrObject) - { - $property = static::readAttribute($classOrObject, $attributeName); - static::assertInternalType('array', $property); - static::assertArrayHasKey($key, $property); - } - - /** - * Asserts that a private attribute (array type) does not have a given key. - * - * @param string $key The key to search for in the attribute - * @param string $attributeName The name of the attribute - * @param mixed $classOrObject The instance of the object to search into - * - * @return void - */ - public static function assertAttributeNotHasKey(string $key, string $attributeName, $classOrObject) - { - $property = static::readAttribute($classOrObject, $attributeName); - static::assertInternalType('array', $property); - static::assertArrayNotHasKey($key, $property); - } - - /** - * Asserts that a private attribute (array type) has a certain object for a given key. - * - * @param string $key The key to search for in the attribute - * @param mixed $value The object that should be in the attribute for the key - * @param string $attributeName The name of the attribute - * @param mixed $classOrObject The instance of the object to search into - * - * @return void - */ - public static function assertAttributeHasKeyWithValue(string $key, $value, string $attributeName, $classOrObject) - { - $property = static::readAttribute($classOrObject, $attributeName); - static::assertArrayHasKeyWithValue($key, $value, $property); - } - - /** - * Asserts that a private attribute (array type) does not have a value for the given key. - * - * @param string $key The key to search for in the attribute - * @param mixed $value The object that should not be in the attribute for the key - * @param string $attributeName The name of the attribute - * @param mixed $classOrObject The instance of the object to search into - * - * @return void - */ - public static function assertAttributeNotHasKeyWithValue(string $key, $value, string $attributeName, $classOrObject) - { - $property = static::readAttribute($classOrObject, $attributeName); - static::assertArrayNotHasKeyWithValue($key, $value, $property); - } - - /** - * Asserts that an array does have a value for the given key. - * - * @param string $needle The key to search for in the attribute - * @param mixed $value The object that should be in the array for the key - * @param array $hayStack The haystack to search for - * - * @return void - */ - public static function assertArrayHasKeyWithValue(string $needle, $value, array $hayStack) - { - static::assertInternalType('array', $hayStack); - static::assertArrayHasKey($needle, $hayStack); - static::assertEquals($value, $hayStack[$needle]); - } - - /** - * Asserts that an array does not have a value for the given key. - * - * @param string $needle The key to search for in the attribute - * @param mixed $value The object that should not be in the array for the key - * @param array $hayStack The haystack to search for - * - * @return void - */ - public static function assertArrayNotHasKeyWithValue(string $needle, $value, array $hayStack) - { - static::assertInternalType('array', $hayStack); - static::assertArrayHasKey($needle, $hayStack); - static::assertNotEquals($value, $hayStack[$needle]); - } - - /** - * Asserts that a private attribute (object type) has an attribute that matches the given one. - * - * @param mixed $expected The internal attribute's expected value - * @param string $internalAttributeName The internal attribute to compare to - * @param string $attributeName The name of the attribute - * @param mixed $classOrObject The instance of the object to search into - * - * @return void - */ - public static function assertAttributeHasEqualAttribute($expected, string $internalAttributeName, string $attributeName, $classOrObject) - { - $property = static::readAttribute($classOrObject, $attributeName); - static::assertObjectHasAttribute($internalAttributeName, $property); - static::assertAttributeEquals($expected, $internalAttributeName, $property); - } - - /** - * Asserts that a private attribute (object type) has an attribute that matches the given type. - * - * @param string $expected The expected type - * @param string $internalAttributeName The internal attribute to check the type of - * @param string $attributeName The name of the attribute - * @param mixed $classOrObject The instance of the object to search into - * - * @return void - */ - public static function assertAttributeHasAttributeType(string $expected, string $internalAttributeName, string $attributeName, $classOrObject) - { - $property = static::readAttribute($classOrObject, $attributeName); - static::assertObjectHasAttribute($internalAttributeName, $property); - static::assertAttributeInstanceOf($expected, $internalAttributeName, $property); - } -} diff --git a/tests/DataParserTest.php b/tests/DataParserTest.php index e6bcc66..f258871 100644 --- a/tests/DataParserTest.php +++ b/tests/DataParserTest.php @@ -19,9 +19,9 @@ use CanIHaveSomeCoffee\TheTVDbAPI\DataParser; use CanIHaveSomeCoffee\TheTVDbAPI\Model\BasicEpisode; use CanIHaveSomeCoffee\TheTVDbAPI\Model\BasicSeries; -use CanIHaveSomeCoffee\TheTVDbAPI\Model\Episode; use CanIHaveSomeCoffee\TheTVDbAPI\Model\Image; use CanIHaveSomeCoffee\TheTVDbAPI\Model\RatingsInfo; +use PHPUnit\Framework\TestCase; /** * Class DataParserTest @@ -32,7 +32,7 @@ * @license See start of document * @link https://canihavesome.coffee/projects/theTVDbAPI */ -class DataParserTest extends BaseUnitTest +class DataParserTest extends TestCase { public function testParseBasicEpisodeData() { diff --git a/tests/ExceptionTest.php b/tests/ExceptionTest.php index 8c63f34..6e5cba3 100644 --- a/tests/ExceptionTest.php +++ b/tests/ExceptionTest.php @@ -20,7 +20,7 @@ use CanIHaveSomeCoffee\TheTVDbAPI\Exception\ResourceNotFoundException; use CanIHaveSomeCoffee\TheTVDbAPI\Exception\ParseException; use CanIHaveSomeCoffee\TheTVDbAPI\Exception\ConflictException; -use function GuzzleHttp\Psr7\parse_query; +use PHPUnit\Framework\TestCase; /** * Class ExceptionTest @@ -31,7 +31,7 @@ * @license See start of document * @link https://canihavesome.coffee/projects/theTVDbAPI */ -class ExceptionTest extends BaseUnitTest +class ExceptionTest extends TestCase { diff --git a/tests/Model/EpisodeTest.php b/tests/Model/EpisodeTest.php index 38dcd99..e5a068d 100644 --- a/tests/Model/EpisodeTest.php +++ b/tests/Model/EpisodeTest.php @@ -17,7 +17,7 @@ namespace CanIHaveSomeCoffee\TheTVDbAPI\Tests\Model; use CanIHaveSomeCoffee\TheTVDbAPI\Model\Episode; -use CanIHaveSomeCoffee\TheTVDbAPI\Tests\BaseUnitTest; +use PHPUnit\Framework\TestCase; /** * Class EpisodeTest @@ -28,23 +28,23 @@ * @license See start of document * @link https://canihavesome.coffee/projects/theTVDbAPI */ -class EpisodeTest extends BaseUnitTest +class EpisodeTest extends TestCase { public function testDirectorCreation() { $director = 'Foo Bar Baz'; $episode = new Episode(); - static::assertAttributeCount(0, 'directors', $episode); + static::assertEquals(0, sizeof($episode->directors)); $episode->setDirector($director); - static::assertAttributeCount(1, 'directors', $episode); - static::assertAttributeContains($director, 'directors', $episode); + static::assertEquals(1, sizeof($episode->directors)); + static::assertContains($director, $episode->directors); } public function testDirectorRetrieval() { $director = 'Foo Bar Baz'; $episode = new Episode(); - static::assertAttributeCount(0, 'directors', $episode); + static::assertEquals(0, sizeof($episode->directors)); static::assertEquals('', $episode->getDirector()); $episode->directors[] = $director; static::assertEquals($director, $episode->getDirector()); diff --git a/tests/Model/JSONErrorTest.php b/tests/Model/JSONErrorTest.php index de89076..881acd8 100644 --- a/tests/Model/JSONErrorTest.php +++ b/tests/Model/JSONErrorTest.php @@ -17,7 +17,7 @@ namespace CanIHaveSomeCoffee\TheTVDbAPI\Tests\Model; use CanIHaveSomeCoffee\TheTVDbAPI\Model\JSONError; -use CanIHaveSomeCoffee\TheTVDbAPI\Tests\BaseUnitTest; +use PHPUnit\Framework\TestCase; /** * Class JSONErrorTest @@ -28,7 +28,7 @@ * @license See start of document * @link https://canihavesome.coffee/projects/theTVDbAPI */ -class JSONErrorTest extends BaseUnitTest +class JSONErrorTest extends TestCase { public function testDataRetrieval() { diff --git a/tests/Model/PaginatedResultsTest.php b/tests/Model/PaginatedResultsTest.php index c8f4bc8..43e0820 100644 --- a/tests/Model/PaginatedResultsTest.php +++ b/tests/Model/PaginatedResultsTest.php @@ -17,7 +17,7 @@ namespace CanIHaveSomeCoffee\TheTVDbAPI\Tests\Model; use CanIHaveSomeCoffee\TheTVDbAPI\Model\PaginatedResults; -use CanIHaveSomeCoffee\TheTVDbAPI\Tests\BaseUnitTest; +use PHPUnit\Framework\TestCase; /** * Class PaginatedResultsTest @@ -28,17 +28,8 @@ * @license See start of document * @link https://canihavesome.coffee/projects/theTVDbAPI */ -class PaginatedResultsTest extends BaseUnitTest +class PaginatedResultsTest extends TestCase { - public function testCreation() - { - $data = ['foo' => 'bar', 'baz' => 'foo']; - $links = ['previous' => 0, 'next' => 2, 'first' => 0, 'last' => 1337]; - $instance = new PaginatedResults($data, $links); - static::assertAttributeSame($data, 'data', $instance); - static::assertAttributeSame($links, 'links', $instance); - } - public function testRetrieveData() { $data = ['foo' => 'bar', 'baz' => 'foo']; diff --git a/tests/Model/RatingTest.php b/tests/Model/RatingTest.php index caa7292..5596334 100644 --- a/tests/Model/RatingTest.php +++ b/tests/Model/RatingTest.php @@ -17,7 +17,6 @@ namespace CanIHaveSomeCoffee\TheTVDbAPI\Tests\Model; use CanIHaveSomeCoffee\TheTVDbAPI\Model\Rating; -use CanIHaveSomeCoffee\TheTVDbAPI\Tests\BaseUnitTest; use InvalidArgumentException; use PHPUnit\Framework\TestCase; @@ -30,7 +29,7 @@ * @license See start of document * @link https://canihavesome.coffee/projects/theTVDbAPI */ -class RatingTest extends BaseUnitTest +class RatingTest extends TestCase { public function testIsValidRatingType() { diff --git a/tests/MultiLanguageWrapper/ClassValidatorTest.php b/tests/MultiLanguageWrapper/ClassValidatorTest.php index 97464bc..5aabde9 100644 --- a/tests/MultiLanguageWrapper/ClassValidatorTest.php +++ b/tests/MultiLanguageWrapper/ClassValidatorTest.php @@ -21,12 +21,13 @@ * @license See start of document * @link https://canihavesome.coffee/projects/theTVDbAPI */ +declare(strict_types=1); namespace CanIHaveSomeCoffee\TheTVDbAPI\Tests\MultiLanguageWrapper; use CanIHaveSomeCoffee\TheTVDbAPI\Model\BasicEpisode; use CanIHaveSomeCoffee\TheTVDbAPI\MultiLanguageWrapper\ClassValidator; -use CanIHaveSomeCoffee\TheTVDbAPI\Tests\BaseUnitTest; +use PHPUnit\Framework\TestCase; /** * Class ClassValidatorTest @@ -37,7 +38,7 @@ * @license See start of document * @link https://canihavesome.coffee/projects/theTVDbAPI */ -class ClassValidatorTest extends BaseUnitTest +class ClassValidatorTest extends TestCase { /** * @var ClassValidator @@ -47,7 +48,7 @@ class ClassValidatorTest extends BaseUnitTest /** * {@inheritdoc} */ - public function setUp() + public function setUp(): void { $this->validator = new ClassValidator(); } diff --git a/tests/MultiLanguageWrapper/MultiLangFallbackGeneratorTest.php b/tests/MultiLanguageWrapper/MultiLangFallbackGeneratorTest.php index 5c6f1a9..6c473eb 100644 --- a/tests/MultiLanguageWrapper/MultiLangFallbackGeneratorTest.php +++ b/tests/MultiLanguageWrapper/MultiLangFallbackGeneratorTest.php @@ -28,7 +28,7 @@ use CanIHaveSomeCoffee\TheTVDbAPI\Model\BasicEpisode; use CanIHaveSomeCoffee\TheTVDbAPI\MultiLanguageWrapper\ClassValidator; use CanIHaveSomeCoffee\TheTVDbAPI\MultiLanguageWrapper\MultiLanguageFallbackGenerator; -use CanIHaveSomeCoffee\TheTVDbAPI\Tests\BaseUnitTest; +use PHPUnit\Framework\TestCase; /** * Class to test the MultiLanguageFallbackGenerator @@ -39,15 +39,8 @@ * @license See start of document * @link https://canihavesome.coffee/projects/theTVDbAPI */ -class MultiLangFallbackGeneratorTest extends BaseUnitTest +class MultiLangFallbackGeneratorTest extends TestCase { - public function testConstructor() { - $validator = new ClassValidator(); - $instance = new MultiLanguageFallbackGenerator($validator); - static::assertObjectHasAttribute('validator', $instance); - static::assertAttributeEquals($validator, 'validator', $instance); - } - public function testCreateWithNoMerge() { $languages = ['en']; $class = BasicEpisode::class; diff --git a/tests/MultiLanguageWrapper/Route/BaseRouteLanguageFallback.php b/tests/MultiLanguageWrapper/Route/BaseRouteLanguageFallback.php index fe5dcb1..2567731 100644 --- a/tests/MultiLanguageWrapper/Route/BaseRouteLanguageFallback.php +++ b/tests/MultiLanguageWrapper/Route/BaseRouteLanguageFallback.php @@ -18,7 +18,7 @@ use CanIHaveSomeCoffee\TheTVDbAPI\MultiLanguageWrapper\TheTVDbAPILanguageFallback; use CanIHaveSomeCoffee\TheTVDbAPI\Tests\Route\BaseRouteTest; -use PHPUnit_Framework_MockObject_MockObject; +use PHPUnit\Framework\MockObject\MockObject; /** * Class BaseRouteLanguageFallback @@ -34,11 +34,11 @@ class BaseRouteLanguageFallback extends BaseRouteTest /** * Mock for the parent of the route * - * @var PHPUnit_Framework_MockObject_MockObject + * @var MockObject */ protected $parent; - public function setUp() + public function setUp(): void { $this->parent = static::getMockBuilder(TheTVDbAPILanguageFallback::class)->getMock(); } diff --git a/tests/MultiLanguageWrapper/Route/SeriesRouteLanguageFallbackTest.php b/tests/MultiLanguageWrapper/Route/SeriesRouteLanguageFallbackTest.php index 34ea3b0..ba3c1ba 100644 --- a/tests/MultiLanguageWrapper/Route/SeriesRouteLanguageFallbackTest.php +++ b/tests/MultiLanguageWrapper/Route/SeriesRouteLanguageFallbackTest.php @@ -21,6 +21,7 @@ * @license See start of document * @link https://canihavesome.coffee/projects/theTVDbAPI */ +declare(strict_types=1); namespace CanIHaveSomeCoffee\TheTVDbAPI\Tests\MultiLanguageWrapper\Route; diff --git a/tests/MultiLanguageWrapper/TheTVDbAPILanguageFallbackTest.php b/tests/MultiLanguageWrapper/TheTVDbAPILanguageFallbackTest.php index 62b2350..4b80459 100644 --- a/tests/MultiLanguageWrapper/TheTVDbAPILanguageFallbackTest.php +++ b/tests/MultiLanguageWrapper/TheTVDbAPILanguageFallbackTest.php @@ -25,7 +25,6 @@ namespace CanIHaveSomeCoffee\TheTVDbAPI\Tests\MultiLanguageWrapper; -use CanIHaveSomeCoffee\TheTVDbAPI\MultiLanguageWrapper\ClassValidator; use CanIHaveSomeCoffee\TheTVDbAPI\MultiLanguageWrapper\MultiLanguageFallbackGenerator; use CanIHaveSomeCoffee\TheTVDbAPI\MultiLanguageWrapper\Route\EpisodesRouteLanguageFallback; use CanIHaveSomeCoffee\TheTVDbAPI\MultiLanguageWrapper\Route\SearchRouteLanguageFallback; @@ -38,8 +37,7 @@ use CanIHaveSomeCoffee\TheTVDbAPI\Route\SeriesRoute; use CanIHaveSomeCoffee\TheTVDbAPI\Route\UpdatesRoute; use CanIHaveSomeCoffee\TheTVDbAPI\Route\UsersRoute; -use CanIHaveSomeCoffee\TheTVDbAPI\Tests\BaseUnitTest; -use GuzzleHttp\Client; +use PHPUnit\Framework\TestCase; /** * Tests the LanguageFallBack class. @@ -50,21 +48,8 @@ * @license See start of document * @link https://canihavesome.coffee/projects/theTVDbAPI */ -class TheTVDbAPILanguageFallbackTest extends BaseUnitTest +class TheTVDbAPILanguageFallbackTest extends TestCase { - public function testConstructor() { - $validator_mock = $this->createMock(ClassValidator::class); - $client_mock = $this->createMock(Client::class); - $instance = new TheTVDbAPILanguageFallback($validator_mock, $client_mock); - static::assertAttributeEquals($client_mock, 'httpClient', $instance); - static::assertAttributeInstanceOf(MultiLanguageFallbackGenerator::class, 'generator', $instance); - static::assertAttributeHasEqualAttribute($validator_mock, 'validator', 'generator', $instance); - $instance = new TheTVDbAPILanguageFallback(null, $client_mock); - static::assertAttributeEquals($client_mock, 'httpClient', $instance); - static::assertAttributeInstanceOf(MultiLanguageFallbackGenerator::class, 'generator', $instance); - static::assertAttributeHasAttributeType(ClassValidator::class, 'validator', 'generator', $instance); - } - public function testGetGenerator() { $instance = new TheTVDbAPILanguageFallback(); static::assertInstanceOf(MultiLanguageFallbackGenerator::class, $instance->getGenerator()); diff --git a/tests/Route/BaseRouteTest.php b/tests/Route/BaseRouteTest.php index f22138d..494f612 100644 --- a/tests/Route/BaseRouteTest.php +++ b/tests/Route/BaseRouteTest.php @@ -16,9 +16,9 @@ namespace CanIHaveSomeCoffee\TheTVDbAPI\Tests\Route; -use CanIHaveSomeCoffee\TheTVDbAPI\Tests\BaseUnitTest; use CanIHaveSomeCoffee\TheTVDbAPI\TheTVDbAPI; -use PHPUnit_Framework_MockObject_MockObject; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; /** * Class BaseRouteTest @@ -29,16 +29,16 @@ * @license See start of document * @link https://canihavesome.coffee/projects/theTVDbAPI */ -class BaseRouteTest extends BaseUnitTest +class BaseRouteTest extends TestCase { /** * Mock for the parent of the route * - * @var PHPUnit_Framework_MockObject_MockObject + * @var MockObject */ protected $parent; - public function setUp() + public function setUp(): void { $this->parent = static::getMockBuilder(TheTVDbAPI::class)->getMock(); } diff --git a/tests/Route/RouteFactoryTest.php b/tests/Route/RouteFactoryTest.php index 3d642d4..fe0d217 100644 --- a/tests/Route/RouteFactoryTest.php +++ b/tests/Route/RouteFactoryTest.php @@ -18,8 +18,8 @@ use CanIHaveSomeCoffee\TheTVDbAPI\Route\AuthenticationRoute; use CanIHaveSomeCoffee\TheTVDbAPI\Route\RouteFactory; -use CanIHaveSomeCoffee\TheTVDbAPI\Tests\BaseUnitTest; -use PHPUnit_Framework_MockObject_MockObject; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; /** * Class RouteFactoryTest @@ -30,16 +30,16 @@ * @license See start of document * @link https://canihavesome.coffee/projects/theTVDbAPI */ -class RouteFactoryTest extends BaseUnitTest +class RouteFactoryTest extends TestCase { /** * Mock for the parent of the route * - * @var PHPUnit_Framework_MockObject_MockObject + * @var MockObject */ protected $parent; - public function setUp() + public function setUp(): void { $this->parent = static::getMockBuilder('CanIHaveSomeCoffee\TheTVDbAPI\TheTVDbAPIInterface')->getMock(); } diff --git a/tests/Route/SearchRouteTest.php b/tests/Route/SearchRouteTest.php index 3608d56..b81903f 100644 --- a/tests/Route/SearchRouteTest.php +++ b/tests/Route/SearchRouteTest.php @@ -37,6 +37,14 @@ public function testSearchInvalidSpecifier() $instance->search('invalid', 'foo'); } + /** + * Sets mock data defaults for tests. + * + * @param $return + * @param $options + * + * @return void + */ private function setMockData($return, $options) { $this->parent->method('performAPICallWithJsonResponse')->willReturn($return); diff --git a/tests/Route/UpdatesRouteTest.php b/tests/Route/UpdatesRouteTest.php index 5a5d5e2..f546f8f 100644 --- a/tests/Route/UpdatesRouteTest.php +++ b/tests/Route/UpdatesRouteTest.php @@ -16,7 +16,6 @@ namespace CanIHaveSomeCoffee\TheTVDbAPI\Tests\Route; -use CanIHaveSomeCoffee\TheTVDbAPI\Model\BasicSeries; use CanIHaveSomeCoffee\TheTVDbAPI\Model\UpdateInfo; use CanIHaveSomeCoffee\TheTVDbAPI\Route\UpdatesRoute; use DateTime; diff --git a/tests/TheTVDbAPIDataTest.php b/tests/TheTVDbAPIDataTest.php index 0d27f79..1694541 100644 --- a/tests/TheTVDbAPIDataTest.php +++ b/tests/TheTVDbAPIDataTest.php @@ -17,6 +17,7 @@ namespace CanIHaveSomeCoffee\TheTVDbAPI\Tests; use CanIHaveSomeCoffee\TheTVDbAPI\TheTVDbAPI; +use PHPUnit\Framework\TestCase; /** * Class TheTVDbAPIDataTest tests with real data from the live API. @@ -27,7 +28,7 @@ * @license See start of document * @link https://canihavesome.coffee/projects/theTVDbAPI */ -class TheTVDbAPIDataTest extends BaseUnitTest +class TheTVDbAPIDataTest extends TestCase { /** @type TheTVDbAPI */ protected $theTVDbAPI; @@ -35,7 +36,7 @@ class TheTVDbAPIDataTest extends BaseUnitTest /** * {@inheritdoc} */ - public function setUp() + public function setUp(): void { // Set up an authenticated client $this->theTVDbAPI = new TheTVDbAPI(); diff --git a/tests/TheTVDbAPITest.php b/tests/TheTVDbAPITest.php index 4b96f43..66455da 100644 --- a/tests/TheTVDbAPITest.php +++ b/tests/TheTVDbAPITest.php @@ -35,6 +35,7 @@ use CanIHaveSomeCoffee\TheTVDbAPI\Route\UpdatesRoute; use CanIHaveSomeCoffee\TheTVDbAPI\Route\UsersRoute; use CanIHaveSomeCoffee\TheTVDbAPI\TheTVDbAPI; +use PHPUnit\Framework\TestCase; /** * Class TheTVDbAPITest tests with mock objects, which do not require a live API key. @@ -45,9 +46,11 @@ * @license See start of document * @link https://canihavesome.coffee/projects/theTVDbAPI */ -class TheTVDbAPITest extends BaseUnitTest +class TheTVDbAPITest extends TestCase { /** + * @param array $queue + * * @return Client */ private function createClientWithMockHandler(array $queue) @@ -91,35 +94,6 @@ public function testRouteInstanceTypes() static::assertInstanceOf(SeriesRoute::class, $instance->series()); } - public function testInstanceInitialization() - { - $client = new Client( - [ - 'base_uri' => TheTVDbAPI::API_BASE_URI, - 'verify' => false, - 'headers' => ['Content-Type' => 'application/json'] - ] - ); - $test_instance = new TheTVDbAPI($client); - static::assertAttributeSame($client, 'httpClient', $test_instance); - } - - public function testSetToken() - { - $token = "ABC"; - $test_instance = new TheTVDbAPI(); - $test_instance->setToken($token); - static::assertAttributeSame($token, 'token', $test_instance); - } - - public function setSetAcceptedLanguages() - { - $languages = ["nl", "en"]; - $test_instance = new TheTVDbAPI(); - $test_instance->setAcceptedLanguages($languages); - static::assertAttributeSame($languages, 'languages', $test_instance); - } - public function testRetrieveAcceptedLanguages() { $languages = ["nl", "en"]; @@ -133,7 +107,6 @@ public function testSetVersion() $version = "1.33.7"; $test_instance = new TheTVDbAPI(); $test_instance->setVersion($version); - static::assertAttributeSame($version, 'version', $test_instance); // Set wrong version static::expectException(InvalidArgumentException::class); static::expectExceptionMessage('Version does not match pattern x.y.z (where x, y, z are numbers)'); diff --git a/tests/bootstrap.php b/tests/bootstrap.php index b411d15..34c52d5 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -30,6 +30,5 @@ throw new Exception('Could not find Composer\'s autoload.php file.'); } -require_once __DIR__.'/BaseUnitTest.php'; require_once __DIR__.'/Route/BaseRouteTest.php'; require_once __DIR__.'/MultiLanguageWrapper/Route/BaseRouteLanguageFallback.php';