From 540f569034cd3901c88969743a4b8d2b63863863 Mon Sep 17 00:00:00 2001 From: frederick tyteca Date: Wed, 27 Nov 2019 17:42:30 +0100 Subject: [PATCH 1/6] getVideoInfo now has optional params too. Test refactoring to be used with phpunit latest version (8) --- .gitignore | 2 + composer.json | 2 +- composer.lock | 840 ++++++++++++++++++++++++++---------------- src/Youtube.php | 13 +- tests/YoutubeTest.php | 89 +++-- 5 files changed, 577 insertions(+), 369 deletions(-) diff --git a/.gitignore b/.gitignore index 857767d..f45fec6 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ .LSOverride Icon +# PhpUnit cache +.phpunit.result.cache # Thumbnails ._* diff --git a/composer.json b/composer.json index e1b8e40..c373d35 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "ext-curl": "*" }, "require-dev":{ - "phpunit/phpunit": "^4.5 || ^5.0.5" + "phpunit/phpunit": "^8" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 5470468..ecb3c74 100644 --- a/composer.lock +++ b/composer.lock @@ -1,40 +1,42 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "cac1f58ad668691be5389ffa29e006c9", + "content-hash": "1c12fe4503cb4067c37397aa28a51ddd", "packages": [], "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.0.5", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1", + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1", "shasum": "" }, "require": { - "php": ">=5.3,<8.0-DEV" + "php": "^7.1" }, "require-dev": { - "athletic/athletic": "~0.1.8", + "doctrine/coding-standard": "^6.0", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" + "phpbench/phpbench": "^0.13", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-shim": "^0.11", + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -54,46 +56,52 @@ } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", "keywords": [ "constructor", "instantiate" ], - "time": "2015-06-14T21:17:01+00:00" + "time": "2019-10-21T16:45:58+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.5.5", + "version": "1.9.3", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "399c1f9781e222f6eb6cc238796f5200d1b7f108" + "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/399c1f9781e222f6eb6cc238796f5200d1b7f108", - "reference": "399c1f9781e222f6eb6cc238796f5200d1b7f108", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/007c053ae6f31bba39dfa19a7726f56e9763bbea", + "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": "^7.1" + }, + "replace": { + "myclabs/deep-copy": "self.version" }, "require-dev": { - "doctrine/collections": "1.*", - "phpunit/phpunit": "~4.1" + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" }, "type": "library", "autoload": { "psr-4": { "DeepCopy\\": "src/DeepCopy/" - } + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "description": "Create deep copies (clones) of your objects", - "homepage": "https://github.com/myclabs/DeepCopy", "keywords": [ "clone", "copy", @@ -101,39 +109,139 @@ "object", "object graph" ], - "time": "2016-10-31T17:19:45+00:00" + "time": "2019-08-09T12:45:53+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^2.0", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2018-07-08T19:23:20+00:00" + }, + { + "name": "phar-io/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2018-07-08T19:19:57+00:00" }, { "name": "phpdocumentor/reflection-common", - "version": "1.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" + "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a", + "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a", "shasum": "" }, "require": { - "php": ">=5.5" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^4.6" + "phpunit/phpunit": "~6" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] + "phpDocumentor\\Reflection\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -155,33 +263,39 @@ "reflection", "static analysis" ], - "time": "2015-12-27T11:43:31+00:00" + "time": "2018-08-07T13:53:10+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "3.1.1", + "version": "4.3.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" + "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/b83ff7cfcfee7827e1e78b637a5904fe6a96698e", + "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e", "shasum": "" }, "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.2.0", + "php": "^7.0", + "phpdocumentor/reflection-common": "^1.0.0 || ^2.0.0", + "phpdocumentor/type-resolver": "~0.4 || ^1.0.0", "webmozart/assert": "^1.0" }, "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^4.4" + "doctrine/instantiator": "^1.0.5", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, "autoload": { "psr-4": { "phpDocumentor\\Reflection\\": [ @@ -200,41 +314,40 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2016-09-30T07:12:33+00:00" + "time": "2019-09-12T14:27:41+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.2.1", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb" + "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", + "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", "shasum": "" }, "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0" + "php": "^7.1", + "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" + "ext-tokenizer": "^7.1", + "mockery/mockery": "~1", + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -247,42 +360,43 @@ "email": "me@mikevanriel.com" } ], - "time": "2016-11-25T06:54:22+00:00" + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "time": "2019-08-22T18:11:29+00:00" }, { "name": "phpspec/prophecy", - "version": "v1.6.2", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "6c52c2722f8460122f96f86346600e1077ce22cb" + "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/6c52c2722f8460122f96f86346600e1077ce22cb", - "reference": "6c52c2722f8460122f96f86346600e1077ce22cb", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/f6811d96d97bdf400077a0cc100ae56aa32b9203", + "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", - "sebastian/comparator": "^1.1", - "sebastian/recursion-context": "^1.0|^2.0" + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", + "sebastian/comparator": "^1.1|^2.0|^3.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, "require-dev": { - "phpspec/phpspec": "^2.0", - "phpunit/phpunit": "^4.8 || ^5.6.5" + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6.x-dev" + "dev-master": "1.8.x-dev" } }, "autoload": { - "psr-0": { - "Prophecy\\": "src/" + "psr-4": { + "Prophecy\\": "src/Prophecy" } }, "notification-url": "https://packagist.org/downloads/", @@ -310,44 +424,44 @@ "spy", "stub" ], - "time": "2016-11-21T14:58:47+00:00" + "time": "2019-10-03T11:07:50+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "4.0.4", + "version": "7.0.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "c14196e64a78570034afd0b7a9f3757ba71c2a0a" + "reference": "f1884187926fbb755a9aaf0b3836ad3165b478bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c14196e64a78570034afd0b7a9f3757ba71c2a0a", - "reference": "c14196e64a78570034afd0b7a9f3757ba71c2a0a", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f1884187926fbb755a9aaf0b3836ad3165b478bf", + "reference": "f1884187926fbb755a9aaf0b3836ad3165b478bf", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "^1.4.2", - "sebastian/code-unit-reverse-lookup": "~1.0", - "sebastian/environment": "^1.3.2 || ^2.0", - "sebastian/version": "~1.0|~2.0" + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.2", + "phpunit/php-file-iterator": "^2.0.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^3.1.1", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^4.2.2", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1.3" }, "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "^5.4" + "phpunit/phpunit": "^8.2.2" }, "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.4.0", - "ext-xmlwriter": "*" + "ext-xdebug": "^2.7.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0.x-dev" + "dev-master": "7.0-dev" } }, "autoload": { @@ -362,7 +476,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -373,29 +487,32 @@ "testing", "xunit" ], - "time": "2016-12-20T15:22:42+00:00" + "time": "2019-11-20T13:55:58+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.2", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" + "reference": "050bedf145a257b1ff02746c31894800e5122946" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", + "reference": "050bedf145a257b1ff02746c31894800e5122946", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -410,7 +527,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -420,7 +537,7 @@ "filesystem", "iterator" ], - "time": "2016-10-03T07:40:28+00:00" + "time": "2018-09-13T20:33:42+00:00" }, { "name": "phpunit/php-text-template", @@ -465,25 +582,30 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.8", + "version": "2.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "~4|~5" + "phpunit/phpunit": "^7.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -496,7 +618,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -505,33 +627,33 @@ "keywords": [ "timer" ], - "time": "2016-05-12T18:03:57+00:00" + "time": "2019-06-07T04:22:29+00:00" }, { "name": "phpunit/php-token-stream", - "version": "1.4.9", + "version": "3.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b" + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3b402f65a4cc90abf6e1104e388b896ce209631b", - "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=5.3.3" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -554,55 +676,56 @@ "keywords": [ "tokenizer" ], - "time": "2016-11-15T14:06:22+00:00" + "time": "2019-09-17T06:23:10+00:00" }, { "name": "phpunit/phpunit", - "version": "5.7.5", + "version": "8.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "50fd2be8f3e23e91da825f36f08e5f9633076ffe" + "reference": "67f9e35bffc0dd52d55d565ddbe4230454fd6a4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/50fd2be8f3e23e91da825f36f08e5f9633076ffe", - "reference": "50fd2be8f3e23e91da825f36f08e5f9633076ffe", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/67f9e35bffc0dd52d55d565ddbe4230454fd6a4e", + "reference": "67f9e35bffc0dd52d55d565ddbe4230454fd6a4e", "shasum": "" }, "require": { + "doctrine/instantiator": "^1.2.0", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "~1.3", - "php": "^5.6 || ^7.0", - "phpspec/prophecy": "^1.6.2", - "phpunit/php-code-coverage": "^4.0.3", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "^3.2", - "sebastian/comparator": "~1.2.2", - "sebastian/diff": "~1.2", - "sebastian/environment": "^1.3.4 || ^2.0", - "sebastian/exporter": "~2.0", - "sebastian/global-state": "^1.0 || ^2.0", - "sebastian/object-enumerator": "~2.0", - "sebastian/resource-operations": "~1.0", - "sebastian/version": "~1.0|~2.0", - "symfony/yaml": "~2.1|~3.0" - }, - "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2" + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.9.1", + "phar-io/manifest": "^1.0.3", + "phar-io/version": "^2.0.1", + "php": "^7.2", + "phpspec/prophecy": "^1.8.1", + "phpunit/php-code-coverage": "^7.0.7", + "phpunit/php-file-iterator": "^2.0.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.1.2", + "sebastian/comparator": "^3.0.2", + "sebastian/diff": "^3.0.2", + "sebastian/environment": "^4.2.2", + "sebastian/exporter": "^3.1.1", + "sebastian/global-state": "^3.0.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^2.0.1", + "sebastian/type": "^1.1.3", + "sebastian/version": "^2.0.1" }, "require-dev": { "ext-pdo": "*" }, "suggest": { + "ext-soap": "*", "ext-xdebug": "*", - "phpunit/php-invoker": "~1.1" + "phpunit/php-invoker": "^2.0.0" }, "bin": [ "phpunit" @@ -610,7 +733,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.7.x-dev" + "dev-master": "8.4-dev" } }, "autoload": { @@ -636,86 +759,27 @@ "testing", "xunit" ], - "time": "2016-12-28T07:18:51+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "3.4.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "3ab72b65b39b491e0c011e2e09bb2206c2aa8e24" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/3ab72b65b39b491e0c011e2e09bb2206c2aa8e24", - "reference": "3ab72b65b39b491e0c011e2e09bb2206c2aa8e24", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.6 || ^7.0", - "phpunit/php-text-template": "^1.2", - "sebastian/exporter": "^1.2 || ^2.0" - }, - "conflict": { - "phpunit/phpunit": "<5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.4" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2016-12-08T20:27:08+00:00" + "time": "2019-11-06T09:42:23+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe" + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/c36f5e7cfce482fde5bf8d10d41a53591e0198fe", - "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", "shasum": "" }, "require": { - "php": ">=5.6" + "php": "^5.6 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~5" + "phpunit/phpunit": "^5.7 || ^6.0" }, "type": "library", "extra": { @@ -740,34 +804,34 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2016-02-13T06:45:14+00:00" + "time": "2017-03-04T06:30:41+00:00" }, { "name": "sebastian/comparator", - "version": "1.2.2", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "6a1ed12e8b2409076ab22e3897126211ff8b1f7f" + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/6a1ed12e8b2409076ab22e3897126211ff8b1f7f", - "reference": "6a1ed12e8b2409076ab22e3897126211ff8b1f7f", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" + "php": "^7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -798,38 +862,39 @@ } ], "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", + "homepage": "https://github.com/sebastianbergmann/comparator", "keywords": [ "comparator", "compare", "equality" ], - "time": "2016-11-19T09:18:40+00:00" + "time": "2018-07-12T15:12:46+00:00" }, { "name": "sebastian/diff", - "version": "1.4.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^7.5 || ^8.0", + "symfony/process": "^2 || ^3.3 || ^4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -854,34 +919,40 @@ "description": "Diff implementation", "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ - "diff" + "diff", + "udiff", + "unidiff", + "unified diff" ], - "time": "2015-12-08T07:14:41+00:00" + "time": "2019-02-04T06:01:07+00:00" }, { "name": "sebastian/environment", - "version": "2.0.0", + "version": "4.2.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^5.0" + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "4.2-dev" } }, "autoload": { @@ -906,34 +977,34 @@ "environment", "hhvm" ], - "time": "2016-11-26T07:53:53+00:00" + "time": "2019-11-20T08:46:58+00:00" }, { "name": "sebastian/exporter", - "version": "2.0.0", + "version": "3.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~2.0" + "php": "^7.0", + "sebastian/recursion-context": "^3.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.1.x-dev" } }, "autoload": { @@ -946,6 +1017,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -954,17 +1029,13 @@ "name": "Volker Dusch", "email": "github@wallbash.com" }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, { "name": "Adam Harvey", "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" } ], "description": "Provides the functionality to export PHP variables for visualization", @@ -973,27 +1044,30 @@ "export", "exporter" ], - "time": "2016-11-19T08:54:04+00:00" + "time": "2019-09-14T09:02:43+00:00" }, { "name": "sebastian/global-state", - "version": "1.1.1", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", + "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.2", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "ext-dom": "*", + "phpunit/phpunit": "^8.0" }, "suggest": { "ext-uopz": "*" @@ -1001,7 +1075,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1024,33 +1098,34 @@ "keywords": [ "global state" ], - "time": "2015-10-12T03:26:01+00:00" + "time": "2019-02-01T05:30:01+00:00" }, { "name": "sebastian/object-enumerator", - "version": "2.0.0", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35" + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35", - "reference": "96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", "shasum": "" }, "require": { - "php": ">=5.6", - "sebastian/recursion-context": "~2.0" + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "~5" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -1070,32 +1145,77 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2016-11-19T07:35:10+00:00" + "time": "2017-08-03T12:35:26+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2017-03-29T09:07:27+00:00" }, { "name": "sebastian/recursion-context", - "version": "2.0.0", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -1123,29 +1243,29 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-11-19T07:33:16+00:00" + "time": "2017-03-03T06:23:57+00:00" }, { "name": "sebastian/resource-operations", - "version": "1.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", "shasum": "" }, "require": { - "php": ">=5.6.0" + "php": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1165,7 +1285,53 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" + "time": "2018-10-04T04:07:39+00:00" + }, + { + "name": "sebastian/type", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/3aaaa15fa71d27650d62a948be022fe3b48541a3", + "reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3", + "shasum": "" + }, + "require": { + "php": "^7.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "time": "2019-07-02T08:10:15+00:00" }, { "name": "sebastian/version", @@ -1211,40 +1377,37 @@ "time": "2016-10-03T07:35:21+00:00" }, { - "name": "symfony/yaml", - "version": "v3.2.1", + "name": "symfony/polyfill-ctype", + "version": "v1.12.0", "source": { "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "a7095af4b97a0955f85c8989106c249fa649011f" + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "550ebaac289296ce228a706d0867afc34687e3f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/a7095af4b97a0955f85c8989106c249fa649011f", - "reference": "a7095af4b97a0955f85c8989106c249fa649011f", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/550ebaac289296ce228a706d0867afc34687e3f4", + "reference": "550ebaac289296ce228a706d0867afc34687e3f4", "shasum": "" }, "require": { - "php": ">=5.5.9" - }, - "require-dev": { - "symfony/console": "~2.8|~3.0" + "php": ">=5.3.3" }, "suggest": { - "symfony/console": "For validating YAML files using the lint command" + "ext-ctype": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "1.12-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Yaml\\": "" + "Symfony\\Polyfill\\Ctype\\": "" }, - "exclude-from-classmap": [ - "/Tests/" + "files": [ + "bootstrap.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1253,45 +1416,89 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Yaml Component", + "description": "Symfony polyfill for ctype functions", "homepage": "https://symfony.com", - "time": "2016-12-10T10:07:06+00:00" + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2019-08-06T08:03:45+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "time": "2019-06-13T22:48:21+00:00" }, { "name": "webmozart/assert", - "version": "1.2.0", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" + "reference": "573381c0a64f155a0d9a23f4b0c797194805b925" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", + "url": "https://api.github.com/repos/webmozart/assert/zipball/573381c0a64f155a0d9a23f4b0c797194805b925", + "reference": "573381c0a64f155a0d9a23f4b0c797194805b925", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^5.3.3 || ^7.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "vimeo/psalm": "<3.6.0" }, "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" + "phpunit/phpunit": "^4.8.36 || ^7.5.13" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -1313,7 +1520,7 @@ "check", "validate" ], - "time": "2016-11-23T20:04:58+00:00" + "time": "2019-11-24T13:36:37+00:00" } ], "aliases": [], @@ -1322,7 +1529,8 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=5.3" + "php": ">=5.3", + "ext-curl": "*" }, "platform-dev": [] } diff --git a/src/Youtube.php b/src/Youtube.php index 6c1fe0c..8431d22 100644 --- a/src/Youtube.php +++ b/src/Youtube.php @@ -133,13 +133,16 @@ public function setReferer($referer) * @return \StdClass * @throws \Exception */ - public function getVideoInfo($vId) + public function getVideoInfo($vId, $optionalParams=[]) { $API_URL = $this->getApi('videos.list'); $params = array( 'id' => $vId, 'part' => 'id, snippet, contentDetails, player, statistics, status' ); + if (count($optionalParams)) { + $params = array_merge($params, $optionalParams); + } $apiData = $this->api_get($API_URL, $params); return $this->decodeSingle($apiData); @@ -485,7 +488,7 @@ public static function parseVIdFromURL($youtube_url) } if (empty($videoId)) { - throw new \Exception('The supplied URL does not look like a Youtube URL'); + throw new \InvalidArgumentException('The supplied URL does not look like a Youtube URL'); } return $videoId; @@ -502,7 +505,7 @@ public static function parseVIdFromURL($youtube_url) public function getChannelFromURL($youtube_url) { if (strpos($youtube_url, 'youtube.com') === false) { - throw new \Exception('The supplied URL does not look like a Youtube URL'); + throw new \InvalidArgumentException('The supplied URL does not look like a Youtube URL'); } $path = static::_parse_url_path($youtube_url); @@ -515,7 +518,7 @@ public function getChannelFromURL($youtube_url) $username = $segments[count($segments) - 1]; $channel = $this->getChannelByName($username); } else { - throw new \Exception('The supplied URL does not look like a Youtube Channel URL'); + throw new \InvalidArgumentException('The supplied URL does not look like a Youtube Channel URL'); } return $channel; @@ -634,7 +637,7 @@ public function api_get($url, $params) curl_setopt($tuCurl, CURLOPT_RETURNTRANSFER, 1); $tuData = curl_exec($tuCurl); if (curl_errno($tuCurl)) { - throw new \Exception('Curl Error : ' . curl_error($tuCurl), curl_errno($tuCurl)); + throw new \InvalidArgumentException('Curl Error : ' . curl_error($tuCurl), curl_errno($tuCurl)); } return $tuData; } diff --git a/tests/YoutubeTest.php b/tests/YoutubeTest.php index 7c3d8a4..411296c 100644 --- a/tests/YoutubeTest.php +++ b/tests/YoutubeTest.php @@ -4,6 +4,8 @@ use Madcoda\Youtube\Youtube; +use PHPUnit\Framework\TestCase; + /** * Class YoutubeTest * @@ -11,7 +13,7 @@ * @package Youtube * @author Jason Leung */ -class YoutubeTest extends \PHPUnit_Framework_TestCase +class YoutubeTest extends TestCase { /** * @var Youtube @@ -20,7 +22,7 @@ class YoutubeTest extends \PHPUnit_Framework_TestCase protected $youtube; protected $optionParams; - public function setUp() + public function setUp(): void { // !!!!! DO NOT USE THIS API KEY FOR PRODUCTION USE !!!!! */ $TEST_API_KEY = 'AIzaSyDlNBnbhP7G9z_8qunELCJ8012PP3t_c1o'; @@ -30,11 +32,11 @@ public function setUp() 'referer' => 'fake-refer', 'apis' => array( 'videos.list' => 'https://www.googleapis.com/youtube/v3/videos', - 'search.list'=> 'https://www.googleapis.com/youtube/v3/search', - 'channels.list'=> 'https://www.googleapis.com/youtube/v3/channels', - 'playlists.list'=> 'https://www.googleapis.com/youtube/v3/playlists', - 'playlistItems.list'=> 'https://www.googleapis.com/youtube/v3/playlistItems', - 'activities'=> 'https://www.googleapis.com/youtube/v3/activities', + 'search.list' => 'https://www.googleapis.com/youtube/v3/search', + 'channels.list' => 'https://www.googleapis.com/youtube/v3/channels', + 'playlists.list' => 'https://www.googleapis.com/youtube/v3/playlists', + 'playlistItems.list' => 'https://www.googleapis.com/youtube/v3/playlistItems', + 'activities' => 'https://www.googleapis.com/youtube/v3/activities', ) ); $this->youtube = new Youtube($params); @@ -43,7 +45,7 @@ public function setUp() ); } - public function tearDown() + public function tearDown(): void { $this->youtube = null; $this->optionParams = null; @@ -57,33 +59,43 @@ public function MalFormURLProvider() ); } - /** - * @expectedException \InvalidArgumentException - */ public function testConstructorFail() { + $this->expectException(\InvalidArgumentException::class); $this->youtube = new Youtube(array()); } - /** - * @expectedException \InvalidArgumentException - */ public function testConstructorFail2() { + $this->expectException(\InvalidArgumentException::class); $this->youtube = new Youtube('FAKE API KEY'); } - /** - * @expectedException \Exception - * @expectedExceptionMessage Error 400 Bad Request : keyInvalid - */ public function testInvalidApiKey() { + $this->expectException(\Exception::class); + $this->expectExceptionMessage('Error 400 Bad Request : keyInvalid'); $this->youtube = new Youtube(array('key' => 'nonsense')); $vID = 'rie-hPVJ7Sw'; $this->youtube->getVideoInfo($vID); } + public function testGetVideoInfoWithParams() + { + $vID = 'rie-hPVJ7Sw'; + $response = $this->youtube->getVideoInfo($vID, ['part' => 'id, snippet, status']); + + $this->assertEquals($vID, $response->id); + $this->assertNotNull('response'); + $this->assertEquals('youtube#video', $response->kind); + //add all these assertions here in case the api is changed, + //we can detect it instantly + $this->assertObjectHasAttribute('status', $response); + $this->assertObjectHasAttribute('snippet', $response); + $this->assertObjectNotHasAttribute('contentDetails', $response); + $this->assertObjectNotHasAttribute('statistics', $response); + } + public function testGetVideoInfo() { $vID = 'rie-hPVJ7Sw'; @@ -104,8 +116,8 @@ public function testGetVideosInfo() { $vID = array('rie-hPVJ7Sw', 'lRRk97FYLJM'); $response = $this->youtube->getVideosInfo($vID); - $this->assertInternalType('array', $response); - + $this->assertIsArray($response); + foreach ($response as $value) { $this->assertContains($value->id, $vID); $this->assertEquals('youtube#video', $value->kind); @@ -170,12 +182,9 @@ public function testSearchAdvanced() $this->assertEquals('youtube#searchListResponse', $response['info']['kind']); } - /** - * - * @expectedException \InvalidArgumentException - */ public function testSearchAdvancedWithException() { + $this->expectException(\InvalidArgumentException::class); $limit = rand(3, 10); $params = array(); $response = $this->youtube->searchAdvanced($params, true); @@ -280,12 +289,9 @@ public function testGetPlaylistItemsByPlaylistIdAdvanced() $this->assertEquals('youtube#playlistItemListResponse', $response['info']['kind']); } - /** - * - * @expectedException \InvalidArgumentException - */ public function testGetPlaylistItemsByPlaylistIdAdvancedWithException() { + $this->expectException(\InvalidArgumentException::class); $response = $this->youtube->getPlaylistItemsByPlaylistIdAdvanced(null, true); } @@ -310,18 +316,16 @@ public function testParseVIdFromURLShort() /** * * @dataProvider MalFormURLProvider - * @expectedException \Exception */ public function testParseVIdFromURLException($url) { + $this->expectException(\InvalidArgumentException::class); $vId = $this->youtube->parseVIdFromURL($url); } - /** - * @expectedException \Exception - */ public function testParseVIdException() { + $this->expectException(\InvalidArgumentException::class); $vId = $this->youtube->parseVIdFromURL('http://www.facebook.com'); } @@ -334,11 +338,9 @@ public function testGetActivitiesByChannelId() $this->assertEquals('Google', $response[0]->snippet->channelTitle); } - /** - * @expectedException \InvalidArgumentException - */ public function testGetActivitiesByChannelIdException() { + $this->expectException(\InvalidArgumentException::class); $channelId = ''; $response = $this->youtube->getActivitiesByChannelId($channelId); } @@ -359,27 +361,22 @@ public function testGetChannelFromURLWithChannel() $this->assertEquals('PHPoC', $channel->snippet->title); } - /** - * @expectedException \Exception - */ public function testGetChannelFromURLWithNoYoutubeUrlException() { + $this->expectException(\InvalidArgumentException::class); $channel = $this->youtube->getChannelFromURL('https://google.com'); } - /** - * @expectedException \Exception - */ public function testGetChannelFromURLWithInvalidYoutubeUrlException() { + $this->expectException(\InvalidArgumentException::class); $channel = $this->youtube->getChannelFromURL('https://www.youtube.com/invalid/UCyNF0DijeiZ8jhc_xlVa4Vg'); } - /** - * @expectedException \Exception - */ + public function testDecodeListWithException() { + $this->expectException(\Exception::class); $GOOGLE_ZEITGEIST_PLAYLIST = 'PL590L5WQmH8fJ54F369BLDSqIwcs-TCfs'; $params = array( 'playlistId' => $GOOGLE_ZEITGEIST_PLAYLIST @@ -402,11 +399,9 @@ public function testDecodeListWithFalse() $this->assertFalse($response); } - /** - * @expectedException \Exception - */ public function testApi_getWithException() { + $this->expectException(\InvalidArgumentException::class); $limit = rand(3, 10); $params = array( 'q' => 'Android', From 332b61a25425a619c92888035d3f56bbe54b214d Mon Sep 17 00:00:00 2001 From: frederick tyteca Date: Wed, 27 Nov 2019 17:55:12 +0100 Subject: [PATCH 2/6] optionalParams is now an empty array (IDE compliancy) --- src/Youtube.php | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/Youtube.php b/src/Youtube.php index 6c1fe0c..62694d2 100644 --- a/src/Youtube.php +++ b/src/Youtube.php @@ -133,13 +133,16 @@ public function setReferer($referer) * @return \StdClass * @throws \Exception */ - public function getVideoInfo($vId) + public function getVideoInfo($vId, $optionalParams = []) { $API_URL = $this->getApi('videos.list'); $params = array( 'id' => $vId, 'part' => 'id, snippet, contentDetails, player, statistics, status' ); + if (count($optionalParams)) { + $params = array_merge($params, $optionalParams); + } $apiData = $this->api_get($API_URL, $params); return $this->decodeSingle($apiData); @@ -304,14 +307,14 @@ public function paginateResults($params, $token = null) * @return \StdClass * @throws \Exception */ - public function getChannelByName($username, $optionalParams = false) + public function getChannelByName($username, $optionalParams = []) { $API_URL = $this->getApi('channels.list'); $params = array( 'forUsername' => $username, 'part' => 'id,snippet,contentDetails,statistics,invideoPromotion' ); - if ($optionalParams) { + if (count($optionalParams)) { $params = array_merge($params, $optionalParams); } $apiData = $this->api_get($API_URL, $params); @@ -324,14 +327,14 @@ public function getChannelByName($username, $optionalParams = false) * @return \StdClass * @throws \Exception */ - public function getChannelById($id, $optionalParams = false) + public function getChannelById($id, $optionalParams = []) { $API_URL = $this->getApi('channels.list'); $params = array( 'id' => $id, 'part' => 'id,snippet,contentDetails,statistics,invideoPromotion' ); - if ($optionalParams) { + if (count($optionalParams)) { $params = array_merge($params, $optionalParams); } $apiData = $this->api_get($API_URL, $params); @@ -343,14 +346,14 @@ public function getChannelById($id, $optionalParams = false) * @return \StdClass * @throws \Exception */ - public function getChannelsById($ids = array(), $optionalParams = false) + public function getChannelsById($ids = array(), $optionalParams = []) { $API_URL = $this->getApi('channels.list'); $params = array( 'id' => implode(',', $ids), 'part' => 'id,snippet,contentDetails,statistics,invideoPromotion' ); - if($optionalParams){ + if (count($optionalParams)) { $params = array_merge($params, $optionalParams); } $apiData = $this->api_get($API_URL, $params); @@ -363,14 +366,14 @@ public function getChannelsById($ids = array(), $optionalParams = false) * @return array * @throws \Exception */ - public function getPlaylistsByChannelId($channelId, $optionalParams = array()) + public function getPlaylistsByChannelId($channelId, $optionalParams = []) { $API_URL = $this->getApi('playlists.list'); $params = array( 'channelId' => $channelId, 'part' => 'id, snippet, status' ); - if ($optionalParams) { + if (count($optionalParams)) { $params = array_merge($params, $optionalParams); } $apiData = $this->api_get($API_URL, $params); @@ -442,7 +445,7 @@ public function getPlaylistItemsByPlaylistIdAdvanced($params, $pageInfo = false) * @return array * @throws \Exception */ - public function getActivitiesByChannelId($channelId, $optionalParams = false) + public function getActivitiesByChannelId($channelId, $optionalParams = []) { if (empty($channelId)) { throw new \InvalidArgumentException('ChannelId must be supplied'); @@ -452,7 +455,7 @@ public function getActivitiesByChannelId($channelId, $optionalParams = false) 'channelId' => $channelId, 'part' => 'id, snippet, contentDetails' ); - if ($optionalParams) { + if (count($optionalParams)) { $params = array_merge($params, $optionalParams); } $apiData = $this->api_get($API_URL, $params); @@ -485,7 +488,7 @@ public static function parseVIdFromURL($youtube_url) } if (empty($videoId)) { - throw new \Exception('The supplied URL does not look like a Youtube URL'); + throw new \InvalidArgumentException('The supplied URL does not look like a Youtube URL'); } return $videoId; @@ -502,7 +505,7 @@ public static function parseVIdFromURL($youtube_url) public function getChannelFromURL($youtube_url) { if (strpos($youtube_url, 'youtube.com') === false) { - throw new \Exception('The supplied URL does not look like a Youtube URL'); + throw new \InvalidArgumentException('The supplied URL does not look like a Youtube URL'); } $path = static::_parse_url_path($youtube_url); @@ -515,7 +518,7 @@ public function getChannelFromURL($youtube_url) $username = $segments[count($segments) - 1]; $channel = $this->getChannelByName($username); } else { - throw new \Exception('The supplied URL does not look like a Youtube Channel URL'); + throw new \InvalidArgumentException('The supplied URL does not look like a Youtube Channel URL'); } return $channel; @@ -634,7 +637,7 @@ public function api_get($url, $params) curl_setopt($tuCurl, CURLOPT_RETURNTRANSFER, 1); $tuData = curl_exec($tuCurl); if (curl_errno($tuCurl)) { - throw new \Exception('Curl Error : ' . curl_error($tuCurl), curl_errno($tuCurl)); + throw new \InvalidArgumentException('Curl Error : ' . curl_error($tuCurl), curl_errno($tuCurl)); } return $tuData; } From fdadca5a4661d619cb99c086a5b4323670c6bb70 Mon Sep 17 00:00:00 2001 From: frederick tyteca Date: Wed, 27 Nov 2019 18:15:08 +0100 Subject: [PATCH 3/6] adding phpdoc informations --- src/Youtube.php | 109 +++++++++++++++++++++++++++++++----------------- 1 file changed, 71 insertions(+), 38 deletions(-) diff --git a/src/Youtube.php b/src/Youtube.php index 62694d2..0de67f4 100644 --- a/src/Youtube.php +++ b/src/Youtube.php @@ -53,7 +53,7 @@ class Youtube /** - * @var array + * @var array urls to be used */ public $APIs = array( 'videos.list' => 'https://www.googleapis.com/youtube/v3/videos', @@ -76,6 +76,7 @@ class Youtube * $youtube = new Youtube(array('key' => 'KEY HERE')) * * @param array $params + * @param string $sslPath * @throws \Exception */ public function __construct($params = array(), $sslPath = null) @@ -104,9 +105,10 @@ public function __construct($params = array(), $sslPath = null) /** - * Update the API key, useful if you want to switch - * multiple keys to avoid quota problem - * @param $apiKey + * Update the API key. + * Useful if you want to switch multiple keys to avoid quota problem. + * + * @param string $apiKey */ public function setApiKey($apiKey) { @@ -114,10 +116,11 @@ public function setApiKey($apiKey) } /** - * Override the API urls, so you can set them from a config + * Override the API urls, so you can set them from a config. + * * @param array $APIs */ - public function setAPIs(array $APIs) + public function setAPIs($APIs) { $this->APIs = $APIs; } @@ -129,11 +132,13 @@ public function setReferer($referer) } /** - * @param $vId + * getting video details. + * + * @param string $vId * @return \StdClass * @throws \Exception */ - public function getVideoInfo($vId, $optionalParams = []) + public function getVideoInfo($vId, $optionalParams = array()) { $API_URL = $this->getApi('videos.list'); $params = array( @@ -150,7 +155,9 @@ public function getVideoInfo($vId, $optionalParams = []) /** - * @param $vIds + * Getting videos detail. + * + * @param array|string $vIds * @return \StdClass * @throws \Exception */ @@ -169,10 +176,9 @@ public function getVideosInfo($vIds) /** - * Simple search interface, this search all stuffs - * and order by relevance + * Simple search interface, this search all stuffs and order by relevance. * - * @param $q + * @param string $q * @param int $maxResults * @return array */ @@ -188,7 +194,7 @@ public function search($q, $maxResults = 10) /** - * Search only videos + * Search only videos. * * @param string $q Query * @param integer $maxResults number of results to return @@ -212,7 +218,7 @@ public function searchVideos($q, $maxResults = 10, $order = null) /** - * Search only videos in the channel + * Search only videos in the channel. * * @param string $q * @param string $channelId @@ -236,7 +242,15 @@ public function searchChannelVideos($q, $channelId, $maxResults = 10, $order = n return $this->searchAdvanced($params); } - + /** + * Search only livestreams videos in the channel. + * + * @param string $q + * @param string $channelId + * @param integer $maxResults + * @param string $order + * @return object + */ public function searchChannelLiveStream($q, $channelId, $maxResults = 10, $order = null) { $params = array( @@ -257,11 +271,10 @@ public function searchChannelLiveStream($q, $channelId, $maxResults = 10, $order /** - * Generic Search interface, use any parameters specified in - * the API reference + * Generic Search interface, use any parameters specified in the API reference. * - * @param $params - * @param $pageInfo + * @param array $params + * @param boolean $pageInfo * @return array * @throws \Exception */ @@ -286,11 +299,11 @@ public function searchAdvanced($params, $pageInfo = false) /** - * Generic Search Paginator, use any parameters specified in - * the API reference and pass through nextPageToken as $token if set. + * Generic Search Paginator. + * Use any parameters specified in the API reference and pass through nextPageToken as $token if set. * - * @param $params - * @param $token + * @param array $params + * @param string $token * @return array */ public function paginateResults($params, $token = null) @@ -303,11 +316,13 @@ public function paginateResults($params, $token = null) /** - * @param $username + * Getting channel infos by username. + * + * @param string $username * @return \StdClass * @throws \Exception */ - public function getChannelByName($username, $optionalParams = []) + public function getChannelByName($username, $optionalParams = array()) { $API_URL = $this->getApi('channels.list'); $params = array( @@ -323,11 +338,14 @@ public function getChannelByName($username, $optionalParams = []) /** - * @param $id + * Getting channel infos by channelId. + * + * @param string $id + * @param array $optionalParams * @return \StdClass * @throws \Exception */ - public function getChannelById($id, $optionalParams = []) + public function getChannelById($id, $optionalParams = array()) { $API_URL = $this->getApi('channels.list'); $params = array( @@ -342,11 +360,14 @@ public function getChannelById($id, $optionalParams = []) } /** + * Getting channels infos by channelId. + * * @param array $ids + * @param array $optionalParams * @return \StdClass * @throws \Exception */ - public function getChannelsById($ids = array(), $optionalParams = []) + public function getChannelsById($ids = array(), $optionalParams = array()) { $API_URL = $this->getApi('channels.list'); $params = array( @@ -361,12 +382,14 @@ public function getChannelsById($ids = array(), $optionalParams = []) } /** + * Getting playlists for specified channelId. + * * @param $channelId * @param array $optionalParams * @return array * @throws \Exception */ - public function getPlaylistsByChannelId($channelId, $optionalParams = []) + public function getPlaylistsByChannelId($channelId, $optionalParams = array()) { $API_URL = $this->getApi('playlists.list'); $params = array( @@ -382,15 +405,17 @@ public function getPlaylistsByChannelId($channelId, $optionalParams = []) /** - * @param $id + * Getting playlists details for specified playlistId. + * + * @param string $id * @return \StdClass * @throws \Exception */ - public function getPlaylistById($id) + public function getPlaylistById($playlistId) { $API_URL = $this->getApi('playlists.list'); $params = array( - 'id' => $id, + 'id' => $playlistId, 'part' => 'id, snippet, status' ); $apiData = $this->api_get($API_URL, $params); @@ -399,7 +424,9 @@ public function getPlaylistById($id) /** - * @param $playlistId + * Getting videos that are in specified playlists. + * + * @param string $playlistId * @return array * @throws \Exception */ @@ -415,6 +442,9 @@ public function getPlaylistItemsByPlaylistId($playlistId, $maxResults = 50) /** + * Getting videos that are in specified playlists and pageInfo. + * PageInfo is required if you need to parse more than $maxresults into one playlist. + * * @param $params * @param bool|false $pageInfo * @return array @@ -441,11 +471,14 @@ public function getPlaylistItemsByPlaylistIdAdvanced($params, $pageInfo = false) /** - * @param $channelId + * Getting activities on channel. + * + * @param string $channelId + * @param array $optionalParams * @return array * @throws \Exception */ - public function getActivitiesByChannelId($channelId, $optionalParams = []) + public function getActivitiesByChannelId($channelId, $optionalParams = array()) { if (empty($channelId)) { throw new \InvalidArgumentException('ChannelId must be supplied'); @@ -467,7 +500,7 @@ public function getActivitiesByChannelId($channelId, $optionalParams = []) * Parse a youtube URL to get the youtube Vid. * Support both full URL (www.youtube.com) and short URL (youtu.be) * - * @param string $youtube_url + * @param string $youtube_url * @throws \Exception * @return string Video Id */ @@ -530,7 +563,7 @@ public function getChannelFromURL($youtube_url) */ /** - * @param $name + * @param string $name * @return mixed */ public function getApi($name) @@ -543,7 +576,7 @@ public function getApi($name) * Decode the response from youtube, extract the single resource object. * (Don't use this to decode the response containing list of objects) * - * @param string $apiData the api response from youtube + * @param string $apiData the api response from youtube * @throws \Exception * @return \StdClass an Youtube resource object */ From c228b3c3afbf1043b373d9a9b421d8f9ba4234c9 Mon Sep 17 00:00:00 2001 From: frederick tyteca Date: Sun, 1 Dec 2019 23:03:23 +0100 Subject: [PATCH 4/6] adding quotas calculator and tests for it. --- src/Youtube.php | 63 ++++- src/YoutubeQuotas.php | 228 ++++++++++++++++++ .../YoutubeQuotas/YoutubeQuotasBasicTest.php | 58 +++++ .../YoutubeQuotasChannelsListTest.php | 47 ++++ .../YoutubeQuotasInjectionTest.php | 91 +++++++ .../YoutubeQuotasPlaylistItemsListTest.php | 49 ++++ .../YoutubeQuotasPlaylistsListTest.php | 49 ++++ .../YoutubeQuotasVideosListTest.php | 47 ++++ 8 files changed, 621 insertions(+), 11 deletions(-) create mode 100644 src/YoutubeQuotas.php create mode 100644 tests/YoutubeQuotas/YoutubeQuotasBasicTest.php create mode 100644 tests/YoutubeQuotas/YoutubeQuotasChannelsListTest.php create mode 100644 tests/YoutubeQuotas/YoutubeQuotasInjectionTest.php create mode 100644 tests/YoutubeQuotas/YoutubeQuotasPlaylistItemsListTest.php create mode 100644 tests/YoutubeQuotas/YoutubeQuotasPlaylistsListTest.php create mode 100644 tests/YoutubeQuotas/YoutubeQuotasVideosListTest.php diff --git a/src/Youtube.php b/src/Youtube.php index 0de67f4..7cf1d74 100644 --- a/src/Youtube.php +++ b/src/Youtube.php @@ -70,6 +70,11 @@ class Youtube */ public $page_info = array(); + /** + * @var YoutubeQuota + */ + public $quotaObj; + /** * Constructor @@ -103,6 +108,13 @@ public function __construct($params = array(), $sslPath = null) } } + /** + * if quotaObj is set, we will be able to count quota used on each query + */ + public function injectQuotaCalculator(YoutubeQuotas $quotaObj) + { + $this->quotaObj = $quotaObj; + } /** * Update the API key. @@ -140,7 +152,7 @@ public function setReferer($referer) */ public function getVideoInfo($vId, $optionalParams = array()) { - $API_URL = $this->getApi('videos.list'); + $API_URL = $this->getApi($endPoint = 'videos.list'); $params = array( 'id' => $vId, 'part' => 'id, snippet, contentDetails, player, statistics, status' @@ -148,8 +160,10 @@ public function getVideoInfo($vId, $optionalParams = array()) if (count($optionalParams)) { $params = array_merge($params, $optionalParams); } - $apiData = $this->api_get($API_URL, $params); + if (isset($this->quotaObj)) { + $this->quotaObj->addQuery($endPoint, $params['part']); + } return $this->decodeSingle($apiData); } @@ -164,13 +178,16 @@ public function getVideoInfo($vId, $optionalParams = array()) public function getVideosInfo($vIds) { $ids = is_array($vIds) ? implode(',', $vIds) : $vIds; - $API_URL = $this->getApi('videos.list'); + $API_URL = $this->getApi($endPoint = 'videos.list'); $params = array( 'id' => $ids, 'part' => 'id, snippet, contentDetails, player, statistics, status' ); $apiData = $this->api_get($API_URL, $params); + if (isset($this->quotaObj)) { + $this->quotaObj->addQuery($endPoint, $params['part']); + } return $this->decodeList($apiData); } @@ -280,13 +297,16 @@ public function searchChannelLiveStream($q, $channelId, $maxResults = 10, $order */ public function searchAdvanced($params, $pageInfo = false) { - $API_URL = $this->getApi('search.list'); + $API_URL = $this->getApi($endPoint = 'search.list'); if (empty($params) || !isset($params['q'])) { throw new \InvalidArgumentException('at least the Search query must be supplied'); } $apiData = $this->api_get($API_URL, $params); + if (isset($this->quotaObj)) { + $this->quotaObj->addQuery($endPoint, $params['part']); + } if ($pageInfo) { return array( 'results' => $this->decodeList($apiData), @@ -324,7 +344,7 @@ public function paginateResults($params, $token = null) */ public function getChannelByName($username, $optionalParams = array()) { - $API_URL = $this->getApi('channels.list'); + $API_URL = $this->getApi($endPoint = 'channels.list'); $params = array( 'forUsername' => $username, 'part' => 'id,snippet,contentDetails,statistics,invideoPromotion' @@ -333,6 +353,9 @@ public function getChannelByName($username, $optionalParams = array()) $params = array_merge($params, $optionalParams); } $apiData = $this->api_get($API_URL, $params); + if (isset($this->quotaObj)) { + $this->quotaObj->addQuery($endPoint, $params['part']); + } return $this->decodeSingle($apiData); } @@ -347,7 +370,7 @@ public function getChannelByName($username, $optionalParams = array()) */ public function getChannelById($id, $optionalParams = array()) { - $API_URL = $this->getApi('channels.list'); + $API_URL = $this->getApi($endPoint = 'channels.list'); $params = array( 'id' => $id, 'part' => 'id,snippet,contentDetails,statistics,invideoPromotion' @@ -356,6 +379,9 @@ public function getChannelById($id, $optionalParams = array()) $params = array_merge($params, $optionalParams); } $apiData = $this->api_get($API_URL, $params); + if (isset($this->quotaObj)) { + $this->quotaObj->addQuery($endPoint, $params['part']); + } return $this->decodeSingle($apiData); } @@ -369,7 +395,7 @@ public function getChannelById($id, $optionalParams = array()) */ public function getChannelsById($ids = array(), $optionalParams = array()) { - $API_URL = $this->getApi('channels.list'); + $API_URL = $this->getApi($endPoint = 'channels.list'); $params = array( 'id' => implode(',', $ids), 'part' => 'id,snippet,contentDetails,statistics,invideoPromotion' @@ -378,6 +404,9 @@ public function getChannelsById($ids = array(), $optionalParams = array()) $params = array_merge($params, $optionalParams); } $apiData = $this->api_get($API_URL, $params); + if (isset($this->quotaObj)) { + $this->quotaObj->addQuery($endPoint, $params['part']); + } return $this->decodeList($apiData); } @@ -391,7 +420,7 @@ public function getChannelsById($ids = array(), $optionalParams = array()) */ public function getPlaylistsByChannelId($channelId, $optionalParams = array()) { - $API_URL = $this->getApi('playlists.list'); + $API_URL = $this->getApi($endPoint = 'playlists.list'); $params = array( 'channelId' => $channelId, 'part' => 'id, snippet, status' @@ -400,6 +429,9 @@ public function getPlaylistsByChannelId($channelId, $optionalParams = array()) $params = array_merge($params, $optionalParams); } $apiData = $this->api_get($API_URL, $params); + if (isset($this->quotaObj)) { + $this->quotaObj->addQuery($endPoint, $params['part']); + } return $this->decodeList($apiData); } @@ -413,12 +445,15 @@ public function getPlaylistsByChannelId($channelId, $optionalParams = array()) */ public function getPlaylistById($playlistId) { - $API_URL = $this->getApi('playlists.list'); + $API_URL = $this->getApi($endPoint = 'playlists.list'); $params = array( 'id' => $playlistId, 'part' => 'id, snippet, status' ); $apiData = $this->api_get($API_URL, $params); + if (isset($this->quotaObj)) { + $this->quotaObj->addQuery($endPoint, $params['part']); + } return $this->decodeSingle($apiData); } @@ -452,13 +487,16 @@ public function getPlaylistItemsByPlaylistId($playlistId, $maxResults = 50) */ public function getPlaylistItemsByPlaylistIdAdvanced($params, $pageInfo = false) { - $API_URL = $this->getApi('playlistItems.list'); + $API_URL = $this->getApi($endPoint = 'playlistItems.list'); if (empty($params) || !isset($params['playlistId'])) { throw new \InvalidArgumentException('at least the playlist id must be supplied'); } $apiData = $this->api_get($API_URL, $params); + if (isset($this->quotaObj)) { + $this->quotaObj->addQuery($endPoint, $params['part']); + } if ($pageInfo) { return array( 'results' => $this->decodeList($apiData), @@ -483,7 +521,7 @@ public function getActivitiesByChannelId($channelId, $optionalParams = array()) if (empty($channelId)) { throw new \InvalidArgumentException('ChannelId must be supplied'); } - $API_URL = $this->getApi('activities'); + $API_URL = $this->getApi($endPoint = 'activities'); $params = array( 'channelId' => $channelId, 'part' => 'id, snippet, contentDetails' @@ -492,6 +530,9 @@ public function getActivitiesByChannelId($channelId, $optionalParams = array()) $params = array_merge($params, $optionalParams); } $apiData = $this->api_get($API_URL, $params); + if (isset($this->quotaObj)) { + $this->quotaObj->addQuery($endPoint, $params['part']); + } return $this->decodeList($apiData); } diff --git a/src/YoutubeQuotas.php b/src/YoutubeQuotas.php new file mode 100644 index 0000000..9085cdb --- /dev/null +++ b/src/YoutubeQuotas.php @@ -0,0 +1,228 @@ +addQuery($apiUsed, $partParams); + } + } + + /** + * classic constructor. + * Do not mix create and new YoutubeQuota + * + * @param string endpoint to be used + * @param string partParams used to collect some specific data + */ + public function addQuery(string $apiUsed, string $partParams = null) + { + if (isset($partParams) && !empty($partParams)) { + $this->extractPartParams($partParams); + } + switch ($apiUsed) { + case 'videos.list': + $this->videosListQuotaCalculator(); + break; + case 'search.list': + $this->searchListQuotaCalculator(); + break; + case 'channels.list': + $this->channelsListQuotaCalculator(); + break; + case 'playlists.list': + $this->playlistsListQuotaCalculator(); + break; + case 'playlistItems.list': + $this->playlistsItemsListQuotaCalculator(); + break; + case 'activities': + /** @todo */ + break; + } + } + + /** + * Static constructor + * + * @param string endpoint to be used + * @param string partParams used to collect some specific data + * @return YoutubeQuotas object + */ + public function create(string $apiUsed = null, string $partParams = null) + { + return new static($apiUsed, $partParams); + } + + /** + * channels.list calculator. + * initialize one array of params and their cost. + */ + public function channelsListQuotaCalculator() + { + $paramsAllowedAndQuotasUsed = [ + 'id' => 0, + 'snippet' => 2, + 'brandingSettings' => 2, + 'contentDetails' => 2, + 'invideoPromotion' => 2, + 'statistics' => 2, + 'status' => 2, + 'topicDetails' => 2, + ]; + /** base query is 1 point */ + $this->quotaUsed += 1; + if ($this->partParams) { + $this->quotaCalculator($paramsAllowedAndQuotasUsed); + } + } + + /** + * videos.list calculator. + * initialize one array of params and their cost. + */ + public function videosListQuotaCalculator() + { + $paramsAllowedAndQuotasUsed = [ + 'id' => 0, + 'contentDetails' => 2, + 'fileDetails' => 1, + 'liveStreamingDetails' => 2, + 'localizations' => 2, + 'player' => 0, + 'processingDetails' => 1, + 'recordingDetails' => 2, + 'snippet' => 2, + 'statistics' => 2, + 'status' => 2, + 'suggestions' => 1, + 'topicDetails' => 2, + ]; + /** base query is 1 point */ + $this->quotaUsed += 1; + if ($this->partParams) { + $this->quotaCalculator($paramsAllowedAndQuotasUsed); + } + } + + /** + * playlists.list calculator. + * initialize one array of params and their cost. + */ + public function playlistsListQuotaCalculator() + { + $paramsAllowedAndQuotasUsed = [ + 'id' => 0, + 'player' => 0, + 'contentDetails' => 2, + 'localizations' => 2, + 'snippet' => 2, + 'status' => 2, + ]; + /** base query is 1 point */ + $this->quotaUsed += 1; + if ($this->partParams) { + $this->quotaCalculator($paramsAllowedAndQuotasUsed); + } + } + + /** + * playlistItems.list calculator. + * initialize one array of params and their cost. + */ + public function playlistsItemsListQuotaCalculator() + { + $paramsAllowedAndQuotasUsed = [ + 'id' => 0, + 'contentDetails' => 2, + 'snippet' => 2, + 'status' => 2, + ]; + /** base query is 1 point */ + $this->quotaUsed += 1; + if ($this->partParams) { + $this->quotaCalculator($paramsAllowedAndQuotasUsed); + } + } + + /** + * search.list calculator. + * initialize one array of params and their cost. + */ + public function searchListQuotaCalculator() + { + /** base query for search is 100 points but there is no params */ + $this->quotaUsed += 100; + } + + /** + * main calculator. + * according to an array of param and points will calculate the quota_used by the query(ies). + * + * @param array params and the quota they consume + */ + protected function quotaCalculator(array $allowedParamsAndQuotaUsed) + { + foreach ($this->partParams as $index => $part) { + if (isset($allowedParamsAndQuotaUsed[$part])) { + $this->quotaUsed += $allowedParamsAndQuotaUsed[$part]; + } else { + // cleaning false entries in params + unset($this->partParams[$index]); + } + } + } + + /** + * extract/cleanify the params to sent to yt api. + * + * @param string list of params comma separated as in Youtube.php + */ + protected function extractPartParams(string $partParams) + { + //removing extra whitespaces then explode it then remove duplicates + $this->partParams = array_unique(explode(',', preg_replace('/\s+/', '', $partParams))); + } + + /** + * getter quotaUsed. + * + * @return integer quota used on query(ies) + */ + public function quotaUsed() + { + return $this->quotaUsed; + } + + /** + * getter params cleanified. + * + * @return array list of params for last query + */ + public function partParams() + { + return $this->partParams; + } +} diff --git a/tests/YoutubeQuotas/YoutubeQuotasBasicTest.php b/tests/YoutubeQuotas/YoutubeQuotasBasicTest.php new file mode 100644 index 0000000..3bae2e6 --- /dev/null +++ b/tests/YoutubeQuotas/YoutubeQuotasBasicTest.php @@ -0,0 +1,58 @@ + + */ +class YoutubeQuotasBasicTest extends TestCase +{ + public function testingPartParams() + { + $expectedParams = ['id', 'snippet']; + $this->assertEqualsCanonicalizing( + $expectedParams, + YoutubeQuotas::create('channels.list', 'id,snippet')->partParams() + ); + } + + public function testingMorePartParamsWithSpaceAndDuplicates() + { + $expectedParams = ['id', 'snippet', 'status', 'contentDetails']; + $this->assertEqualsCanonicalizing( + $expectedParams, + YoutubeQuotas::create('channels.list', 'id,snippet, status,status,contentDetails')->partParams() + ); + } + + public function testSearchList() + { + $this->assertEquals( + 100, + YoutubeQuotas::create('search.list')->quotaUsed() + ); + } + + public function testMakingMoreQuery() + { + $quotaObj = YoutubeQuotas::create('search.list'); + $this->assertEquals( 100, $quotaObj->quotaUsed() ); + + $quotaObj->addQuery('channels.list', 'snippet,unicorn,poney,status,contentDetails'); + $this->assertEquals( 107, $quotaObj->quotaUsed()); + + $quotaObj->addQuery('search.list'); + $this->assertEquals( 207, $quotaObj->quotaUsed()); + + $quotaObj->addQuery('playlistItems.list', 'status, contentDetails'); + $this->assertEquals( 212, $quotaObj->quotaUsed()); + } +} diff --git a/tests/YoutubeQuotas/YoutubeQuotasChannelsListTest.php b/tests/YoutubeQuotas/YoutubeQuotasChannelsListTest.php new file mode 100644 index 0000000..5233e40 --- /dev/null +++ b/tests/YoutubeQuotas/YoutubeQuotasChannelsListTest.php @@ -0,0 +1,47 @@ + + */ +class YoutubeQuotasChannelsListTest extends TestCase +{ + public function testChannelsListWithNoParams() + { + $this->assertEquals( + 1, + YoutubeQuotas::create('channels.list', '')->quotaUsed() + ); + } + + public function testChannelsListWithSomeParams () + { + $this->assertEquals( + 7, + YoutubeQuotas::create('channels.list', 'id,snippet,status,contentDetails')->quotaUsed() + ); + } + + public function testChannelsListWithSomeFoolishParams () + { + $quotaObj = YoutubeQuotas::create('channels.list', 'snippet,unicorn,poney,status,contentDetails'); + $this->assertEquals( + 7, + $quotaObj->quotaUsed() + ); + + $this->assertEqualsCanonicalizing( + ['snippet', 'status', 'contentDetails'], + $quotaObj->partParams() + ); + } +} diff --git a/tests/YoutubeQuotas/YoutubeQuotasInjectionTest.php b/tests/YoutubeQuotas/YoutubeQuotasInjectionTest.php new file mode 100644 index 0000000..15db2ad --- /dev/null +++ b/tests/YoutubeQuotas/YoutubeQuotasInjectionTest.php @@ -0,0 +1,91 @@ + + */ +class YoutubeQuotasInjectionTest extends TestCase +{ + // !!!!! DO NOT USE THIS API KEY FOR PRODUCTION USE !!!!! */ + const _TEST_API_KEY = 'AIzaSyDlNBnbhP7G9z_8qunELCJ8012PP3t_c1o'; + // !!!!! THIS KEY WOULD BE REVOKED BY AUTHOR ANYTIME !!!!! */ + + protected $youtube; + + public function setUp(): void + { + $this->youtube = new Youtube(['key' => self::_TEST_API_KEY]); + $this->youtube->injectQuotaCalculator(new YoutubeQuotas()); + } + + public function tearDown(): void + { + $this->youtube = null; + $this->optionParams = null; + } + + public function testGetVideoInfoWithInjection() + { + $this->youtube->getVideoInfo($videoId = 'rie-hPVJ7Sw'); + $this->assertEquals( + 9, + $this->youtube->quotaObj->quotaUsed() + ); + } + + public function testGetChannelByIdWithInjection() + { + $this->youtube->getChannelById($channelId = 'UCk1SpWNzOs4MYmr0uICEntg'); + $this->assertEquals( + 9, + $this->youtube->quotaObj->quotaUsed() + ); + } + + public function testGetChannelByNameWithInjection() + { + $this->youtube->getChannelByName('Google'); + $this->assertEquals( + 9, + $this->youtube->quotaObj->quotaUsed() + ); + } + + public function testSearchAdvancedIdWithInjection() + { + $limit = rand(3, 10); + $this->youtube->searchVideos('Android', $limit, 'title'); + $this->assertEquals( + 100, + $this->youtube->quotaObj->quotaUsed() + ); + } + + public function testGetPlaylistsByChannelIdWithInjection() + { + $this->youtube->getPlaylistsByChannelId('UCK8sQmJBp8GCxrOtXWBpyEA'); + $this->assertEquals( + 5, + $this->youtube->quotaObj->quotaUsed() + ); + } + + public function testGetPlaylistItemsByPlaylistIdWithInjection() + { + $this->youtube->getPlaylistItemsByPlaylistId('PL590L5WQmH8fJ54F369BLDSqIwcs-TCfs'); + $this->assertEquals( + 7, + $this->youtube->quotaObj->quotaUsed() + ); + } +} diff --git a/tests/YoutubeQuotas/YoutubeQuotasPlaylistItemsListTest.php b/tests/YoutubeQuotas/YoutubeQuotasPlaylistItemsListTest.php new file mode 100644 index 0000000..31a2f47 --- /dev/null +++ b/tests/YoutubeQuotas/YoutubeQuotasPlaylistItemsListTest.php @@ -0,0 +1,49 @@ + + */ +class YoutubeQuotasPlaylistItemsListTest extends TestCase +{ + public function testPlaylistItemsListWithNoParams() + { + $this->assertEquals( + 1, + YoutubeQuotas::create('playlistItems.list', '')->quotaUsed() + ); + } + + public function testPlaylistItemsListWithSomeParams() + { + $this->assertEquals( + 5, + YoutubeQuotas::create( + 'playlistItems.list', + 'status, contentDetails' + )->quotaUsed() + ); + } + + public function testPlaylistItemsListWithAllParams() + { + $this->assertEquals( + 7, + YoutubeQuotas::create( + 'playlistItems.list', + 'id, snippet, status, contentDetails' + )->quotaUsed() + ); + } + + +} diff --git a/tests/YoutubeQuotas/YoutubeQuotasPlaylistsListTest.php b/tests/YoutubeQuotas/YoutubeQuotasPlaylistsListTest.php new file mode 100644 index 0000000..23c95ce --- /dev/null +++ b/tests/YoutubeQuotas/YoutubeQuotasPlaylistsListTest.php @@ -0,0 +1,49 @@ + + */ +class YoutubeQuotasPlaylistsListTest extends TestCase +{ + public function testPlaylistsListWithNoParams() + { + $this->assertEquals( + 1, + YoutubeQuotas::create('playlists.list', '')->quotaUsed() + ); + } + + public function testPlaylistsListWithSomeParams() + { + $this->assertEquals( + 5, + YoutubeQuotas::create( + 'playlists.list', + 'id, player, snippet, status, player' + )->quotaUsed() + ); + } + + public function testPlaylistsListWithAllParams() + { + $this->assertEquals( + 7, + YoutubeQuotas::create( + 'playlists.list', + 'id, player, snippet, status, contentDetails, player' + )->quotaUsed() + ); + } + + +} diff --git a/tests/YoutubeQuotas/YoutubeQuotasVideosListTest.php b/tests/YoutubeQuotas/YoutubeQuotasVideosListTest.php new file mode 100644 index 0000000..e8db844 --- /dev/null +++ b/tests/YoutubeQuotas/YoutubeQuotasVideosListTest.php @@ -0,0 +1,47 @@ + + */ +class YoutubeQuotasVideosListTest extends TestCase +{ + public function testVideosListWithNoParams() + { + $this->assertEquals( + 1, + YoutubeQuotas::create('videos.list', '')->quotaUsed() + ); + } + + public function testVideosListWithSomeParams() + { + $this->assertEquals( + 13, + YoutubeQuotas::create( + 'videos.list', + 'snippet, contentDetails, status, statistics, recordingDetails, fileDetails, suggestions' + )->quotaUsed() + ); + } + + public function testVideosListWithAllParams() + { + $this->assertEquals( + 16, + YoutubeQuotas::create( + 'videos.list', + 'snippet, contentDetails, status, statistics, player, topicDetails, recordingDetails, fileDetails, processingDetails, suggestions' + )->quotaUsed() + ); + } +} From f1f3ccc238d104a0c10f0964c68babe8a0abff82 Mon Sep 17 00:00:00 2001 From: frederick tyteca Date: Mon, 2 Dec 2019 15:53:59 +0100 Subject: [PATCH 5/6] adding getPlaylistsByChannelIdAdvanced to be able to obtain more than 50 playlists on one channelId --- .travis.yml | 9 +++------ src/Youtube.php | 36 +++++++++++++++++++++++++++++++++--- tests/YoutubeTest.php | 31 +++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 05096cc..9c11177 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,9 @@ language: php php: - - 5.3 - - 5.4 - - 5.5 - - 5.6 - - 7.0 - - 7.1 + - 7.2 + - 7.3 + - 7.4 - hhvm - nightly diff --git a/src/Youtube.php b/src/Youtube.php index 7cf1d74..3d0af06 100644 --- a/src/Youtube.php +++ b/src/Youtube.php @@ -161,9 +161,9 @@ public function getVideoInfo($vId, $optionalParams = array()) $params = array_merge($params, $optionalParams); } $apiData = $this->api_get($API_URL, $params); - if (isset($this->quotaObj)) { - $this->quotaObj->addQuery($endPoint, $params['part']); - } + if (isset($this->quotaObj)) { + $this->quotaObj->addQuery($endPoint, $params['part']); + } return $this->decodeSingle($apiData); } @@ -410,6 +410,36 @@ public function getChannelsById($ids = array(), $optionalParams = array()) return $this->decodeList($apiData); } + /** + * Getting all playlists for one channed. + * Some channels have more then 50 (maxResults allowed) palylists. Tis function allow us to send pageInfo + * + * @param array $params should contain channelId key param + * @param boolean $pageInfo + * @return array + * @throws \Exception + */ + public function getPlaylistsByChannelIdAdvanced($params, $pageInfo = false) + { + if (empty($params) || !isset($params['channelId'])) { + throw new \InvalidArgumentException('ChannelId must be supplied'); + } + + $API_URL = $this->getApi($endPoint = 'playlists.list'); + + $apiData = $this->api_get($API_URL, $params); + if (isset($this->quotaObj)) { + $this->quotaObj->addQuery($endPoint, $params['part']); + } + if ($pageInfo) { + return array( + 'results' => $this->decodeList($apiData), + 'info' => $this->page_info + ); + } else { + return $this->decodeList($apiData); + } + } /** * Getting playlists for specified channelId. * diff --git a/tests/YoutubeTest.php b/tests/YoutubeTest.php index 411296c..2165c74 100644 --- a/tests/YoutubeTest.php +++ b/tests/YoutubeTest.php @@ -246,6 +246,37 @@ public function testGetChannelsById() $this->assertObjectHasAttribute('statistics', $response[0]); } + public function testGetPlaylistsByChannelIdAdvanced() + { + $playlistParams = [ + 'channelId' => $GOOGLE_CHANNELID = 'UCK8sQmJBp8GCxrOtXWBpyEA', + 'maxResults' => 15, + 'part' => 'id,contentDetails,localizations,player,snippet,status', + ]; + + $response = $this->youtube->getPlaylistsByChannelIdAdvanced($playlistParams, true); + $this->assertGreaterThan(10, $response['results']); + $this->assertEquals('youtube#playlist', $response["results"][0]->kind); + $this->assertEquals('Google', $response["results"][0]->snippet->channelTitle); + $this->assertObjectHasAttribute('snippet', $response["results"][0]); + $this->assertObjectHasAttribute('contentDetails', $response["results"][0]); + + $this->assertEqualsCanonicalizing(['results', 'info'], array_keys($response)); + $this->assertContains( + 'PL590L5WQmH8e3dS9CtvRofb0nfdGb-Of9', + array_map(function ($playlist) { + return $playlist->id; + }, $response['results']) + ); + $this->assertNotNull($response["info"]["nextPageToken"]); + + // running another test with pageToken (next page token) + $playlistParams["pageToken"] = $response["info"]["nextPageToken"]; + $response = $this->youtube->getPlaylistsByChannelIdAdvanced($playlistParams, true); + $this->assertEqualsCanonicalizing(['results', 'info'], array_keys($response)); + $this->assertGreaterThan(10, $response['results']); + } + public function testGetPlaylistsByChannelId() { From e2b6a266acdbd9e03a3643dcb7f2866f73458986 Mon Sep 17 00:00:00 2001 From: frederick tyteca Date: Mon, 2 Dec 2019 15:55:17 +0100 Subject: [PATCH 6/6] restoring travis --- .travis.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9c11177..05096cc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,12 @@ language: php php: - - 7.2 - - 7.3 - - 7.4 + - 5.3 + - 5.4 + - 5.5 + - 5.6 + - 7.0 + - 7.1 - hhvm - nightly