diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c89dfccb..bc2d5ee4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['7.0', '7.1', '7.2', '7.3', '7.4'] + php-versions: ['7.3', '7.4', '8.0'] steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 38823a09..532141b9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['7.0', '7.1', '7.2', '7.3', '7.4'] + php-versions: ['7.3', '7.4', '8.0', '8.1'] steps: - uses: actions/checkout@v2 diff --git a/composer.json b/composer.json index 81112ad0..0de8ab51 100644 --- a/composer.json +++ b/composer.json @@ -1,17 +1,17 @@ { - "name": "cloudflare/sdk", + "name": "smartframe-technologies/cloudflare-php", "description": "PHP binding for v4 of the Cloudflare Client API.", "type": "library", "require": { - "guzzlehttp/guzzle": "^7.0.1", - "php": ">=7.2.5", + "guzzlehttp/guzzle": "^6.3 || ^7.0.1", + "php": ">=7.3", "psr/http-message": "~1.0", "ext-json": "*" }, "require-dev": { - "phpunit/phpunit": "^5.7", - "phpmd/phpmd" : "@stable", - "friendsofphp/php-cs-fixer": "^2.6" + "friendsofphp/php-cs-fixer": "^2.6", + "phpmd/phpmd": "^2.11.1", + "phpunit/phpunit": "^9.5.16" }, "license": "BSD-3-Clause", "authors": [ diff --git a/composer.lock b/composer.lock deleted file mode 100644 index 633000df..00000000 --- a/composer.lock +++ /dev/null @@ -1,3060 +0,0 @@ -{ - "_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#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "dfd011c55474ffaab84b7a0a6d164049", - "packages": [ - { - "name": "guzzlehttp/guzzle", - "version": "6.5.2", - "source": { - "type": "git", - "url": "https://github.com/guzzle/guzzle.git", - "reference": "43ece0e75098b7ecd8d13918293029e555a50f82" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/43ece0e75098b7ecd8d13918293029e555a50f82", - "reference": "43ece0e75098b7ecd8d13918293029e555a50f82", - "shasum": "" - }, - "require": { - "ext-json": "*", - "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.6.1", - "php": ">=5.5" - }, - "require-dev": { - "ext-curl": "*", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", - "psr/log": "^1.1" - }, - "suggest": { - "ext-intl": "Required for Internationalized Domain Name (IDN) support", - "psr/log": "Required for using the Log middleware" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.5-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle is a PHP HTTP client library", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "rest", - "web service" - ], - "time": "2019-12-23T11:57:10+00:00" - }, - { - "name": "guzzlehttp/promises", - "version": "v1.3.1", - "source": { - "type": "git", - "url": "https://github.com/guzzle/promises.git", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "shasum": "" - }, - "require": { - "php": ">=5.5.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Promise\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle promises library", - "keywords": [ - "promise" - ], - "time": "2016-12-20T10:07:11+00:00" - }, - { - "name": "guzzlehttp/psr7", - "version": "1.6.1", - "source": { - "type": "git", - "url": "https://github.com/guzzle/psr7.git", - "reference": "239400de7a173fe9901b9ac7c06497751f00727a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", - "reference": "239400de7a173fe9901b9ac7c06497751f00727a", - "shasum": "" - }, - "require": { - "php": ">=5.4.0", - "psr/http-message": "~1.0", - "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" - }, - "provide": { - "psr/http-message-implementation": "1.0" - }, - "require-dev": { - "ext-zlib": "*", - "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" - }, - "suggest": { - "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Psr7\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Tobias Schultze", - "homepage": "https://github.com/Tobion" - } - ], - "description": "PSR-7 message implementation that also provides common utility methods", - "keywords": [ - "http", - "message", - "psr-7", - "request", - "response", - "stream", - "uri", - "url" - ], - "time": "2019-07-01T23:21:34+00:00" - }, - { - "name": "psr/http-message", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Message\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP messages", - "homepage": "https://github.com/php-fig/http-message", - "keywords": [ - "http", - "http-message", - "psr", - "psr-7", - "request", - "response" - ], - "time": "2016-08-06T14:39:51+00:00" - }, - { - "name": "ralouphie/getallheaders", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/ralouphie/getallheaders.git", - "reference": "120b605dfeb996808c31b6477290a714d356e822" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", - "reference": "120b605dfeb996808c31b6477290a714d356e822", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "require-dev": { - "php-coveralls/php-coveralls": "^2.1", - "phpunit/phpunit": "^5 || ^6.5" - }, - "type": "library", - "autoload": { - "files": [ - "src/getallheaders.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ralph Khattar", - "email": "ralph.khattar@gmail.com" - } - ], - "description": "A polyfill for getallheaders.", - "time": "2019-03-08T08:55:37+00:00" - } - ], - "packages-dev": [ - { - "name": "composer/semver", - "version": "1.5.1", - "source": { - "type": "git", - "url": "https://github.com/composer/semver.git", - "reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/c6bea70230ef4dd483e6bbcab6005f682ed3a8de", - "reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.5 || ^5.0.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\Semver\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - }, - { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" - } - ], - "description": "Semver library that offers utilities, version constraint parsing and validation.", - "keywords": [ - "semantic", - "semver", - "validation", - "versioning" - ], - "time": "2020-01-13T12:06:48+00:00" - }, - { - "name": "composer/xdebug-handler", - "version": "1.4.1", - "source": { - "type": "git", - "url": "https://github.com/composer/xdebug-handler.git", - "reference": "1ab9842d69e64fb3a01be6b656501032d1b78cb7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/1ab9842d69e64fb3a01be6b656501032d1b78cb7", - "reference": "1ab9842d69e64fb3a01be6b656501032d1b78cb7", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0 || ^8.0", - "psr/log": "^1.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8" - }, - "type": "library", - "autoload": { - "psr-4": { - "Composer\\XdebugHandler\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "John Stevenson", - "email": "john-stevenson@blueyonder.co.uk" - } - ], - "description": "Restarts a process without Xdebug.", - "keywords": [ - "Xdebug", - "performance" - ], - "time": "2020-03-01T12:26:26+00:00" - }, - { - "name": "doctrine/annotations", - "version": "v1.4.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/annotations.git", - "reference": "54cacc9b81758b14e3ce750f205a393d52339e97" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/54cacc9b81758b14e3ce750f205a393d52339e97", - "reference": "54cacc9b81758b14e3ce750f205a393d52339e97", - "shasum": "" - }, - "require": { - "doctrine/lexer": "1.*", - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "doctrine/cache": "1.*", - "phpunit/phpunit": "^5.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Docblock Annotations Parser", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "annotations", - "docblock", - "parser" - ], - "time": "2017-02-24T16:22:25+00:00" - }, - { - "name": "doctrine/instantiator", - "version": "1.0.5", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", - "shasum": "" - }, - "require": { - "php": ">=5.3,<8.0-DEV" - }, - "require-dev": { - "athletic/athletic": "~0.1.8", - "ext-pdo": "*", - "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2015-06-14T21:17:01+00:00" - }, - { - "name": "doctrine/lexer", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/doctrine/lexer.git", - "reference": "1febd6c3ef84253d7c815bed85fc622ad207a9f8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/1febd6c3ef84253d7c815bed85fc622ad207a9f8", - "reference": "1febd6c3ef84253d7c815bed85fc622ad207a9f8", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "require-dev": { - "phpunit/phpunit": "^4.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", - "homepage": "https://www.doctrine-project.org/projects/lexer.html", - "keywords": [ - "annotations", - "docblock", - "lexer", - "parser", - "php" - ], - "time": "2019-06-08T11:03:04+00:00" - }, - { - "name": "friendsofphp/php-cs-fixer", - "version": "v2.16.1", - "source": { - "type": "git", - "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "c8afb599858876e95e8ebfcd97812d383fa23f02" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/c8afb599858876e95e8ebfcd97812d383fa23f02", - "reference": "c8afb599858876e95e8ebfcd97812d383fa23f02", - "shasum": "" - }, - "require": { - "composer/semver": "^1.4", - "composer/xdebug-handler": "^1.2", - "doctrine/annotations": "^1.2", - "ext-json": "*", - "ext-tokenizer": "*", - "php": "^5.6 || ^7.0", - "php-cs-fixer/diff": "^1.3", - "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0", - "symfony/event-dispatcher": "^3.0 || ^4.0 || ^5.0", - "symfony/filesystem": "^3.0 || ^4.0 || ^5.0", - "symfony/finder": "^3.0 || ^4.0 || ^5.0", - "symfony/options-resolver": "^3.0 || ^4.0 || ^5.0", - "symfony/polyfill-php70": "^1.0", - "symfony/polyfill-php72": "^1.4", - "symfony/process": "^3.0 || ^4.0 || ^5.0", - "symfony/stopwatch": "^3.0 || ^4.0 || ^5.0" - }, - "require-dev": { - "johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0", - "justinrainbow/json-schema": "^5.0", - "keradus/cli-executor": "^1.2", - "mikey179/vfsstream": "^1.6", - "php-coveralls/php-coveralls": "^2.1", - "php-cs-fixer/accessible-object": "^1.0", - "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.1", - "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.1", - "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.1", - "phpunitgoodpractices/traits": "^1.8", - "symfony/phpunit-bridge": "^4.3 || ^5.0", - "symfony/yaml": "^3.0 || ^4.0 || ^5.0" - }, - "suggest": { - "ext-mbstring": "For handling non-UTF8 characters in cache signature.", - "php-cs-fixer/phpunit-constraint-isidenticalstring": "For IsIdenticalString constraint.", - "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "For XmlMatchesXsd constraint.", - "symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible." - }, - "bin": [ - "php-cs-fixer" - ], - "type": "application", - "autoload": { - "psr-4": { - "PhpCsFixer\\": "src/" - }, - "classmap": [ - "tests/Test/AbstractFixerTestCase.php", - "tests/Test/AbstractIntegrationCaseFactory.php", - "tests/Test/AbstractIntegrationTestCase.php", - "tests/Test/Assert/AssertTokensTrait.php", - "tests/Test/IntegrationCase.php", - "tests/Test/IntegrationCaseFactory.php", - "tests/Test/IntegrationCaseFactoryInterface.php", - "tests/Test/InternalIntegrationCaseFactory.php", - "tests/TestCase.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Dariusz Rumiński", - "email": "dariusz.ruminski@gmail.com" - } - ], - "description": "A tool to automatically fix PHP code style", - "time": "2019-11-25T22:10:32+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.7.0", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^4.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", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "time": "2017-10-19T19:58:43+00:00" - }, - { - "name": "paragonie/random_compat", - "version": "v9.99.99", - "source": { - "type": "git", - "url": "https://github.com/paragonie/random_compat.git", - "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", - "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", - "shasum": "" - }, - "require": { - "php": "^7" - }, - "require-dev": { - "phpunit/phpunit": "4.*|5.*", - "vimeo/psalm": "^1" - }, - "suggest": { - "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." - }, - "type": "library", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com" - } - ], - "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", - "keywords": [ - "csprng", - "polyfill", - "pseudorandom", - "random" - ], - "time": "2018-07-02T15:55:56+00:00" - }, - { - "name": "pdepend/pdepend", - "version": "2.7.1", - "source": { - "type": "git", - "url": "https://github.com/pdepend/pdepend.git", - "reference": "daba1cf0a6edaf172fa02a17807ae29f4c1c7471" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/pdepend/pdepend/zipball/daba1cf0a6edaf172fa02a17807ae29f4c1c7471", - "reference": "daba1cf0a6edaf172fa02a17807ae29f4c1c7471", - "shasum": "" - }, - "require": { - "php": ">=5.3.7", - "symfony/config": "^2.3.0|^3|^4|^5", - "symfony/dependency-injection": "^2.3.0|^3|^4|^5", - "symfony/filesystem": "^2.3.0|^3|^4|^5" - }, - "require-dev": { - "easy-doc/easy-doc": "0.0.0 || ^1.2.3", - "gregwar/rst": "^1.0", - "phpunit/phpunit": "^4.8.35|^5.7", - "squizlabs/php_codesniffer": "^2.0.0" - }, - "bin": [ - "src/bin/pdepend" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "PDepend\\": "src/main/php/PDepend" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "Official version of pdepend to be handled with Composer", - "time": "2020-02-08T12:06:13+00:00" - }, - { - "name": "php-cs-fixer/diff", - "version": "v1.3.0", - "source": { - "type": "git", - "url": "https://github.com/PHP-CS-Fixer/diff.git", - "reference": "78bb099e9c16361126c86ce82ec4405ebab8e756" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/78bb099e9c16361126c86ce82ec4405ebab8e756", - "reference": "78bb099e9c16361126c86ce82ec4405ebab8e756", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7.23 || ^6.4.3", - "symfony/process": "^3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "SpacePossum" - } - ], - "description": "sebastian/diff v2 backport support for PHP5.6", - "homepage": "https://github.com/PHP-CS-Fixer", - "keywords": [ - "diff" - ], - "time": "2018-02-15T16:58:55+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "shasum": "" - }, - "require": { - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "^4.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "time": "2017-09-11T18:02:19+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "4.3.4", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/da3fd972d6bafd628114f7e7e036f45944b62e9c", - "reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c", - "shasum": "" - }, - "require": { - "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": { - "doctrine/instantiator": "^1.0.5", - "mockery/mockery": "^1.0", - "phpdocumentor/type-resolver": "0.4.*", - "phpunit/phpunit": "^6.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2019-12-28T18:55:12+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "0.5.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "cf842904952e64e703800d094cdf34e715a8a3ae" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/cf842904952e64e703800d094cdf34e715a8a3ae", - "reference": "cf842904952e64e703800d094cdf34e715a8a3ae", - "shasum": "" - }, - "require": { - "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^1.0", - "phpunit/phpunit": "^6.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "time": "2017-12-30T13:23:38+00:00" - }, - { - "name": "phpmd/phpmd", - "version": "2.6.0", - "source": { - "type": "git", - "url": "https://github.com/phpmd/phpmd.git", - "reference": "4e9924b2c157a3eb64395460fcf56b31badc8374" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpmd/phpmd/zipball/4e9924b2c157a3eb64395460fcf56b31badc8374", - "reference": "4e9924b2c157a3eb64395460fcf56b31badc8374", - "shasum": "" - }, - "require": { - "ext-xml": "*", - "pdepend/pdepend": "^2.5", - "php": ">=5.3.9" - }, - "require-dev": { - "phpunit/phpunit": "^4.0", - "squizlabs/php_codesniffer": "^2.0" - }, - "bin": [ - "src/bin/phpmd" - ], - "type": "project", - "autoload": { - "psr-0": { - "PHPMD\\": "src/main/php" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Manuel Pichler", - "email": "github@manuel-pichler.de", - "homepage": "https://github.com/manuelpichler", - "role": "Project Founder" - }, - { - "name": "Other contributors", - "homepage": "https://github.com/phpmd/phpmd/graphs/contributors", - "role": "Contributors" - }, - { - "name": "Marc Würth", - "email": "ravage@bluewin.ch", - "homepage": "https://github.com/ravage84", - "role": "Project Maintainer" - } - ], - "description": "PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD.", - "homepage": "http://phpmd.org/", - "keywords": [ - "mess detection", - "mess detector", - "pdepend", - "phpmd", - "pmd" - ], - "time": "2017-01-20T14:41:10+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "v1.10.3", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "451c3cd1418cf640de218914901e51b064abb093" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093", - "reference": "451c3cd1418cf640de218914901e51b064abb093", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", - "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0" - }, - "require-dev": { - "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.10.x-dev" - } - }, - "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2020-03-05T15:02:03+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "4.0.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d", - "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-xmlwriter": "*", - "php": "^5.6 || ^7.0", - "phpunit/php-file-iterator": "^1.3", - "phpunit/php-text-template": "^1.2", - "phpunit/php-token-stream": "^1.4.2 || ^2.0", - "sebastian/code-unit-reverse-lookup": "^1.0", - "sebastian/environment": "^1.3.2 || ^2.0", - "sebastian/version": "^1.0 || ^2.0" - }, - "require-dev": { - "ext-xdebug": "^2.1.4", - "phpunit/phpunit": "^5.7" - }, - "suggest": { - "ext-xdebug": "^2.5.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0.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": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2017-04-02T07:44:40+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "1.4.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.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": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2017-11-27T13:52:08+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2015-06-21T13:50:34+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "1.0.9", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-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": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2017-02-26T11:10:40+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "791198a2c6254db10131eecfe8c06670700904db" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", - "reference": "791198a2c6254db10131eecfe8c06670700904db", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.2.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2017-11-27T05:48:46+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "5.7.27", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c", - "reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c", - "shasum": "" - }, - "require": { - "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.4", - "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.4", - "sebastian/diff": "^1.4.3", - "sebastian/environment": "^1.3.4 || ^2.0", - "sebastian/exporter": "~2.0", - "sebastian/global-state": "^1.1", - "sebastian/object-enumerator": "~2.0", - "sebastian/resource-operations": "~1.0", - "sebastian/version": "^1.0.6|^2.0.1", - "symfony/yaml": "~2.1|~3.0|~4.0" - }, - "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2" - }, - "require-dev": { - "ext-pdo": "*" - }, - "suggest": { - "ext-xdebug": "*", - "phpunit/php-invoker": "~1.1" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.7.x-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": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2018-02-01T05:50:59+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "3.4.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "a23b761686d50a560cc56233b9ecf49597cc9118" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/a23b761686d50a560cc56233b9ecf49597cc9118", - "reference": "a23b761686d50a560cc56233b9ecf49597cc9118", - "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" - ], - "abandoned": true, - "time": "2017-06-30T09:13:00+00:00" - }, - { - "name": "psr/container", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], - "time": "2017-02-14T16:28:37+00:00" - }, - { - "name": "psr/log", - "version": "1.1.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801", - "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2019-11-01T11:05:21+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.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": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" - }, - { - "name": "sebastian/comparator", - "version": "1.2.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2017-01-29T09:50:25+00:00" - }, - { - "name": "sebastian/diff", - "version": "1.4.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff" - ], - "time": "2017-05-22T07:24:03+00:00" - }, - { - "name": "sebastian/environment", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2016-11-26T07:53:53+00:00" - }, - { - "name": "sebastian/exporter", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~2.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "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" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2016-11-19T08:54:04+00:00" - }, - { - "name": "sebastian/global-state", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2015-10-12T03:26:01+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7", - "shasum": "" - }, - "require": { - "php": ">=5.6", - "sebastian/recursion-context": "~2.0" - }, - "require-dev": { - "phpunit/phpunit": "~5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-02-18T15:18:39+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-11-19T07:33:16+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "shasum": "" - }, - "require": { - "php": ">=5.6.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": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "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" - }, - { - "name": "sebastian/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-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": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" - }, - { - "name": "symfony/config", - "version": "v3.4.38", - "source": { - "type": "git", - "url": "https://github.com/symfony/config.git", - "reference": "03328d6e172ec7384341c622d4c28d350040d021" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/03328d6e172ec7384341c622d4c28d350040d021", - "reference": "03328d6e172ec7384341c622d4c28d350040d021", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/filesystem": "~2.8|~3.0|~4.0", - "symfony/polyfill-ctype": "~1.8" - }, - "conflict": { - "symfony/dependency-injection": "<3.3", - "symfony/finder": "<3.3" - }, - "require-dev": { - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/event-dispatcher": "~3.3|~4.0", - "symfony/finder": "~3.3|~4.0", - "symfony/yaml": "~3.0|~4.0" - }, - "suggest": { - "symfony/yaml": "To use the yaml reference dumper" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Config\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Config Component", - "homepage": "https://symfony.com", - "time": "2020-02-03T08:11:57+00:00" - }, - { - "name": "symfony/console", - "version": "v3.4.38", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "6827023c5872bea44b29d145de693b21981cf4cd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/6827023c5872bea44b29d145de693b21981cf4cd", - "reference": "6827023c5872bea44b29d145de693b21981cf4cd", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/debug": "~2.8|~3.0|~4.0", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/dependency-injection": "<3.4", - "symfony/process": "<3.3" - }, - "provide": { - "psr/log-implementation": "1.0" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~3.3|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "~2.8|~3.0|~4.0", - "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.3|~4.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "time": "2020-02-15T13:27:16+00:00" - }, - { - "name": "symfony/debug", - "version": "v3.4.38", - "source": { - "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "a99278d50af8a9164219da38d61fb161a7f6e0a6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/a99278d50af8a9164219da38d61fb161a7f6e0a6", - "reference": "a99278d50af8a9164219da38d61fb161a7f6e0a6", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" - }, - "require-dev": { - "symfony/http-kernel": "~2.8|~3.0|~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Debug\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Debug Component", - "homepage": "https://symfony.com", - "time": "2020-02-03T15:10:40+00:00" - }, - { - "name": "symfony/dependency-injection", - "version": "v3.4.38", - "source": { - "type": "git", - "url": "https://github.com/symfony/dependency-injection.git", - "reference": "b06b36883abc61eb8fb576e89102a9ba6c9ee7ee" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/b06b36883abc61eb8fb576e89102a9ba6c9ee7ee", - "reference": "b06b36883abc61eb8fb576e89102a9ba6c9ee7ee", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "psr/container": "^1.0" - }, - "conflict": { - "symfony/config": "<3.3.7", - "symfony/finder": "<3.3", - "symfony/proxy-manager-bridge": "<3.4", - "symfony/yaml": "<3.4" - }, - "provide": { - "psr/container-implementation": "1.0" - }, - "require-dev": { - "symfony/config": "~3.3|~4.0", - "symfony/expression-language": "~2.8|~3.0|~4.0", - "symfony/yaml": "~3.4|~4.0" - }, - "suggest": { - "symfony/config": "", - "symfony/expression-language": "For using expressions in service container configuration", - "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", - "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\DependencyInjection\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony DependencyInjection Component", - "homepage": "https://symfony.com", - "time": "2020-02-19T17:19:43+00:00" - }, - { - "name": "symfony/event-dispatcher", - "version": "v3.4.38", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "2f67a869aef3eecf42e7f8be4a8b86c92308686c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/2f67a869aef3eecf42e7f8be4a8b86c92308686c", - "reference": "2f67a869aef3eecf42e7f8be4a8b86c92308686c", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "conflict": { - "symfony/dependency-injection": "<3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0|~4.0", - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/expression-language": "~2.8|~3.0|~4.0", - "symfony/stopwatch": "~2.8|~3.0|~4.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony EventDispatcher Component", - "homepage": "https://symfony.com", - "time": "2020-02-04T08:04:52+00:00" - }, - { - "name": "symfony/filesystem", - "version": "v3.4.38", - "source": { - "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "0a0d3b4bda11aa3a0464531c40e681e184e75628" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/0a0d3b4bda11aa3a0464531c40e681e184e75628", - "reference": "0a0d3b4bda11aa3a0464531c40e681e184e75628", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-ctype": "~1.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Filesystem Component", - "homepage": "https://symfony.com", - "time": "2020-01-17T08:50:08+00:00" - }, - { - "name": "symfony/finder", - "version": "v3.4.38", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "5ec813ccafa8164ef21757e8c725d3a57da59200" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/5ec813ccafa8164ef21757e8c725d3a57da59200", - "reference": "5ec813ccafa8164ef21757e8c725d3a57da59200", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com", - "time": "2020-02-14T07:34:21+00:00" - }, - { - "name": "symfony/options-resolver", - "version": "v3.4.38", - "source": { - "type": "git", - "url": "https://github.com/symfony/options-resolver.git", - "reference": "730ef56164ed6c9356c159e9f5ff2b84d753b9ed" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/730ef56164ed6c9356c159e9f5ff2b84d753b9ed", - "reference": "730ef56164ed6c9356c159e9f5ff2b84d753b9ed", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\OptionsResolver\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony OptionsResolver Component", - "homepage": "https://symfony.com", - "keywords": [ - "config", - "configuration", - "options" - ], - "time": "2020-01-01T11:03:25+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.14.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", - "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.14-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "time": "2020-01-13T11:15:53+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.14.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/34094cfa9abe1f0f14f48f490772db7a775559f2", - "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.14-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2020-01-13T11:15:53+00:00" - }, - { - "name": "symfony/polyfill-php70", - "version": "v1.14.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "419c4940024c30ccc033650373a1fe13890d3255" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/419c4940024c30ccc033650373a1fe13890d3255", - "reference": "419c4940024c30ccc033650373a1fe13890d3255", - "shasum": "" - }, - "require": { - "paragonie/random_compat": "~1.0|~2.0|~9.99", - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.14-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php70\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2020-01-13T11:15:53+00:00" - }, - { - "name": "symfony/polyfill-php72", - "version": "v1.14.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf", - "reference": "46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.14-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2020-01-13T11:15:53+00:00" - }, - { - "name": "symfony/process", - "version": "v3.4.38", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "b03b02dcea26ba4c65c16a73bab4f00c186b13da" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/b03b02dcea26ba4c65c16a73bab4f00c186b13da", - "reference": "b03b02dcea26ba4c65c16a73bab4f00c186b13da", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Process Component", - "homepage": "https://symfony.com", - "time": "2020-02-04T08:04:52+00:00" - }, - { - "name": "symfony/stopwatch", - "version": "v3.4.38", - "source": { - "type": "git", - "url": "https://github.com/symfony/stopwatch.git", - "reference": "e2d954156d4817c9a5c79f519a71516693a4a9c8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/e2d954156d4817c9a5c79f519a71516693a4a9c8", - "reference": "e2d954156d4817c9a5c79f519a71516693a4a9c8", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Stopwatch\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Stopwatch Component", - "homepage": "https://symfony.com", - "time": "2020-01-01T11:03:25+00:00" - }, - { - "name": "symfony/yaml", - "version": "v3.4.38", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "bc63e15160866e8730a1f738541b194c401f72bf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/bc63e15160866e8730a1f738541b194c401f72bf", - "reference": "bc63e15160866e8730a1f738541b194c401f72bf", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-ctype": "~1.8" - }, - "conflict": { - "symfony/console": "<3.4" - }, - "require-dev": { - "symfony/console": "~3.4|~4.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2020-01-16T19:04:26+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.7.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "aed98a490f9a8f78468232db345ab9cf606cf598" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/aed98a490f9a8f78468232db345ab9cf606cf598", - "reference": "aed98a490f9a8f78468232db345ab9cf606cf598", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "vimeo/psalm": "<3.6.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.5.13" - }, - "type": "library", - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "time": "2020-02-14T12:15:55+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": ">=7.0.0", - "ext-json": "*" - }, - "platform-dev": [] -} diff --git a/src/Adapter/Adapter.php b/src/Adapter/Adapter.php index 44d83c51..5e7bf655 100644 --- a/src/Adapter/Adapter.php +++ b/src/Adapter/Adapter.php @@ -45,7 +45,7 @@ public function get(string $uri, array $data = [], array $headers = []): Respons * * @return mixed */ - public function post(string $uri, array $data = [], array $headers = []): ResponseInterface; + public function post(string $uri, $data = null, array $headers = []): ResponseInterface; /** * @param string $uri @@ -54,7 +54,7 @@ public function post(string $uri, array $data = [], array $headers = []): Respon * * @return mixed */ - public function put(string $uri, array $data = [], array $headers = []): ResponseInterface; + public function put(string $uri, $data = null, array $headers = []): ResponseInterface; /** * @param string $uri @@ -63,7 +63,7 @@ public function put(string $uri, array $data = [], array $headers = []): Respons * * @return mixed */ - public function patch(string $uri, array $data = [], array $headers = []): ResponseInterface; + public function patch(string $uri, $data = null, array $headers = []): ResponseInterface; /** * @param string $uri diff --git a/src/Adapter/Guzzle.php b/src/Adapter/Guzzle.php index 71e7dd75..45e89381 100644 --- a/src/Adapter/Guzzle.php +++ b/src/Adapter/Guzzle.php @@ -6,6 +6,7 @@ use GuzzleHttp\Client; use GuzzleHttp\Exception\RequestException; use Psr\Http\Message\ResponseInterface; +use InvalidArgumentException; class Guzzle implements Adapter { @@ -41,7 +42,7 @@ public function get(string $uri, array $data = [], array $headers = []): Respons /** * @inheritDoc */ - public function post(string $uri, array $data = [], array $headers = []): ResponseInterface + public function post(string $uri, $data = null, array $headers = []): ResponseInterface { return $this->request('post', $uri, $data, $headers); } @@ -49,7 +50,7 @@ public function post(string $uri, array $data = [], array $headers = []): Respon /** * @inheritDoc */ - public function put(string $uri, array $data = [], array $headers = []): ResponseInterface + public function put(string $uri, $data = null, array $headers = []): ResponseInterface { return $this->request('put', $uri, $data, $headers); } @@ -57,7 +58,7 @@ public function put(string $uri, array $data = [], array $headers = []): Respons /** * @inheritDoc */ - public function patch(string $uri, array $data = [], array $headers = []): ResponseInterface + public function patch(string $uri, $data = null, array $headers = []): ResponseInterface { return $this->request('patch', $uri, $data, $headers); } @@ -73,10 +74,10 @@ public function delete(string $uri, array $data = [], array $headers = []): Resp /** * @SuppressWarnings(PHPMD.StaticAccess) */ - public function request(string $method, string $uri, array $data = [], array $headers = []) + public function request(string $method, string $uri, $data = null, array $headers = []) { if (!in_array($method, ['get', 'post', 'put', 'patch', 'delete'])) { - throw new \InvalidArgumentException('Request method must be get, post, put, patch, or delete'); + throw new InvalidArgumentException('Request method must be get, post, put, patch, or delete'); } try { diff --git a/src/Adapter/JSONException.php b/src/Adapter/JSONException.php index e9da7e41..7e152765 100644 --- a/src/Adapter/JSONException.php +++ b/src/Adapter/JSONException.php @@ -8,6 +8,8 @@ namespace Cloudflare\API\Adapter; -class JSONException extends \Exception +use Exception; + +class JSONException extends Exception { } diff --git a/src/Adapter/ResponseException.php b/src/Adapter/ResponseException.php index d1c0ce29..22a8facf 100644 --- a/src/Adapter/ResponseException.php +++ b/src/Adapter/ResponseException.php @@ -8,9 +8,10 @@ namespace Cloudflare\API\Adapter; +use Exception; use GuzzleHttp\Exception\RequestException; -class ResponseException extends \Exception +class ResponseException extends Exception { /** * Generates a ResponseException from a Guzzle RequestException. diff --git a/src/Configurations/ConfigurationsException.php b/src/Configurations/ConfigurationsException.php index 23aade67..bbea6189 100644 --- a/src/Configurations/ConfigurationsException.php +++ b/src/Configurations/ConfigurationsException.php @@ -8,6 +8,8 @@ namespace Cloudflare\API\Configurations; -class ConfigurationsException extends \Exception +use Exception; + +class ConfigurationsException extends Exception { } diff --git a/src/Endpoints/AccessRules.php b/src/Endpoints/AccessRules.php index 07bc31c2..b4354c9b 100644 --- a/src/Endpoints/AccessRules.php +++ b/src/Endpoints/AccessRules.php @@ -5,6 +5,7 @@ use Cloudflare\API\Adapter\Adapter; use Cloudflare\API\Configurations\Configurations; use Cloudflare\API\Traits\BodyAccessorTrait; +use stdClass; class AccessRules implements API { @@ -31,7 +32,7 @@ public function __construct(Adapter $adapter) * @param string $direction * @param string $match * @param string $notes - * @return \stdClass + * @return stdClass */ public function listRules( string $zoneID, @@ -45,7 +46,7 @@ public function listRules( string $direction = '', string $match = 'all', string $notes = '' - ): \stdClass { + ): stdClass { $query = [ 'page' => $page, 'per_page' => $perPage, diff --git a/src/Endpoints/AccountMembers.php b/src/Endpoints/AccountMembers.php index ec9e90a2..e87c3599 100644 --- a/src/Endpoints/AccountMembers.php +++ b/src/Endpoints/AccountMembers.php @@ -4,6 +4,7 @@ use Cloudflare\API\Adapter\Adapter; use Cloudflare\API\Traits\BodyAccessorTrait; +use stdClass; class AccountMembers implements API { @@ -19,7 +20,7 @@ public function __construct(Adapter $adapter) $this->adapter = $adapter; } - public function addAccountMember(string $accountId, string $email, array $roles): \stdClass + public function addAccountMember(string $accountId, string $email, array $roles): stdClass { $options = [ 'email' => $email, @@ -32,7 +33,7 @@ public function addAccountMember(string $accountId, string $email, array $roles) return $this->body->result; } - public function listAccountMembers(string $accountId, int $page = 1, int $perPage = 20): \stdClass + public function listAccountMembers(string $accountId, int $page = 1, int $perPage = 20): stdClass { $query = [ 'page' => $page, diff --git a/src/Endpoints/Accounts.php b/src/Endpoints/Accounts.php index 838afb9c..3925881f 100644 --- a/src/Endpoints/Accounts.php +++ b/src/Endpoints/Accounts.php @@ -9,6 +9,7 @@ use Cloudflare\API\Adapter\Adapter; use Cloudflare\API\Traits\BodyAccessorTrait; +use stdClass; class Accounts implements API { @@ -21,7 +22,7 @@ public function __construct(Adapter $adapter) $this->adapter = $adapter; } - public function addAccount(string $name, string $type = 'standard'): \stdClass + public function addAccount(string $name, string $type = 'standard'): stdClass { $options = [ 'name' => $name, @@ -38,7 +39,7 @@ public function listAccounts( int $page = 1, int $perPage = 20, string $direction = '' - ): \stdClass { + ): stdClass { $query = [ 'page' => $page, 'per_page' => $perPage @@ -63,7 +64,7 @@ public function getDomains(string $accountID): array return $this->body->result; } - public function getDomainDetails(string $accountID, string $domainName): \stdClass + public function getDomainDetails(string $accountID, string $domainName): stdClass { $response = $this->adapter->get('accounts/' . $accountID . '/registrar/domains/' . $domainName); @@ -72,14 +73,14 @@ public function getDomainDetails(string $accountID, string $domainName): \stdCla return $this->body->result; } - public function lockDomain(string $accountID, string $domainName): \stdClass + public function lockDomain(string $accountID, string $domainName): stdClass { $response = $this->adapter->put('accounts/' . $accountID . '/registrar/domains/' . $domainName, ['locked' => true]); $this->body = json_decode($response->getBody()); return $this->body; } - public function unlockDomain(string $accountID, string $domainName): \stdClass + public function unlockDomain(string $accountID, string $domainName): stdClass { $response = $this->adapter->put('accounts/' . $accountID . '/registrar/domains/' . $domainName, ['locked' => false]); $this->body = json_decode($response->getBody()); diff --git a/src/Endpoints/Certificates.php b/src/Endpoints/Certificates.php index a1888b5e..f26106bb 100644 --- a/src/Endpoints/Certificates.php +++ b/src/Endpoints/Certificates.php @@ -5,6 +5,7 @@ use Cloudflare\API\Adapter\Adapter; use Cloudflare\API\Configurations\Certificate as CertificateConfig; use Cloudflare\API\Traits\BodyAccessorTrait; +use stdClass; class Certificates implements API { @@ -23,7 +24,7 @@ public function __construct(Adapter $adapter) * @param string $zoneID * @return array */ - public function listCertificates(string $zoneID): \stdClass + public function listCertificates(string $zoneID): stdClass { $certificates = $this->adapter->get('certificates', ['zone_id' => $zoneID]); $this->body = json_decode($certificates->getBody()); diff --git a/src/Endpoints/CustomHostnames.php b/src/Endpoints/CustomHostnames.php index 7a0d2de3..f59301ae 100644 --- a/src/Endpoints/CustomHostnames.php +++ b/src/Endpoints/CustomHostnames.php @@ -10,6 +10,7 @@ use Cloudflare\API\Adapter\Adapter; use Cloudflare\API\Traits\BodyAccessorTrait; +use stdClass; class CustomHostnames implements API { @@ -35,7 +36,7 @@ public function __construct(Adapter $adapter) * @param bool $wildcard * @param string $bundleMethod * @param array $customSsl - * @return \stdClass + * @return stdClass */ public function addHostname( string $zoneID, @@ -47,7 +48,7 @@ public function addHostname( bool $wildcard = false, string $bundleMethod = '', array $customSsl = [] - ): \stdClass { + ): stdClass { $options = [ 'hostname' => $hostname, 'ssl' => [ @@ -88,7 +89,7 @@ public function addHostname( * @param string $order * @param string $direction * @param int $ssl - * @return \stdClass + * @return stdClass */ public function listHostnames( string $zoneID, @@ -99,7 +100,7 @@ public function listHostnames( string $order = '', string $direction = '', int $ssl = 0 - ): \stdClass { + ): stdClass { $query = [ 'page' => $page, 'per_page' => $perPage, @@ -155,7 +156,7 @@ public function getHostname(string $zoneID, string $hostnameID) * @param bool|null $wildcard * @param string $bundleMethod * @param array $customSsl - * @return \stdClass + * @return stdClass */ public function updateHostname( string $zoneID, @@ -167,7 +168,7 @@ public function updateHostname( bool $wildcard = null, string $bundleMethod = '', array $customSsl = [] - ): \stdClass { + ): stdClass { $query = []; $options = []; @@ -217,9 +218,9 @@ public function updateHostname( /** * @param string $zoneID * @param string $hostnameID - * @return \stdClass + * @return stdClass */ - public function deleteHostname(string $zoneID, string $hostnameID): \stdClass + public function deleteHostname(string $zoneID, string $hostnameID): stdClass { $zone = $this->adapter->delete('zones/'.$zoneID.'/custom_hostnames/'.$hostnameID); $this->body = json_decode($zone->getBody()); @@ -228,9 +229,9 @@ public function deleteHostname(string $zoneID, string $hostnameID): \stdClass /** * @param string $zoneID - * @return \stdClass + * @return stdClass */ - public function getFallbackOrigin(string $zoneID): \stdClass + public function getFallbackOrigin(string $zoneID): stdClass { $zone = $this->adapter->get('zones/'.$zoneID.'/custom_hostnames/fallback_origin'); $this->body = json_decode($zone->getBody()); diff --git a/src/Endpoints/DNS.php b/src/Endpoints/DNS.php index a9f74749..ca527065 100644 --- a/src/Endpoints/DNS.php +++ b/src/Endpoints/DNS.php @@ -10,6 +10,7 @@ use Cloudflare\API\Adapter\Adapter; use Cloudflare\API\Traits\BodyAccessorTrait; +use stdClass; class DNS implements API { @@ -85,7 +86,7 @@ public function listRecords( string $order = '', string $direction = '', string $match = 'all' - ): \stdClass { + ): stdClass { $query = [ 'page' => $page, 'per_page' => $perPage, @@ -118,7 +119,7 @@ public function listRecords( return (object)['result' => $this->body->result, 'result_info' => $this->body->result_info]; } - public function getRecordDetails(string $zoneID, string $recordID): \stdClass + public function getRecordDetails(string $zoneID, string $recordID): stdClass { $user = $this->adapter->get('zones/' . $zoneID . '/dns_records/' . $recordID); $this->body = json_decode($user->getBody()); @@ -134,7 +135,7 @@ public function getRecordID(string $zoneID, string $type = '', string $name = '' return false; } - public function updateRecordDetails(string $zoneID, string $recordID, array $details): \stdClass + public function updateRecordDetails(string $zoneID, string $recordID, array $details): stdClass { $response = $this->adapter->put('zones/' . $zoneID . '/dns_records/' . $recordID, $details); $this->body = json_decode($response->getBody()); diff --git a/src/Endpoints/DNSAnalytics.php b/src/Endpoints/DNSAnalytics.php index bad07ee7..2c9fdb72 100644 --- a/src/Endpoints/DNSAnalytics.php +++ b/src/Endpoints/DNSAnalytics.php @@ -11,6 +11,7 @@ use Cloudflare\API\Adapter\Adapter; use Cloudflare\API\Traits\BodyAccessorTrait; use Cloudflare\API\Configurations\DNSAnalytics as Configs; +use stdClass; class DNSAnalytics implements API { @@ -45,7 +46,7 @@ public function getReportTable( string $since = '', string $until = '', int $limit = 100 - ): \stdClass { + ): stdClass { if (count($dimensions) === 0) { throw new EndpointException( 'At least one dimension is required for getting a report.' @@ -122,7 +123,7 @@ public function getReportByTime( string $until = '', int $limit = 100, string $timeDelta = '' - ): \stdClass { + ): stdClass { $options = new Configs(); $options->setDimensions($dimensions); $options->setMetrics($metrics); diff --git a/src/Endpoints/EndpointException.php b/src/Endpoints/EndpointException.php index 2855e004..0a84c2ec 100644 --- a/src/Endpoints/EndpointException.php +++ b/src/Endpoints/EndpointException.php @@ -8,6 +8,8 @@ namespace Cloudflare\API\Endpoints; -class EndpointException extends \Exception +use Exception; + +class EndpointException extends Exception { } diff --git a/src/Endpoints/Firewall.php b/src/Endpoints/Firewall.php index 14ebb761..ba7211b2 100644 --- a/src/Endpoints/Firewall.php +++ b/src/Endpoints/Firewall.php @@ -4,6 +4,7 @@ use Cloudflare\API\Adapter\Adapter; use Cloudflare\API\Configurations\FirewallRuleOptions; +use stdClass; class Firewall implements API { @@ -59,7 +60,7 @@ public function listFirewallRules( string $zoneID, int $page = 1, int $perPage = 50 - ): \stdClass { + ): stdClass { $query = [ 'page' => $page, 'per_page' => $perPage, @@ -94,7 +95,7 @@ public function updateFirewallRule( FirewallRuleOptions $options, string $description = null, int $priority = null - ): \stdClass { + ): stdClass { $rule = array_merge([ 'id' => $ruleID, 'filter' => [ diff --git a/src/Endpoints/IPs.php b/src/Endpoints/IPs.php index 16ad2fef..e8d2a687 100644 --- a/src/Endpoints/IPs.php +++ b/src/Endpoints/IPs.php @@ -10,6 +10,7 @@ use Cloudflare\API\Adapter\Adapter; use Cloudflare\API\Traits\BodyAccessorTrait; +use stdClass; class IPs implements API { @@ -22,7 +23,7 @@ public function __construct(Adapter $adapter) $this->adapter = $adapter; } - public function listIPs(): \stdClass + public function listIPs(): stdClass { $ips = $this->adapter->get('ips'); $this->body = json_decode($ips->getBody()); diff --git a/src/Endpoints/KeyValue.php b/src/Endpoints/KeyValue.php new file mode 100644 index 00000000..4f5f84b0 --- /dev/null +++ b/src/Endpoints/KeyValue.php @@ -0,0 +1,133 @@ +adapter = $adapter; + } + + public function listKeys(string $accountId, string $namespaceId, int $limit = null, string $cursor = null, string $prefix = null): stdClass + { + $uri = sprintf('accounts/%s/storage/kv/namespaces/%s/keys', $accountId, $namespaceId); + $query = [ + 'limit' => $limit, + 'cursor' => $cursor, + 'prefix' => $prefix + ]; + $body = $this->request('get', $uri, $query); + + return (object)[ + 'result' => $body->result, + 'result_info' => $body->result_info, + ]; + } + + public function getKeyValue(string $accountId, string $namespaceId, string $key) + { + $uri = sprintf('accounts/%s/storage/kv/namespaces/%s/values/%s', $accountId, $namespaceId, $key); + return $this->request('get', $uri); + } + + public function getKeyMetadata(string $accountId, string $namespaceId, string $key): ?stdClass + { + $uri = sprintf('accounts/%s/storage/kv/namespaces/%s/metadata/%s', $accountId, $namespaceId, $key); + $body = $this->request('get', $uri); + + return $body->result; + } + + public function setKeyValue(string $accountId, string $namespaceId, string $key, $value, array $metadata = [], int $expiration = null, int $expirationTtl = null): bool + { + $uri = sprintf('accounts/%s/storage/kv/namespaces/%s/values/%s', $accountId, $namespaceId, $key); + $query = [ + 'expiration' => $expiration, + 'expiration_ttl' => $expirationTtl, + ]; + + $headers = ['Content-Type' => 'text/plain']; + $data = $value; + + if (!empty($metadata)) { + $headers['Content-Type'] = 'multipart/form-data'; + $data = ['value' => $value, 'metadata' => $metadata]; + } + + $body = $this->request('put', $uri, $query, $data, $headers); + + return $body->success; + } + + public function setMultipleKeysValues(string $accountId, string $namespaceId, array $data, array $metadata = [], int $expiration = null, int $expirationTtl = null): bool + { + $uri = sprintf('accounts/%s/storage/kv/namespaces/%s/bulk', $accountId, $namespaceId); + $bulkData = []; + + foreach ($data as $key => $value) { + $bulkData[] = [ + 'key' => $key, + 'value' => $value, + 'expiration' => $expiration, + 'expiration_ttl' => $expirationTtl, + 'metadata' => $metadata + ]; + } + + $body = $this->request('put', $uri, [], $bulkData, ['Content-Type' => 'application/json']); + + return $body->success; + } + + public function deleteKey(string $accountId, string $namespaceId, string $key): bool + { + $uri = sprintf('accounts/%s/storage/kv/namespaces/%s/values/%s', $accountId, $namespaceId, $key); + + $body = $this->request('delete', $uri); + + return $body->success; + } + + public function deleteMultipleKeys(string $accountId, string $namespaceId, array $keys): bool + { + $uri = sprintf('accounts/%s/storage/kv/namespaces/%s/bulk', $accountId, $namespaceId); + + $body = $this->request('delete', $uri, [], $keys, ['Content-Type' => 'application/json']); + + return $body->success; + } + + protected function request(string $method, string $uri, array $query = [], $data = [], array $headers = []) + { + $method = strtolower($method); + if (!empty($query)) { + $uri .= '?' . http_build_query($query); + } + $response = $this->adapter->{$method}($uri, $data, $headers); + $body = json_decode($response->getBody()); + + if ($body === null) { + $body = (string) $response->getBody(); + } elseif (isset($body->success) && $body->success !== true) { + if (!empty($body->errors)) { + throw new KeyValueException($body->errors[0]->message, $body->errors[0]->code); + } + + throw new KeyValueException('unknown error: ' . $response->getBody()); + } + + return $body; + } +} diff --git a/src/Endpoints/KeyValueException.php b/src/Endpoints/KeyValueException.php new file mode 100644 index 00000000..5781c30c --- /dev/null +++ b/src/Endpoints/KeyValueException.php @@ -0,0 +1,59 @@ + 'service temporarily unavailable', + 10002 => 'missing CF-Ray header', + 10003 => 'missing account public ID', + 10004 => 'missing account tag', + 10005 => 'URL parameter account tag does not match JWT account tag', + 10006 => 'malformed account tag', + 10007 => 'malformed page argument', + 10008 => 'malformed per_page argument', + 10009 => 'key not found', + 10010 => 'malformed namespace', + 10011 => 'malformed namespace ID', + 10012 => 'malformed value', + 10013 => 'namespace not found', + 10014 => 'namespace already exists', + 10015 => 'missing account internal ID', + 10016 => 'malformed account internal ID', + 10018 => 'too many namespaces in this account', + 10019 => 'missing title', + 10021 => 'this namespace does not support the list-keys endpoint', + 10022 => 'too many requests', + 10024 => 'payload too large', + 10025 => 'endpoint does not exist', + 10026 => 'not entitled', + 10028 => 'invalid limit argument', + 10029 => 'invalid request', + 10030 => 'key too long', + 10033 => 'invalid expiration', + 10034 => 'invalid expiration ttl', + 10035 => 'this namespace does not support the bulk endpoint', + 10037 => 'the user lacks the permissions to perform this operation', + 10038 => 'this namespace does not support the list-keys prefix parameter', + 10041 => 'invalid "list keys" cursor', + 10042 => 'illegal key name', + 10043 => 'invalid order', + 10044 => 'invalid direction', + 10045 => 'deprecated endpoint', + 10046 => 'too many bulk requests', + 10047 => 'invalid metadata', + 10048 => 'free limit reached' + ]; + + public function __construct($message = "", $code = 0, Throwable $previous = null) + { + if (empty($message) && isset($this->codeMessageMap[$code])) { + $message = $this->codeMessageMap[$code]; + } + + parent::__construct($message, $code, $previous); + } +} diff --git a/src/Endpoints/Membership.php b/src/Endpoints/Membership.php index 6a783cb8..3e0a40ec 100644 --- a/src/Endpoints/Membership.php +++ b/src/Endpoints/Membership.php @@ -4,6 +4,7 @@ use Cloudflare\API\Adapter\Adapter; use Cloudflare\API\Traits\BodyAccessorTrait; +use stdClass; /* A list of memberships of accounts this user can access */ @@ -26,7 +27,7 @@ public function listMemberships( int $perPage = 20, string $order = '', string $direction = '' - ): \stdClass { + ): stdClass { $query = [ 'page' => $page, 'per_page' => $perPage @@ -54,14 +55,14 @@ public function listMemberships( return (object)['result' => $this->body->result, 'result_info' => $this->body->result_info]; } - public function getMembershipDetails(string $membershipId): \stdClass + public function getMembershipDetails(string $membershipId): stdClass { $membership = $this->adapter->get(sprintf('memberships/%s', $membershipId)); $this->body = json_decode($membership->getBody()); return $this->body->result; } - public function updateMembershipStatus(string $membershipId, string $status): \stdClass + public function updateMembershipStatus(string $membershipId, string $status): stdClass { $response = $this->adapter->put(sprintf('memberships/%s', $membershipId), ['status' => $status]); $this->body = json_decode($response->getBody()); diff --git a/src/Endpoints/PageRules.php b/src/Endpoints/PageRules.php index c7e59644..5454fbc4 100644 --- a/src/Endpoints/PageRules.php +++ b/src/Endpoints/PageRules.php @@ -12,6 +12,7 @@ use Cloudflare\API\Configurations\PageRulesActions; use Cloudflare\API\Configurations\PageRulesTargets; use Cloudflare\API\Traits\BodyAccessorTrait; +use stdClass; class PageRules implements API { @@ -102,7 +103,7 @@ public function listPageRules( return $this->body->result; } - public function getPageRuleDetails(string $zoneID, string $ruleID): \stdClass + public function getPageRuleDetails(string $zoneID, string $ruleID): stdClass { $user = $this->adapter->get('zones/' . $zoneID . '/pagerules/' . $ruleID); $this->body = json_decode($user->getBody()); diff --git a/src/Endpoints/Railgun.php b/src/Endpoints/Railgun.php index 8ba31820..81638b8c 100644 --- a/src/Endpoints/Railgun.php +++ b/src/Endpoints/Railgun.php @@ -10,6 +10,7 @@ use Cloudflare\API\Adapter\Adapter; use Cloudflare\API\Traits\BodyAccessorTrait; +use stdClass; class Railgun implements API { @@ -24,7 +25,7 @@ public function __construct(Adapter $adapter) public function create( string $name - ): \stdClass { + ): stdClass { $query = [ 'name' => $name, ]; @@ -39,7 +40,7 @@ public function list( int $page = 1, int $perPage = 20, string $direction = '' - ): \stdClass { + ): stdClass { $query = [ 'page' => $page, 'per_page' => $perPage @@ -57,7 +58,7 @@ public function list( public function get( string $railgunID - ): \stdClass { + ): stdClass { $user = $this->adapter->get('railguns/' . $railgunID); $this->body = json_decode($user->getBody()); @@ -66,7 +67,7 @@ public function get( public function getZones( string $railgunID - ): \stdClass { + ): stdClass { $user = $this->adapter->get('railguns/' . $railgunID . '/zones'); $this->body = json_decode($user->getBody()); @@ -76,7 +77,7 @@ public function getZones( public function update( string $railgunID, bool $status - ): \stdClass { + ): stdClass { $query = [ 'enabled' => $status ]; diff --git a/src/Endpoints/UARules.php b/src/Endpoints/UARules.php index 8c7bfd9c..538b0c9d 100644 --- a/src/Endpoints/UARules.php +++ b/src/Endpoints/UARules.php @@ -11,6 +11,7 @@ use Cloudflare\API\Configurations\Configurations; use Cloudflare\API\Adapter\Adapter; use Cloudflare\API\Traits\BodyAccessorTrait; +use stdClass; class UARules implements API { @@ -27,7 +28,7 @@ public function listRules( string $zoneID, int $page = 1, int $perPage = 20 - ): \stdClass { + ): stdClass { $query = [ 'page' => $page, 'per_page' => $perPage @@ -70,7 +71,7 @@ public function createRule( return false; } - public function getRuleDetails(string $zoneID, string $blockID): \stdClass + public function getRuleDetails(string $zoneID, string $blockID): stdClass { $user = $this->adapter->get('zones/' . $zoneID . '/firewall/ua_rules/' . $blockID); $this->body = json_decode($user->getBody()); diff --git a/src/Endpoints/User.php b/src/Endpoints/User.php index 93d38267..c31096dc 100644 --- a/src/Endpoints/User.php +++ b/src/Endpoints/User.php @@ -9,6 +9,7 @@ use Cloudflare\API\Adapter\Adapter; use Cloudflare\API\Traits\BodyAccessorTrait; +use stdClass; class User implements API { @@ -21,7 +22,7 @@ public function __construct(Adapter $adapter) $this->adapter = $adapter; } - public function getUserDetails(): \stdClass + public function getUserDetails(): stdClass { $user = $this->adapter->get('user'); $this->body = json_decode($user->getBody()); @@ -38,7 +39,7 @@ public function getUserEmail(): string return $this->getUserDetails()->email; } - public function updateUserDetails(array $details): \stdClass + public function updateUserDetails(array $details): stdClass { $response = $this->adapter->patch('user', $details); $this->body = json_decode($response->getBody()); diff --git a/src/Endpoints/WAF.php b/src/Endpoints/WAF.php index b1e3611f..09ae75c2 100644 --- a/src/Endpoints/WAF.php +++ b/src/Endpoints/WAF.php @@ -10,6 +10,7 @@ use Cloudflare\API\Adapter\Adapter; use Cloudflare\API\Traits\BodyAccessorTrait; +use stdClass; class WAF implements API { @@ -29,7 +30,7 @@ public function getPackages( string $order = '', string $direction = '', string $match = 'all' - ): \stdClass { + ): stdClass { $query = [ 'page' => $page, 'per_page' => $perPage, @@ -54,7 +55,7 @@ public function getPackages( public function getPackageInfo( string $zoneID, string $packageID - ): \stdClass { + ): stdClass { $user = $this->adapter->get('zones/' . $zoneID . '/firewall/waf/packages/' . $packageID); $this->body = json_decode($user->getBody()); @@ -69,7 +70,7 @@ public function getRules( string $order = '', string $direction = '', string $match = 'all' - ): \stdClass { + ): stdClass { $query = [ 'page' => $page, 'per_page' => $perPage, @@ -93,7 +94,7 @@ public function getRuleInfo( string $zoneID, string $packageID, string $ruleID - ): \stdClass { + ): stdClass { $user = $this->adapter->get('zones/' . $zoneID . '/firewall/waf/packages/' . $packageID . '/rules/' . $ruleID); $this->body = json_decode($user->getBody()); @@ -105,7 +106,7 @@ public function updateRule( string $packageID, string $ruleID, string $status - ): \stdClass { + ): stdClass { $query = [ 'mode' => $status, ]; @@ -127,7 +128,7 @@ public function getGroups( string $order = '', string $direction = '', string $match = 'all' - ): \stdClass { + ): stdClass { $query = [ 'page' => $page, 'per_page' => $perPage, @@ -155,7 +156,7 @@ public function getGroupInfo( string $zoneID, string $packageID, string $groupID - ): \stdClass { + ): stdClass { $user = $this->adapter->get('zones/' . $zoneID . '/firewall/waf/packages/' . $packageID . '/groups/' . $groupID); $this->body = json_decode($user->getBody()); @@ -167,7 +168,7 @@ public function updateGroup( string $packageID, string $groupID, string $status - ): \stdClass { + ): stdClass { $query = [ 'mode' => $status ]; diff --git a/src/Endpoints/ZoneLockdown.php b/src/Endpoints/ZoneLockdown.php index aeccb254..2a6f03d6 100644 --- a/src/Endpoints/ZoneLockdown.php +++ b/src/Endpoints/ZoneLockdown.php @@ -10,6 +10,7 @@ use Cloudflare\API\Adapter\Adapter; use Cloudflare\API\Traits\BodyAccessorTrait; +use stdClass; class ZoneLockdown implements API { @@ -26,7 +27,7 @@ public function listLockdowns( string $zoneID, int $page = 1, int $perPage = 20 - ): \stdClass { + ): stdClass { $query = [ 'page' => $page, 'per_page' => $perPage @@ -69,7 +70,7 @@ public function createLockdown( return false; } - public function getLockdownDetails(string $zoneID, string $lockdownID): \stdClass + public function getLockdownDetails(string $zoneID, string $lockdownID): stdClass { $user = $this->adapter->get('zones/' . $zoneID . '/firewall/lockdowns/' . $lockdownID); $this->body = json_decode($user->getBody()); diff --git a/src/Endpoints/ZoneSubscriptions.php b/src/Endpoints/ZoneSubscriptions.php index 6149dd91..87e261fc 100644 --- a/src/Endpoints/ZoneSubscriptions.php +++ b/src/Endpoints/ZoneSubscriptions.php @@ -20,7 +20,7 @@ public function __construct(Adapter $adapter) $this->adapter = $adapter; } - public function listZoneSubscriptions(string $zoneId): \stdClass + public function listZoneSubscriptions(string $zoneId): stdClass { $user = $this->adapter->get('zones/' . $zoneId . '/subscriptions'); $this->body = json_decode($user->getBody()); diff --git a/src/Endpoints/Zones.php b/src/Endpoints/Zones.php index fd9e18b0..8dbc30ad 100644 --- a/src/Endpoints/Zones.php +++ b/src/Endpoints/Zones.php @@ -10,6 +10,7 @@ use Cloudflare\API\Adapter\Adapter; use Cloudflare\API\Traits\BodyAccessorTrait; +use stdClass; class Zones implements API { @@ -28,9 +29,9 @@ public function __construct(Adapter $adapter) * @param string $name * @param bool $jumpStart * @param string $accountId - * @return \stdClass + * @return stdClass */ - public function addZone(string $name, bool $jumpStart = false, string $accountId = ''): \stdClass + public function addZone(string $name, bool $jumpStart = false, string $accountId = ''): stdClass { $options = [ 'name' => $name, @@ -86,7 +87,7 @@ public function unpause(string $zoneID): bool public function getZoneById( string $zoneId - ): \stdClass { + ): stdClass { $user = $this->adapter->get('zones/' . $zoneId); $this->body = json_decode($user->getBody()); @@ -101,7 +102,7 @@ public function listZones( string $order = '', string $direction = '', string $match = 'all' - ): \stdClass { + ): stdClass { $query = [ 'page' => $page, 'per_page' => $perPage, @@ -148,9 +149,9 @@ public function getZoneID(string $name = ''): string * @param string $since * @param string $until * @param bool $continuous - * @return \stdClass + * @return stdClass */ - public function getAnalyticsDashboard(string $zoneID, string $since = '-10080', string $until = '0', bool $continuous = true): \stdClass + public function getAnalyticsDashboard(string $zoneID, string $since = '-10080', string $until = '0', bool $continuous = true): stdClass { $response = $this->adapter->get('zones/' . $zoneID . '/analytics/dashboard', ['since' => $since, 'until' => $until, 'continuous' => var_export($continuous, true)]); diff --git a/tests/Adapter/GuzzleTest.php b/tests/Adapter/GuzzleTest.php index 25208df1..c4f43d8f 100644 --- a/tests/Adapter/GuzzleTest.php +++ b/tests/Adapter/GuzzleTest.php @@ -1,21 +1,23 @@ getMockBuilder(\Cloudflare\API\Auth\Auth::class) + $auth = $this->getMockBuilder(Auth::class) ->setMethods(['getHeaders']) ->getMock(); $auth->method('getHeaders') ->willReturn(['X-Testing' => 'Test']); - $this->client = new \Cloudflare\API\Adapter\Guzzle($auth, 'https://httpbin.org/'); + $this->client = new Guzzle($auth, 'https://httpbin.org/'); } public function testGet() diff --git a/tests/Auth/APIKeyTest.php b/tests/Auth/APIKeyTest.php index 10a788bb..3e556c13 100644 --- a/tests/Auth/APIKeyTest.php +++ b/tests/Auth/APIKeyTest.php @@ -1,5 +1,7 @@ getHeaders(); $this->assertArrayHasKey('X-Auth-Key', $headers); diff --git a/tests/Auth/APITokenTest.php b/tests/Auth/APITokenTest.php index ea7ec3c3..016af31d 100644 --- a/tests/Auth/APITokenTest.php +++ b/tests/Auth/APITokenTest.php @@ -1,5 +1,7 @@ getHeaders(); $this->assertArrayHasKey('Authorization', $headers); diff --git a/tests/Auth/NoneTest.php b/tests/Auth/NoneTest.php index 7e46b42b..55af9e72 100644 --- a/tests/Auth/NoneTest.php +++ b/tests/Auth/NoneTest.php @@ -1,4 +1,7 @@ getHeaders(); $this->assertEquals([], $headers); diff --git a/tests/Auth/UserServiceKeyTest.php b/tests/Auth/UserServiceKeyTest.php index 53e29b30..f450c5c7 100644 --- a/tests/Auth/UserServiceKeyTest.php +++ b/tests/Auth/UserServiceKeyTest.php @@ -1,5 +1,7 @@ getHeaders(); $this->assertArrayHasKey('X-Auth-User-Service-Key', $headers); diff --git a/tests/Configurations/ConfigurationsUARulesTest.php b/tests/Configurations/ConfigurationsUARulesTest.php index bd6d45b2..03ad4a1e 100644 --- a/tests/Configurations/ConfigurationsUARulesTest.php +++ b/tests/Configurations/ConfigurationsUARulesTest.php @@ -1,5 +1,7 @@ addUA('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.4'); $array = $configuration->getArray(); diff --git a/tests/Configurations/ConfigurationsZoneLockdownTest.php b/tests/Configurations/ConfigurationsZoneLockdownTest.php index 7614042b..4d4daabc 100644 --- a/tests/Configurations/ConfigurationsZoneLockdownTest.php +++ b/tests/Configurations/ConfigurationsZoneLockdownTest.php @@ -1,5 +1,7 @@ addIP('1.2.3.4'); $array = $configuration->getArray(); diff --git a/tests/Configurations/LoadBalancerTest.php b/tests/Configurations/LoadBalancerTest.php index 96b3d1e7..b214ba7d 100644 --- a/tests/Configurations/LoadBalancerTest.php +++ b/tests/Configurations/LoadBalancerTest.php @@ -11,7 +11,7 @@ class LoadBalancerTest extends TestCase { /** - * @dataProvider testArgumentsDataProvider + * @dataProvider argumentsDataProvider */ public function testArguments($setFunction, $arguments, $getFunction, $invalid) { @@ -30,7 +30,7 @@ public function testArguments($setFunction, $arguments, $getFunction, $invalid) } } - public function testArgumentsDataProvider() + public function argumentsDataProvider(): array { return [ 'steeringPolicy arguments valid' => [ diff --git a/tests/Configurations/PoolTest.php b/tests/Configurations/PoolTest.php index 204b392c..ad1a7320 100644 --- a/tests/Configurations/PoolTest.php +++ b/tests/Configurations/PoolTest.php @@ -11,7 +11,7 @@ class PoolTest extends TestCase { /** - * @dataProvider testArgumentsDataProvider + * @dataProvider argumentsDataProvider */ public function testArguments($setFunction, $arguments, $getFunction, $invalid) { @@ -30,7 +30,7 @@ public function testArguments($setFunction, $arguments, $getFunction, $invalid) } } - public function testArgumentsDataProvider() + public function argumentsDataProvider(): array { return [ 'origins arguments valid' => [ diff --git a/tests/Endpoints/AccessRulesTest.php b/tests/Endpoints/AccessRulesTest.php index fbe4bd48..28d27e86 100644 --- a/tests/Endpoints/AccessRulesTest.php +++ b/tests/Endpoints/AccessRulesTest.php @@ -1,12 +1,16 @@ getPsr7JsonResponseForFixture('Endpoints/listAccessRules.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -20,7 +24,7 @@ public function testListRules() ]) ); - $zones = new \Cloudflare\API\Endpoints\AccessRules($mock); + $zones = new AccessRules($mock); $result = $zones->listRules('023e105f4ecef8ad9ca31a8372d0c353'); $this->assertObjectHasAttribute('result', $result); @@ -33,12 +37,12 @@ public function testListRules() public function testCreateRule() { - $config = new \Cloudflare\API\Configurations\AccessRules(); + $config = new ConfigurationAccessRules(); $config->setIP('1.2.3.4'); $response = $this->getPsr7JsonResponseForFixture('Endpoints/createAccessRule.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('post')->willReturn($response); $mock->expects($this->once()) @@ -52,7 +56,7 @@ public function testCreateRule() ]) ); - $rules = new \Cloudflare\API\Endpoints\AccessRules($mock); + $rules = new AccessRules($mock); $rules->createRule( '023e105f4ecef8ad9ca31a8372d0c353', 'challenge', @@ -66,7 +70,7 @@ public function testUpdateRule() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/updateAccessRule.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('patch')->willReturn($response); $mock->expects($this->once()) @@ -79,7 +83,7 @@ public function testUpdateRule() ]) ); - $rules = new \Cloudflare\API\Endpoints\AccessRules($mock); + $rules = new AccessRules($mock); $rules->updateRule( '023e105f4ecef8ad9ca31a8372d0c353', '92f17202ed8bd63d69a66b86a49a8f6b', @@ -93,7 +97,7 @@ public function testDeleteRule() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/deleteAccessRule.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('delete')->willReturn($response); $mock->expects($this->once()) @@ -105,7 +109,7 @@ public function testDeleteRule() ]) ); - $rules = new \Cloudflare\API\Endpoints\AccessRules($mock); + $rules = new AccessRules($mock); $rules->deleteRule('023e105f4ecef8ad9ca31a8372d0c353', '92f17202ed8bd63d69a66b86a49a8f6b'); $this->assertEquals('92f17202ed8bd63d69a66b86a49a8f6b', $rules->getBody()->result->id); } diff --git a/tests/Endpoints/AccountMembersTest.php b/tests/Endpoints/AccountMembersTest.php index 431e2634..48d8069c 100644 --- a/tests/Endpoints/AccountMembersTest.php +++ b/tests/Endpoints/AccountMembersTest.php @@ -9,7 +9,7 @@ public function testAddAccountMember() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/createAccountMember.json'); - $mock = $this->getMockBuilder(Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('post')->willReturn($response); $mock->expects($this->once()) @@ -34,7 +34,7 @@ public function testListAccountMembers() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/listAccountMembers.json'); - $mock = $this->getMockBuilder(Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) diff --git a/tests/Endpoints/AccountRolesTest.php b/tests/Endpoints/AccountRolesTest.php index acb16be8..29d1c447 100644 --- a/tests/Endpoints/AccountRolesTest.php +++ b/tests/Endpoints/AccountRolesTest.php @@ -12,7 +12,7 @@ public function testListAccountRoles() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/listAccountRoles.json'); - $adapter = $this->getMockBuilder(Adapter::class)->getMock(); + $adapter = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $adapter->method('get')->willReturn($response); $adapter->expects($this->once()) diff --git a/tests/Endpoints/AccountsTest.php b/tests/Endpoints/AccountsTest.php index 24f1f3ca..06960054 100644 --- a/tests/Endpoints/AccountsTest.php +++ b/tests/Endpoints/AccountsTest.php @@ -1,5 +1,6 @@ getPsr7JsonResponseForFixture('Endpoints/listAccounts.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -42,7 +43,7 @@ public function testAddAccountWithDefaultType() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/createStandardAccount.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('post')->willReturn($response); $mock->expects($this->once()) @@ -65,7 +66,7 @@ public function testAddAccountWithCustomType() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/createEnterpriseAccount.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('post')->willReturn($response); $mock->expects($this->once()) diff --git a/tests/Endpoints/CertificatesTest.php b/tests/Endpoints/CertificatesTest.php index aa6c80d0..e5581b39 100644 --- a/tests/Endpoints/CertificatesTest.php +++ b/tests/Endpoints/CertificatesTest.php @@ -1,5 +1,7 @@ getPsr7JsonResponseForFixture('Endpoints/listCertificates.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -40,7 +42,7 @@ public function testGetCertificate() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getCertificate.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -71,7 +73,7 @@ public function testRevokeCertificate() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getCertificate.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('delete')->willReturn($response); $mock->expects($this->once()) @@ -93,15 +95,15 @@ public function testRevokeCertificate() public function testCreateCertificate() { - $certificate = new \Cloudflare\API\Configurations\Certificate(); + $certificate = new Certificate(); $certificate->setHostnames(['foo.example.com', 'bar.exapmle.com']); - $certificate->setRequestType(\Cloudflare\API\Configurations\Certificate::ORIGIN_ECC); + $certificate->setRequestType(Certificate::ORIGIN_ECC); $certificate->setRequestedValidity(365); $certificate->setCsr('some-csr-data-barbar'); $response = $this->getPsr7JsonResponseForFixture('Endpoints/getCertificate.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('post')->willReturn($response); $mock->expects($this->once()) diff --git a/tests/Endpoints/CryptoTest.php b/tests/Endpoints/CryptoTest.php index 6f617fdc..af0f058b 100644 --- a/tests/Endpoints/CryptoTest.php +++ b/tests/Endpoints/CryptoTest.php @@ -1,12 +1,15 @@ getPsr7JsonResponseForFixture('Endpoints/getOpportunisticEncryptionSetting.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -15,7 +18,7 @@ public function testGetOpportunisticEncryptionSetting() $this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/opportunistic_encryption') ); - $cryptoMock = new \Cloudflare\API\Endpoints\Crypto($mock); + $cryptoMock = new Crypto($mock); $result = $cryptoMock->getOpportunisticEncryptionSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41'); $this->assertEquals('off', $result); @@ -25,7 +28,7 @@ public function testGetOnionRoutingSetting() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getOnionRoutingSetting.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -34,7 +37,7 @@ public function testGetOnionRoutingSetting() $this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/opportunistic_onion') ); - $cryptoMock = new \Cloudflare\API\Endpoints\Crypto($mock); + $cryptoMock = new Crypto($mock); $result = $cryptoMock->getOnionRoutingSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41'); $this->assertEquals('off', $result); @@ -44,7 +47,7 @@ public function testUpdateOpportunisticEncryptionSetting() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/updateOpportunisticEncryptionSetting.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('patch')->willReturn($response); $mock->expects($this->once()) @@ -54,7 +57,7 @@ public function testUpdateOpportunisticEncryptionSetting() $this->equalTo(['value' => 'off']) ); - $cryptoMock = new \Cloudflare\API\Endpoints\Crypto($mock); + $cryptoMock = new Crypto($mock); $result = $cryptoMock->updateOpportunisticEncryptionSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', 'off'); $this->assertTrue($result); @@ -64,7 +67,7 @@ public function testUpdateOnionRoutingSetting() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/updateOnionRoutingSetting.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('patch')->willReturn($response); $mock->expects($this->once()) @@ -74,7 +77,7 @@ public function testUpdateOnionRoutingSetting() $this->equalTo(['value' => 'off']) ); - $cryptoMock = new \Cloudflare\API\Endpoints\Crypto($mock); + $cryptoMock = new Crypto($mock); $result = $cryptoMock->updateOnionRoutingSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', 'off'); $this->assertTrue($result); diff --git a/tests/Endpoints/CustomHostnamesTest.php b/tests/Endpoints/CustomHostnamesTest.php index f8cf990b..cf145162 100644 --- a/tests/Endpoints/CustomHostnamesTest.php +++ b/tests/Endpoints/CustomHostnamesTest.php @@ -6,6 +6,7 @@ * Time: 22:23 */ +use Cloudflare\API\Adapter\Adapter; use Cloudflare\API\Endpoints\CustomHostnames; class CustomHostnamesTest extends TestCase @@ -16,7 +17,7 @@ public function testAddHostname() $customSsl = $this->getCustomSsl(); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('post')->willReturn($response); $mock->expects($this->once()) @@ -67,7 +68,7 @@ public function testListHostnames() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/listHostnames.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -85,7 +86,7 @@ public function testListHostnames() ]) ); - $zones = new \Cloudflare\API\Endpoints\CustomHostnames($mock); + $zones = new CustomHostnames($mock); $result = $zones->listHostnames('023e105f4ecef8ad9ca31a8372d0c353', 'app.example.com', '0d89c70d-ad9f-4843-b99f-6cc0252067e9', 1, 20, 'ssl', 'desc', 0); $this->assertObjectHasAttribute('result', $result); @@ -100,7 +101,7 @@ public function testGetHostname() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getHostname.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -109,7 +110,7 @@ public function testGetHostname() $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/custom_hostnames/0d89c70d-ad9f-4843-b99f-6cc0252067e9') ); - $zones = new \Cloudflare\API\Endpoints\CustomHostnames($mock); + $zones = new CustomHostnames($mock); $result = $zones->getHostname('023e105f4ecef8ad9ca31a8372d0c353', '0d89c70d-ad9f-4843-b99f-6cc0252067e9', '0d89c70d-ad9f-4843-b99f-6cc0252067e9'); $this->assertObjectHasAttribute('id', $result); @@ -123,7 +124,7 @@ public function testUpdateHostname() $customSsl = $this->getCustomSsl(); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('patch')->willReturn($response); $mock->expects($this->once()) @@ -149,7 +150,7 @@ public function testUpdateHostname() ]) ); - $zones = new \Cloudflare\API\Endpoints\CustomHostnames($mock); + $zones = new CustomHostnames($mock); $sslSettings = [ 'http2' => 'on', 'http3' => 'on', @@ -180,7 +181,7 @@ public function testDeleteHostname() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/deleteHostname.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('delete')->willReturn($response); $mock->expects($this->once()) @@ -189,7 +190,7 @@ public function testDeleteHostname() $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/custom_hostnames/0d89c70d-ad9f-4843-b99f-6cc0252067e9') ); - $zones = new \Cloudflare\API\Endpoints\CustomHostnames($mock); + $zones = new CustomHostnames($mock); $result = $zones->deleteHostname('023e105f4ecef8ad9ca31a8372d0c353', '0d89c70d-ad9f-4843-b99f-6cc0252067e9'); $this->assertEquals('0d89c70d-ad9f-4843-b99f-6cc0252067e9', $result->id); @@ -200,7 +201,7 @@ public function testGetHostnameFallbackOrigin() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getCustomHostnameFallbackOrigin.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -209,7 +210,7 @@ public function testGetHostnameFallbackOrigin() $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/custom_hostnames/fallback_origin') ); - $zones = new \Cloudflare\API\Endpoints\CustomHostnames($mock); + $zones = new CustomHostnames($mock); $result = $zones->getFallbackOrigin('023e105f4ecef8ad9ca31a8372d0c353'); $this->assertObjectHasAttribute('origin', $result); diff --git a/tests/Endpoints/DNSAnalyticsTest.php b/tests/Endpoints/DNSAnalyticsTest.php index 6d0a64eb..19d100b7 100644 --- a/tests/Endpoints/DNSAnalyticsTest.php +++ b/tests/Endpoints/DNSAnalyticsTest.php @@ -1,5 +1,8 @@ getMockBuilder( - \Cloudflare\API\Adapter\Adapter::class - )->getMock(); + Adapter::class + )->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock @@ -28,7 +31,7 @@ public function testGetDNSAnalyticsReportTable() ) ); - $analytics = new \Cloudflare\API\Endpoints\DNSAnalytics($mock); + $analytics = new DNSAnalytics($mock); $since = '2020-02-01T00:00:00Z'; $until = '2020-02-28T23:59:59Z'; $filters = 'responseCode==NOERROR AND queryType==A'; @@ -55,8 +58,8 @@ public function testGetDNSAnalyticsReportByTime() ); $mock = $this->getMockBuilder( - \Cloudflare\API\Adapter\Adapter::class - )->getMock(); + Adapter::class + )->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock @@ -68,7 +71,7 @@ public function testGetDNSAnalyticsReportByTime() ) ); - $analytics = new \Cloudflare\API\Endpoints\DNSAnalytics($mock); + $analytics = new DNSAnalytics($mock); $since = '2020-02-01T00:00:00Z'; $until = '2020-02-28T23:59:59Z'; $filters = 'responseCode==NOERROR AND queryType==A'; diff --git a/tests/Endpoints/DNSTest.php b/tests/Endpoints/DNSTest.php index 2eec5536..210694a5 100644 --- a/tests/Endpoints/DNSTest.php +++ b/tests/Endpoints/DNSTest.php @@ -1,5 +1,8 @@ getPsr7JsonResponseForFixture('Endpoints/addRecord.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('post')->willReturn($response); $mock->expects($this->once()) @@ -28,7 +31,7 @@ public function testAddRecord() ]) ); - $dns = new \Cloudflare\API\Endpoints\DNS($mock); + $dns = new DNS($mock); $dns->addRecord('023e105f4ecef8ad9ca31a8372d0c353', 'A', 'example.com', '127.0.0.1', '120', false); } @@ -36,7 +39,7 @@ public function testAddMXRecordPriority10() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/addRecord.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('post')->willReturn($response); $mock->expects($this->once()) @@ -53,7 +56,7 @@ public function testAddMXRecordPriority10() ]) ); - $dns = new \Cloudflare\API\Endpoints\DNS($mock); + $dns = new DNS($mock); $dns->addRecord('023e105f4ecef8ad9ca31a8372d0c353', 'MX', 'example.com', '127.0.0.1', '120', false, 10); } @@ -61,7 +64,7 @@ public function testAddMXRecordPriority0() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/addRecord.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('post')->willReturn($response); $mock->expects($this->once()) @@ -78,7 +81,7 @@ public function testAddMXRecordPriority0() ]) ); - $dns = new \Cloudflare\API\Endpoints\DNS($mock); + $dns = new DNS($mock); $dns->addRecord('023e105f4ecef8ad9ca31a8372d0c353', 'MX', 'example.com', '127.0.0.1', '120', false, 0); } @@ -87,7 +90,7 @@ public function testListRecords() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/listRecords.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -106,7 +109,7 @@ public function testListRecords() ]) ); - $zones = new \Cloudflare\API\Endpoints\DNS($mock); + $zones = new DNS($mock); $result = $zones->listRecords('023e105f4ecef8ad9ca31a8372d0c353', 'A', 'example.com', '127.0.0.1', 1, 20, 'type', 'desc'); $this->assertObjectHasAttribute('result', $result); @@ -121,7 +124,7 @@ public function testGetDNSRecordDetails() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getDNSRecordDetails.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -130,7 +133,7 @@ public function testGetDNSRecordDetails() $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/dns_records/372e67954025e0ba6aaa6d586b9e0b59') ); - $dns = new \Cloudflare\API\Endpoints\DNS($mock); + $dns = new DNS($mock); $result = $dns->getRecordDetails('023e105f4ecef8ad9ca31a8372d0c353', '372e67954025e0ba6aaa6d586b9e0b59'); $this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $result->id); @@ -141,7 +144,7 @@ public function testGetRecordID() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getRecordId.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -150,7 +153,7 @@ public function testGetRecordID() $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/dns_records') ); - $dns = new \Cloudflare\API\Endpoints\DNS($mock); + $dns = new DNS($mock); $result = $dns->getRecordID('023e105f4ecef8ad9ca31a8372d0c353', 'A', 'example.com'); $this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $result); @@ -160,7 +163,7 @@ public function testUpdateDNSRecord() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/updateDNSRecord.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('put')->willReturn($response); $details = [ @@ -178,7 +181,7 @@ public function testUpdateDNSRecord() $this->equalTo($details) ); - $dns = new \Cloudflare\API\Endpoints\DNS($mock); + $dns = new DNS($mock); $result = $dns->updateRecordDetails('023e105f4ecef8ad9ca31a8372d0c353', '372e67954025e0ba6aaa6d586b9e0b59', $details); $this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $result->result->id); diff --git a/tests/Endpoints/FirewallSettingsTest.php b/tests/Endpoints/FirewallSettingsTest.php index b8bc289e..3fa8efa9 100644 --- a/tests/Endpoints/FirewallSettingsTest.php +++ b/tests/Endpoints/FirewallSettingsTest.php @@ -1,12 +1,15 @@ getPsr7JsonResponseForFixture('Endpoints/getSecurityLevelSetting.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -15,7 +18,7 @@ public function testGetSecurityLevelSetting() $this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/security_level') ); - $firewallSettingsMock = new \Cloudflare\API\Endpoints\FirewallSettings($mock); + $firewallSettingsMock = new FirewallSettings($mock); $result = $firewallSettingsMock->getSecurityLevelSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41'); $this->assertEquals('medium', $result); @@ -25,7 +28,7 @@ public function testGetChallengeTTLSetting() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getChallengeTTLSetting.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -34,7 +37,7 @@ public function testGetChallengeTTLSetting() $this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/challenge_ttl') ); - $firewallSettingsMock = new \Cloudflare\API\Endpoints\FirewallSettings($mock); + $firewallSettingsMock = new FirewallSettings($mock); $result = $firewallSettingsMock->getChallengeTTLSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41'); $this->assertEquals(1800, $result); @@ -44,7 +47,7 @@ public function testGetBrowserIntegrityCheckSetting() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getBrowserIntegrityCheckSetting.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -53,7 +56,7 @@ public function testGetBrowserIntegrityCheckSetting() $this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/browser_check') ); - $firewallSettingsMock = new \Cloudflare\API\Endpoints\FirewallSettings($mock); + $firewallSettingsMock = new FirewallSettings($mock); $result = $firewallSettingsMock->getBrowserIntegrityCheckSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41'); $this->assertEquals('on', $result); @@ -63,7 +66,7 @@ public function testUpdateSecurityLevelSetting() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/updateSecurityLevelSetting.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('patch')->willReturn($response); $mock->expects($this->once()) @@ -73,7 +76,7 @@ public function testUpdateSecurityLevelSetting() $this->equalTo(['value' => 'medium']) ); - $firewallSettingsMock = new \Cloudflare\API\Endpoints\FirewallSettings($mock); + $firewallSettingsMock = new FirewallSettings($mock); $result = $firewallSettingsMock->updateSecurityLevelSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', 'medium'); $this->assertTrue($result); @@ -83,7 +86,7 @@ public function testUpdateChallengeTTLSetting() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/updateChallengeTTLSetting.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('patch')->willReturn($response); $mock->expects($this->once()) @@ -93,7 +96,7 @@ public function testUpdateChallengeTTLSetting() $this->equalTo(['value' => 1800]) ); - $firewallSettingsMock = new \Cloudflare\API\Endpoints\FirewallSettings($mock); + $firewallSettingsMock = new FirewallSettings($mock); $result = $firewallSettingsMock->updateChallengeTTLSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', 1800); $this->assertTrue($result); @@ -103,7 +106,7 @@ public function testUpdateBrowserIntegrityCheckSetting() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/updateBrowserIntegrityCheckSetting.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('patch')->willReturn($response); $mock->expects($this->once()) @@ -113,7 +116,7 @@ public function testUpdateBrowserIntegrityCheckSetting() $this->equalTo(['value' => 'on']) ); - $firewallSettingsMock = new \Cloudflare\API\Endpoints\FirewallSettings($mock); + $firewallSettingsMock = new FirewallSettings($mock); $result = $firewallSettingsMock->updateBrowserIntegrityCheckSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', 'on'); $this->assertTrue($result); diff --git a/tests/Endpoints/FirewallTest.php b/tests/Endpoints/FirewallTest.php index c2b2ed6c..5f940181 100644 --- a/tests/Endpoints/FirewallTest.php +++ b/tests/Endpoints/FirewallTest.php @@ -1,12 +1,16 @@ getPsr7JsonResponseForFixture('Endpoints/createFirewallRules.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('post')->willReturn($response); $mock->expects($this->once()) @@ -33,7 +37,7 @@ public function testCreatePageRules() ]) ); - $firewall = new Cloudflare\API\Endpoints\Firewall($mock); + $firewall = new Firewall($mock); $result = $firewall->createFirewallRules( '023e105f4ecef8ad9ca31a8372d0c353', [ @@ -62,7 +66,7 @@ public function testCreatePageRule() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/createFirewallRule.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('post')->willReturn($response); $mock->expects($this->once()) @@ -82,8 +86,8 @@ public function testCreatePageRule() ]) ); - $firewall = new Cloudflare\API\Endpoints\Firewall($mock); - $options = new \Cloudflare\API\Configurations\FirewallRuleOptions(); + $firewall = new Firewall($mock); + $options = new FirewallRuleOptions(); $options->setActionBlock(); $result = $firewall->createFirewallRule( '023e105f4ecef8ad9ca31a8372d0c353', @@ -98,7 +102,7 @@ public function testListFirewallRules() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/listFirewallRules.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -111,7 +115,7 @@ public function testListFirewallRules() ]) ); - $firewall = new Cloudflare\API\Endpoints\Firewall($mock); + $firewall = new Firewall($mock); $result = $firewall->listFirewallRules('023e105f4ecef8ad9ca31a8372d0c353'); $this->assertObjectHasAttribute('result', $result); @@ -124,7 +128,7 @@ public function testDeleteFirewallRule() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/deleteFirewallRule.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('delete')->willReturn($response); $mock->expects($this->once()) @@ -133,7 +137,7 @@ public function testDeleteFirewallRule() $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/rules/970b10321e3f4adda674c912b5f76591') ); - $firewall = new Cloudflare\API\Endpoints\Firewall($mock); + $firewall = new Firewall($mock); $firewall->deleteFirewallRule('023e105f4ecef8ad9ca31a8372d0c353', '970b10321e3f4adda674c912b5f76591'); } @@ -141,7 +145,7 @@ public function testUpdateFirewallRule() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/updateFirewallRule.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('put')->willReturn($response); $mock->expects($this->once()) @@ -161,8 +165,8 @@ public function testUpdateFirewallRule() ]) ); - $firewall = new Cloudflare\API\Endpoints\Firewall($mock); - $options = new \Cloudflare\API\Configurations\FirewallRuleOptions(); + $firewall = new Firewall($mock); + $options = new FirewallRuleOptions(); $options->setActionBlock(); $result = $firewall->updateFirewallRule( '023e105f4ecef8ad9ca31a8372d0c353', diff --git a/tests/Endpoints/IPsTest.php b/tests/Endpoints/IPsTest.php index 1f92804b..ff73d2c5 100644 --- a/tests/Endpoints/IPsTest.php +++ b/tests/Endpoints/IPsTest.php @@ -1,4 +1,8 @@ getPsr7JsonResponseForFixture('Endpoints/listIPs.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -21,7 +25,7 @@ public function testListIPs() $this->equalTo('ips') ); - $ipsMock = new \Cloudflare\API\Endpoints\IPs($mock); + $ipsMock = new IPs($mock); $ips = $ipsMock->listIPs(); $this->assertObjectHasAttribute('ipv4_cidrs', $ips); $this->assertObjectHasAttribute('ipv6_cidrs', $ips); diff --git a/tests/Endpoints/KeyValueTest.php b/tests/Endpoints/KeyValueTest.php new file mode 100644 index 00000000..10aec18d --- /dev/null +++ b/tests/Endpoints/KeyValueTest.php @@ -0,0 +1,135 @@ + 'metadata']; + + public function testListKeys() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/listKeys.json'); + + $adapter = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); + $adapter->method('get')->willReturn($response); + + $adapter->expects($this->once()) + ->method('get') + ->with($this->stringStartsWith(sprintf('accounts/%s/storage/kv/namespaces/%s', self::TEST_ACCOUNT_ID, self::TEST_KV_NAMESPACE_ID))); + + $keyValue = new KeyValue($adapter); + $result = $keyValue->listKeys(self::TEST_ACCOUNT_ID, self::TEST_KV_NAMESPACE_ID); + + $this->assertObjectHasAttribute('result', $result); + $this->assertObjectHasAttribute('result_info', $result); + + $this->assertEquals(self::TEST_KEY_NAME, $result->result[0]->name); + $this->assertEquals(1, $result->result_info->count); + } + public function testGetKeyValue() + { + $stream = $this->getPsr7StreamForFixture('Endpoints/getKeyValue.txt'); + $adapter = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); + $adapter->method('get')->willReturn(new Response(200, ['Content-Type' => 'application/json'], $stream)); + $adapter->expects($this->once()) + ->method('get') + ->with($this->stringStartsWith(sprintf('accounts/%s/storage/kv/namespaces/%s/values', self::TEST_ACCOUNT_ID, self::TEST_KV_NAMESPACE_ID))); + + $keyValue = new KeyValue($adapter); + $result = $keyValue->getKeyValue(self::TEST_ACCOUNT_ID, self::TEST_KV_NAMESPACE_ID, self::TEST_KEY_NAME); + + $this->assertEquals(self::TEST_KEY_VALUE, $result); + } + + public function testGetKeyMetadata() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/getKeyMetadata.json'); + $adapter = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); + $adapter->method('get')->willReturn($response); + + $adapter->expects($this->once()) + ->method('get') + ->with($this->stringStartsWith(sprintf('accounts/%s/storage/kv/namespaces/%s/metadata/%s', self::TEST_ACCOUNT_ID, self::TEST_KV_NAMESPACE_ID, self::TEST_KEY_NAME))); + + $keyValue = new KeyValue($adapter); + $result = $keyValue->getKeyMetadata(self::TEST_ACCOUNT_ID, self::TEST_KV_NAMESPACE_ID, self::TEST_KEY_NAME); + + $this->assertEquals((object) self::TEST_KEY_METADATA, $result); + } + + public function testSetKeyValue() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/setKeyValue.json'); + + $adapter = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); + $adapter->method('put')->willReturn($response); + + $adapter->expects($this->once()) + ->method('put') + ->with($this->stringStartsWith(sprintf('accounts/%s/storage/kv/namespaces/%s/values/%s', self::TEST_ACCOUNT_ID, self::TEST_KV_NAMESPACE_ID, self::TEST_KEY_NAME))); + + $keyValue = new KeyValue($adapter); + $result = $keyValue->setKeyValue(self::TEST_ACCOUNT_ID, self::TEST_KV_NAMESPACE_ID, self::TEST_KEY_NAME, self::TEST_KEY_VALUE); + + $this->assertEquals(true, $result); + } + + public function testSetMultipleKeysValues() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/setMultipleKeysValues.json'); + + $adapter = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); + $adapter->method('put')->willReturn($response); + + $adapter->expects($this->once()) + ->method('put') + ->with($this->stringStartsWith(sprintf('accounts/%s/storage/kv/namespaces/%s/bulk', self::TEST_ACCOUNT_ID, self::TEST_KV_NAMESPACE_ID))); + + $keyValue = new KeyValue($adapter); + $result = $keyValue->setMultipleKeysValues(self::TEST_ACCOUNT_ID, self::TEST_KV_NAMESPACE_ID, [self::TEST_KEY_NAME => self::TEST_KEY_VALUE]); + + $this->assertEquals(true, $result); + } + + public function testDeleteKey() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/deleteKey.json'); + $adapter = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); + $adapter->method('delete')->willReturn($response); + + $adapter->expects($this->once()) + ->method('delete') + ->with($this->stringStartsWith(sprintf('accounts/%s/storage/kv/namespaces/%s/values/%s', self::TEST_ACCOUNT_ID, self::TEST_KV_NAMESPACE_ID, self::TEST_KEY_NAME))); + + $keyValue = new KeyValue($adapter); + $result = $keyValue->deleteKey(self::TEST_ACCOUNT_ID, self::TEST_KV_NAMESPACE_ID, self::TEST_KEY_NAME); + + $this->assertEquals(true, $result); + } + + public function testDeleteMultipleKeys() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/deleteKey.json'); + $adapter = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); + $adapter->method('delete')->willReturn($response); + + $adapter->expects($this->once()) + ->method('delete') + ->with($this->stringStartsWith(sprintf('accounts/%s/storage/kv/namespaces/%s/bulk', self::TEST_ACCOUNT_ID, self::TEST_KV_NAMESPACE_ID))); + + $keyValue = new KeyValue($adapter); + $result = $keyValue->deleteMultipleKeys(self::TEST_ACCOUNT_ID, self::TEST_KV_NAMESPACE_ID, [self::TEST_KEY_NAME]); + + $this->assertEquals(true, $result); + } +} diff --git a/tests/Endpoints/LoadBalancersTest.php b/tests/Endpoints/LoadBalancersTest.php index 93418d43..46a11287 100644 --- a/tests/Endpoints/LoadBalancersTest.php +++ b/tests/Endpoints/LoadBalancersTest.php @@ -24,7 +24,7 @@ public function testCreateLoadBalancer() $response = $this->getPsr7JsonResponseForFixture('Endpoints/createLoadBalancer.json'); - $mock = $this->getMockBuilder(Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('post')->willReturn($response); $mock->expects($this->once()) @@ -45,7 +45,7 @@ public function testListLoadBalancer() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/listLoadBalancers.json'); - $mock = $this->getMockBuilder(Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -63,7 +63,7 @@ public function testGetLoadBalancerDetails() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getLoadBalancerDetails.json'); - $mock = $this->getMockBuilder(Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -89,7 +89,7 @@ public function testUpdateLoadBalancer() $response = $this->getPsr7JsonResponseForFixture('Endpoints/updateLoadBalancer.json'); - $mock = $this->getMockBuilder(Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('put')->willReturn($response); $mock->expects($this->once()) @@ -110,7 +110,7 @@ public function testDeleteLoadBalancer() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/deleteLoadBalancer.json'); - $mock = $this->getMockBuilder(Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('delete')->willReturn($response); $mock->expects($this->once()) diff --git a/tests/Endpoints/MembershipTest.php b/tests/Endpoints/MembershipTest.php index 3f93c1e4..dbd6a048 100644 --- a/tests/Endpoints/MembershipTest.php +++ b/tests/Endpoints/MembershipTest.php @@ -1,13 +1,16 @@ getPsr7JsonResponseForFixture('Endpoints/listMemberships.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -24,7 +27,7 @@ public function testListMemberships() ]) ); - $zones = new \Cloudflare\API\Endpoints\Membership($mock); + $zones = new Membership($mock); $result = $zones->listMemberships('Demo Account', 'accepted', 1, 20, 'status', 'desc'); $this->assertObjectHasAttribute('result', $result); @@ -39,10 +42,10 @@ public function testGetMembershipDetails() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getMembershipDetails.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); - $membership = new \Cloudflare\API\Endpoints\Membership($mock); + $membership = new Membership($mock); $details = $membership->getMembershipDetails('4536bcfad5faccb111b47003c79917fa'); $this->assertObjectHasAttribute('id', $details); @@ -56,7 +59,7 @@ public function testUpdateMembershipDetails() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/updateMembershipStatus.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('put')->willReturn($response); $mock->expects($this->once()) @@ -68,7 +71,7 @@ public function testUpdateMembershipDetails() ]) ); - $membership = new \Cloudflare\API\Endpoints\Membership($mock); + $membership = new Membership($mock); $membership->updateMembershipStatus('4536bcfad5faccb111b47003c79917fa', 'accepted'); $this->assertEquals('4536bcfad5faccb111b47003c79917fa', $membership->getBody()->result->id); } @@ -77,14 +80,14 @@ public function testDeleteMembership() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/deleteMembership.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('delete')->willReturn($response); $mock->expects($this->once()) ->method('delete') ->with($this->equalTo('memberships/4536bcfad5faccb111b47003c79917fa')); - $membership = new \Cloudflare\API\Endpoints\Membership($mock); + $membership = new Membership($mock); $membership->deleteMembership('4536bcfad5faccb111b47003c79917fa'); diff --git a/tests/Endpoints/PageRulesTest.php b/tests/Endpoints/PageRulesTest.php index f16815ab..9b319b44 100644 --- a/tests/Endpoints/PageRulesTest.php +++ b/tests/Endpoints/PageRulesTest.php @@ -1,4 +1,10 @@ setAlwaysOnline(true); $response = $this->getPsr7JsonResponseForFixture('Endpoints/createPageRule.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('post')->willReturn($response); $mock->expects($this->once()) @@ -31,7 +37,7 @@ public function testCreatePageRule() ]) ); - $pageRules = new \Cloudflare\API\Endpoints\PageRules($mock); + $pageRules = new PageRules($mock); $result = $pageRules->createPageRule('023e105f4ecef8ad9ca31a8372d0c353', $target, $action, true, 1); $this->assertTrue($result); @@ -42,7 +48,7 @@ public function testListPageRules() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/listPageRules.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -57,7 +63,7 @@ public function testListPageRules() ]) ); - $pageRules = new \Cloudflare\API\Endpoints\PageRules($mock); + $pageRules = new PageRules($mock); $pageRules->listPageRules('023e105f4ecef8ad9ca31a8372d0c353', 'active', 'status', 'desc', 'all'); $this->assertEquals('9a7806061c88ada191ed06f989cc3dac', $pageRules->getBody()->result[0]->id); } @@ -66,7 +72,7 @@ public function testGetPageRuleDetails() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getPageRuleDetails.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -75,20 +81,20 @@ public function testGetPageRuleDetails() $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/pagerules/9a7806061c88ada191ed06f989cc3dac') ); - $pageRules = new \Cloudflare\API\Endpoints\PageRules($mock); + $pageRules = new PageRules($mock); $pageRules->getPageRuleDetails('023e105f4ecef8ad9ca31a8372d0c353', '9a7806061c88ada191ed06f989cc3dac'); $this->assertEquals('9a7806061c88ada191ed06f989cc3dac', $pageRules->getBody()->result->id); } public function testUpdatePageRule() { - $target = new \Cloudflare\API\Configurations\PageRulesTargets('*example.com/images/*'); - $action = new \Cloudflare\API\Configurations\PageRulesActions(); + $target = new PageRulesTargets('*example.com/images/*'); + $action = new PageRulesActions(); $action->setAlwaysOnline(true); $response = $this->getPsr7JsonResponseForFixture('Endpoints/updatePageRule.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('patch')->willReturn($response); $mock->expects($this->once()) @@ -103,7 +109,7 @@ public function testUpdatePageRule() ]) ); - $pageRules = new \Cloudflare\API\Endpoints\PageRules($mock); + $pageRules = new PageRules($mock); $result = $pageRules->updatePageRule('023e105f4ecef8ad9ca31a8372d0c353', '9a7806061c88ada191ed06f989cc3dac', $target, $action, true, 1); $this->assertTrue($result); @@ -114,7 +120,7 @@ public function testDeletePageRule() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/deletePageRule.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('delete')->willReturn($response); $mock->expects($this->once()) @@ -123,7 +129,7 @@ public function testDeletePageRule() $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/pagerules/9a7806061c88ada191ed06f989cc3dac') ); - $pageRules = new \Cloudflare\API\Endpoints\PageRules($mock); + $pageRules = new PageRules($mock); $result = $pageRules->deletePageRule('023e105f4ecef8ad9ca31a8372d0c353', '9a7806061c88ada191ed06f989cc3dac'); $this->assertTrue($result); diff --git a/tests/Endpoints/PoolsTest.php b/tests/Endpoints/PoolsTest.php index 9846f48a..7891296a 100644 --- a/tests/Endpoints/PoolsTest.php +++ b/tests/Endpoints/PoolsTest.php @@ -2,6 +2,7 @@ use Cloudflare\API\Adapter\Adapter; use Cloudflare\API\Endpoints\Pools; +use Cloudflare\API\Configurations\Pool; /** * @author Martijn Smidt @@ -22,11 +23,11 @@ public function testCreatePool() ] ]; - $poolConfiguration = new \Cloudflare\API\Configurations\Pool('primary-dc-1', $origins); + $poolConfiguration = new Pool('primary-dc-1', $origins); $response = $this->getPsr7JsonResponseForFixture('Endpoints/createPool.json'); - $mock = $this->getMockBuilder(Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('post')->willReturn($response); $mock->expects($this->once()) @@ -47,7 +48,7 @@ public function testListPools() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/listPools.json'); - $mock = $this->getMockBuilder(Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -65,7 +66,7 @@ public function testGetPoolDetails() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getPoolDetails.json'); - $mock = $this->getMockBuilder(Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -90,11 +91,11 @@ public function testUpdatePool() ] ]; - $poolConfiguration = new \Cloudflare\API\Configurations\Pool('primary-dc-1', $origins); + $poolConfiguration = new Pool('primary-dc-1', $origins); $response = $this->getPsr7JsonResponseForFixture('Endpoints/updatePool.json'); - $mock = $this->getMockBuilder(Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('put')->willReturn($response); $mock->expects($this->once()) @@ -115,7 +116,7 @@ public function testDeletePool() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/deletePool.json'); - $mock = $this->getMockBuilder(Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('delete')->willReturn($response); $mock->expects($this->once()) diff --git a/tests/Endpoints/RailgunTest.php b/tests/Endpoints/RailgunTest.php index 15e210b1..3066bf47 100644 --- a/tests/Endpoints/RailgunTest.php +++ b/tests/Endpoints/RailgunTest.php @@ -1,4 +1,8 @@ getPsr7JsonResponseForFixture('Endpoints/createRailgun.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('post')->willReturn($response); $mock->expects($this->once()) @@ -26,7 +30,7 @@ public function testcreate() $this->equalTo(['name' => $details['name']]) ); - $railgun = new \Cloudflare\API\Endpoints\Railgun($mock); + $railgun = new Railgun($mock); $result = $railgun->create($details['name']); $this->assertObjectHasAttribute('result', $result); @@ -41,7 +45,7 @@ public function testlist() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/listRailguns.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -55,7 +59,7 @@ public function testlist() ]) ); - $railgun = new \Cloudflare\API\Endpoints\Railgun($mock); + $railgun = new Railgun($mock); $result = $railgun->list(1, 20, 'desc'); $this->assertObjectHasAttribute('result', $result); @@ -67,7 +71,7 @@ public function testget() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getRailgun.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -76,7 +80,7 @@ public function testget() $this->equalTo('railguns/e928d310693a83094309acf9ead50448') ); - $railgun = new \Cloudflare\API\Endpoints\Railgun($mock); + $railgun = new Railgun($mock); $result = $railgun->get('e928d310693a83094309acf9ead50448'); $this->assertEquals('e928d310693a83094309acf9ead50448', $result->id); @@ -87,7 +91,7 @@ public function testgetZones() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/listRailgunZones.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -96,7 +100,7 @@ public function testgetZones() $this->equalTo('railguns/e928d310693a83094309acf9ead50448/zones') ); - $railgun = new \Cloudflare\API\Endpoints\Railgun($mock); + $railgun = new Railgun($mock); $result = $railgun->getZones('e928d310693a83094309acf9ead50448'); $this->assertObjectHasAttribute('result', $result); @@ -108,7 +112,7 @@ public function testupdate() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/updateRailgun.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('patch')->willReturn($response); $details = [ @@ -122,7 +126,7 @@ public function testupdate() $this->equalTo($details) ); - $waf = new \Cloudflare\API\Endpoints\Railgun($mock); + $waf = new Railgun($mock); $result = $waf->update('e928d310693a83094309acf9ead50448', true); $this->assertEquals('e928d310693a83094309acf9ead50448', $result->id); @@ -133,7 +137,7 @@ public function testdelete() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/deleteRailgun.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('delete')->willReturn($response); $mock->expects($this->once()) @@ -142,7 +146,7 @@ public function testdelete() $this->equalTo('railguns/e928d310693a83094309acf9ead50448') ); - $waf = new \Cloudflare\API\Endpoints\Railgun($mock); + $waf = new Railgun($mock); $waf->delete('e928d310693a83094309acf9ead50448'); $this->assertEquals('e928d310693a83094309acf9ead50448', $waf->getBody()->result->id); } diff --git a/tests/Endpoints/SSLTest.php b/tests/Endpoints/SSLTest.php index c2a1b401..32f95c2b 100644 --- a/tests/Endpoints/SSLTest.php +++ b/tests/Endpoints/SSLTest.php @@ -1,12 +1,15 @@ getPsr7JsonResponseForFixture('Endpoints/getSSLSetting.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -15,7 +18,7 @@ public function testGetSSLSetting() $this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/ssl') ); - $sslMock = new \Cloudflare\API\Endpoints\SSL($mock); + $sslMock = new SSL($mock); $result = $sslMock->getSSLSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41'); $this->assertEquals('off', $result); @@ -25,7 +28,7 @@ public function testGetSSLVerificationStatus() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getSSLVerificationStatus.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -34,7 +37,7 @@ public function testGetSSLVerificationStatus() $this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/ssl/verification') ); - $sslMock = new \Cloudflare\API\Endpoints\SSL($mock); + $sslMock = new SSL($mock); $result = $sslMock->getSSLVerificationStatus('c2547eb745079dac9320b638f5e225cf483cc5cfdda41'); $this->assertObjectHasAttribute('result', $result); @@ -45,7 +48,7 @@ public function testGetHTTPSRedirectSetting() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getHTTPSRedirectSetting.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -54,7 +57,7 @@ public function testGetHTTPSRedirectSetting() $this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/always_use_https') ); - $sslMock = new \Cloudflare\API\Endpoints\SSL($mock); + $sslMock = new SSL($mock); $result = $sslMock->getHTTPSRedirectSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41'); $this->assertEquals('off', $result); @@ -64,7 +67,7 @@ public function testGetHTTPSRewritesSetting() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getHTTPSRewritesSetting.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -73,7 +76,7 @@ public function testGetHTTPSRewritesSetting() $this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/automatic_https_rewrites') ); - $sslMock = new \Cloudflare\API\Endpoints\SSL($mock); + $sslMock = new SSL($mock); $result = $sslMock->getHTTPSRewritesSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41'); $this->assertEquals('off', $result); @@ -83,7 +86,7 @@ public function testUpdateSSLSetting() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/updateSSLSetting.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('patch')->willReturn($response); $mock->expects($this->once()) @@ -93,7 +96,7 @@ public function testUpdateSSLSetting() $this->equalTo(['value' => 'full']) ); - $sslMock = new \Cloudflare\API\Endpoints\SSL($mock); + $sslMock = new SSL($mock); $result = $sslMock->updateSSLSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', 'full'); $this->assertTrue($result); @@ -103,7 +106,7 @@ public function testUpdateHTTPSRedirectSetting() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/updateHTTPSRedirectSetting.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('patch')->willReturn($response); $mock->expects($this->once()) @@ -113,7 +116,7 @@ public function testUpdateHTTPSRedirectSetting() $this->equalTo(['value' => 'off']) ); - $sslMock = new \Cloudflare\API\Endpoints\SSL($mock); + $sslMock = new SSL($mock); $result = $sslMock->updateHTTPSRedirectSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', 'off'); $this->assertTrue($result); @@ -123,7 +126,7 @@ public function testUpdateHTTPSRewritesSetting() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/updateHTTPSRewritesSetting.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('patch')->willReturn($response); $mock->expects($this->once()) @@ -133,7 +136,7 @@ public function testUpdateHTTPSRewritesSetting() $this->equalTo(['value' => 'off']) ); - $sslMock = new \Cloudflare\API\Endpoints\SSL($mock); + $sslMock = new SSL($mock); $result = $sslMock->updateHTTPSRewritesSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', 'off'); $this->assertTrue($result); @@ -143,7 +146,7 @@ public function testUpdateSSLCertificatePackValidationMethod() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/updateSSLCertificatePackValidationMethod.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('patch')->willReturn($response); $mock->expects($this->once()) @@ -153,7 +156,7 @@ public function testUpdateSSLCertificatePackValidationMethod() $this->equalTo(['validation_method' => 'txt']) ); - $sslMock = new \Cloudflare\API\Endpoints\SSL($mock); + $sslMock = new SSL($mock); $result = $sslMock->updateSSLCertificatePackValidationMethod('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', 'a77f8bd7-3b47-46b4-a6f1-75cf98109948', 'txt'); $this->assertTrue($result); diff --git a/tests/Endpoints/TLSTest.php b/tests/Endpoints/TLSTest.php index cf0018c5..7a33744e 100644 --- a/tests/Endpoints/TLSTest.php +++ b/tests/Endpoints/TLSTest.php @@ -1,5 +1,8 @@ getPsr7JsonResponseForFixture('Endpoints/getTLSClientAuth.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -22,7 +25,7 @@ public function testGetTLSClientAuth() $this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/tls_client_auth') ); - $tlsMock = new \Cloudflare\API\Endpoints\TLS($mock); + $tlsMock = new TLS($mock); $result = $tlsMock->getTLSClientAuth('c2547eb745079dac9320b638f5e225cf483cc5cfdda41'); $this->assertEquals('off', $result); @@ -32,7 +35,7 @@ public function testEnableTLS13() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/enableTLS13.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('patch')->willReturn($response); $mock->expects($this->once()) @@ -42,7 +45,7 @@ public function testEnableTLS13() $this->equalTo(['value' => 'on']) ); - $tlsMock = new \Cloudflare\API\Endpoints\TLS($mock); + $tlsMock = new TLS($mock); $result = $tlsMock->enableTLS13('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', true); $this->assertTrue($result); @@ -52,7 +55,7 @@ public function testDisableTLS13() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/disableTLS13.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('patch')->willReturn($response); $mock->expects($this->once()) @@ -62,7 +65,7 @@ public function testDisableTLS13() $this->equalTo(['value' => 'off']) ); - $tlsMock = new \Cloudflare\API\Endpoints\TLS($mock); + $tlsMock = new TLS($mock); $result = $tlsMock->disableTLS13('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', true); $this->assertTrue($result); @@ -72,7 +75,7 @@ public function testChangeMinimimTLSVersion() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/changeMinimumTLSVersion.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('patch')->willReturn($response); $mock->expects($this->once()) @@ -82,7 +85,7 @@ public function testChangeMinimimTLSVersion() $this->equalTo(['value' => '1.1']) ); - $tlsMock = new \Cloudflare\API\Endpoints\TLS($mock); + $tlsMock = new TLS($mock); $result = $tlsMock->changeMinimumTLSVersion('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', '1.1'); $this->assertTrue($result); @@ -92,7 +95,7 @@ public function testUpdateTLSClientAuth() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/updateTLSClientAuth.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('patch')->willReturn($response); $mock->expects($this->once()) @@ -102,7 +105,7 @@ public function testUpdateTLSClientAuth() $this->equalTo(['value' => 'off']) ); - $tlsMock = new \Cloudflare\API\Endpoints\TLS($mock); + $tlsMock = new TLS($mock); $result = $tlsMock->updateTLSClientAuth('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', 'off'); $this->assertTrue($result); diff --git a/tests/Endpoints/UARulesTest.php b/tests/Endpoints/UARulesTest.php index 84067456..2b6d3dd3 100644 --- a/tests/Endpoints/UARulesTest.php +++ b/tests/Endpoints/UARulesTest.php @@ -1,4 +1,9 @@ getPsr7JsonResponseForFixture('Endpoints/listRules.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -25,7 +30,7 @@ public function testListRules() ]) ); - $zones = new \Cloudflare\API\Endpoints\UARules($mock); + $zones = new UARules($mock); $result = $zones->listRules('023e105f4ecef8ad9ca31a8372d0c353'); $this->assertObjectHasAttribute('result', $result); @@ -38,12 +43,12 @@ public function testListRules() public function testCreateRule() { - $config = new \Cloudflare\API\Configurations\UARules(); + $config = new ConfigurationUARules(); $config->addUA('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.4'); $response = $this->getPsr7JsonResponseForFixture('Endpoints/createRule.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('post')->willReturn($response); $mock->expects($this->once()) @@ -58,7 +63,7 @@ public function testCreateRule() ]) ); - $rules = new \Cloudflare\API\Endpoints\UARules($mock); + $rules = new UARules($mock); $rules->createRule( '023e105f4ecef8ad9ca31a8372d0c353', 'js_challenge', @@ -73,7 +78,7 @@ public function getRuleDetails() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getRuleDetails.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -82,7 +87,7 @@ public function getRuleDetails() $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/ua_rules/372e67954025e0ba6aaa6d586b9e0b59') ); - $lockdown = new \Cloudflare\API\Endpoints\UARules($mock); + $lockdown = new UARules($mock); $result = $lockdown->getRuleDetails('023e105f4ecef8ad9ca31a8372d0c353', '372e67954025e0ba6aaa6d586b9e0b59'); $this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $result->id); @@ -91,12 +96,12 @@ public function getRuleDetails() public function testUpdateRule() { - $config = new \Cloudflare\API\Configurations\UARules(); + $config = new ConfigurationUARules(); $config->addUA('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.4'); $response = $this->getPsr7JsonResponseForFixture('Endpoints/updateRule.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('put')->willReturn($response); $mock->expects($this->once()) @@ -111,7 +116,7 @@ public function testUpdateRule() ]) ); - $rules = new \Cloudflare\API\Endpoints\UARules($mock); + $rules = new UARules($mock); $rules->updateRule( '023e105f4ecef8ad9ca31a8372d0c353', '372e67954025e0ba6aaa6d586b9e0b59', @@ -126,7 +131,7 @@ public function testDeleteRule() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/deleteRule.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('delete')->willReturn($response); $mock->expects($this->once()) @@ -135,7 +140,7 @@ public function testDeleteRule() $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/ua_rules/372e67954025e0ba6aaa6d586b9e0b59') ); - $rules = new \Cloudflare\API\Endpoints\UARules($mock); + $rules = new UARules($mock); $rules->deleteRule('023e105f4ecef8ad9ca31a8372d0c353', '372e67954025e0ba6aaa6d586b9e0b59'); $this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $rules->getBody()->result->id); } diff --git a/tests/Endpoints/UserTest.php b/tests/Endpoints/UserTest.php index 07dc4248..ba64a8a4 100644 --- a/tests/Endpoints/UserTest.php +++ b/tests/Endpoints/UserTest.php @@ -1,5 +1,8 @@ getPsr7JsonResponseForFixture('Endpoints/getUserDetails.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); - $user = new \Cloudflare\API\Endpoints\User($mock); + $user = new User($mock); $details = $user->getUserDetails(); $this->assertObjectHasAttribute('id', $details); @@ -28,10 +31,10 @@ public function testGetUserID() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getUserId.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); - $user = new \Cloudflare\API\Endpoints\User($mock); + $user = new User($mock); $this->assertEquals('7c5dae5552338874e5053f2534d2767a', $user->getUserID()); $this->assertEquals('7c5dae5552338874e5053f2534d2767a', $user->getBody()->result->id); } @@ -40,12 +43,12 @@ public function testGetUserEmail() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getUserEmail.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once())->method('get'); - $user = new \Cloudflare\API\Endpoints\User($mock); + $user = new User($mock); $this->assertEquals('user@example.com', $user->getUserEmail()); $this->assertEquals('user@example.com', $user->getBody()->result->email); } @@ -54,14 +57,14 @@ public function testUpdateUserDetails() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/updateUserDetails.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('patch')->willReturn($response); $mock->expects($this->once()) ->method('patch') ->with($this->equalTo('user'), $this->equalTo(['email' => 'user2@example.com'])); - $user = new \Cloudflare\API\Endpoints\User($mock); + $user = new User($mock); $user->updateUserDetails(['email' => 'user2@example.com']); $this->assertEquals('7c5dae5552338874e5053f2534d2767a', $user->getBody()->result->id); } diff --git a/tests/Endpoints/WAFTest.php b/tests/Endpoints/WAFTest.php index f0c97aa9..df7649f3 100644 --- a/tests/Endpoints/WAFTest.php +++ b/tests/Endpoints/WAFTest.php @@ -1,4 +1,8 @@ getPsr7JsonResponseForFixture('Endpoints/listPackages.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -28,7 +32,7 @@ public function testgetPackages() ]) ); - $waf = new \Cloudflare\API\Endpoints\WAF($mock); + $waf = new WAF($mock); $result = $waf->getPackages('023e105f4ecef8ad9ca31a8372d0c353', 1, 20, 'status', 'desc'); $this->assertObjectHasAttribute('result', $result); @@ -43,7 +47,7 @@ public function testgetPackageInfo() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getPackageInfo.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -52,7 +56,7 @@ public function testgetPackageInfo() $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/waf/packages/a25a9a7e9c00afc1fb2e0245519d725b') ); - $waf = new \Cloudflare\API\Endpoints\WAF($mock); + $waf = new WAF($mock); $result = $waf->getPackageInfo('023e105f4ecef8ad9ca31a8372d0c353', 'a25a9a7e9c00afc1fb2e0245519d725b'); $this->assertEquals('a25a9a7e9c00afc1fb2e0245519d725b', $result->id); @@ -63,7 +67,7 @@ public function testgetRules() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/listPackageRules.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -79,7 +83,7 @@ public function testgetRules() ]) ); - $waf = new \Cloudflare\API\Endpoints\WAF($mock); + $waf = new WAF($mock); $result = $waf->getRules('023e105f4ecef8ad9ca31a8372d0c353', 'a25a9a7e9c00afc1fb2e0245519d725b', 1, 20, 'status', 'desc'); $this->assertObjectHasAttribute('result', $result); @@ -94,7 +98,7 @@ public function testgetRuleInfo() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getPackageRuleInfo.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -103,7 +107,7 @@ public function testgetRuleInfo() $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/waf/packages/a25a9a7e9c00afc1fb2e0245519d725b/rules/f939de3be84e66e757adcdcb87908023') ); - $waf = new \Cloudflare\API\Endpoints\WAF($mock); + $waf = new WAF($mock); $result = $waf->getRuleInfo('023e105f4ecef8ad9ca31a8372d0c353', 'a25a9a7e9c00afc1fb2e0245519d725b', 'f939de3be84e66e757adcdcb87908023'); $this->assertEquals('f939de3be84e66e757adcdcb87908023', $result->id); @@ -114,7 +118,7 @@ public function testupdateRule() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/updatePackageRule.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('patch')->willReturn($response); $details = [ @@ -128,7 +132,7 @@ public function testupdateRule() $this->equalTo($details) ); - $waf = new \Cloudflare\API\Endpoints\WAF($mock); + $waf = new WAF($mock); $result = $waf->updateRule('023e105f4ecef8ad9ca31a8372d0c353', 'a25a9a7e9c00afc1fb2e0245519d725b', 'f939de3be84e66e757adcdcb87908023', 'on'); $this->assertEquals('f939de3be84e66e757adcdcb87908023', $result->id); @@ -139,11 +143,11 @@ public function testupdateRule() $this->assertEquals('f939de3be84e66e757adcdcb87908023', $waf->getBody()->result->id); } - public function getGroups() + public function getGroups(): array { $response = $this->getPsr7JsonResponseForFixture('Endpoints/listPackageGroups.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -159,7 +163,7 @@ public function getGroups() ]) ); - $waf = new \Cloudflare\API\Endpoints\WAF($mock); + $waf = new WAF($mock); $result = $waf->getGroups('023e105f4ecef8ad9ca31a8372d0c353', 'a25a9a7e9c00afc1fb2e0245519d725b', 1, 20, 'status', 'desc'); $this->assertObjectHasAttribute('result', $result); @@ -168,13 +172,15 @@ public function getGroups() $this->assertEquals('de677e5818985db1285d0e80225f06e5', $result->result[0]->id); $this->assertEquals(1, $result->result_info->page); $this->assertEquals('de677e5818985db1285d0e80225f06e5', $waf->getBody()->result[0]->id); + + return []; } public function testgetGroupInfo() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getPackageGroupInfo.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -183,7 +189,7 @@ public function testgetGroupInfo() $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/waf/packages/a25a9a7e9c00afc1fb2e0245519d725b/groups/de677e5818985db1285d0e80225f06e5') ); - $waf = new \Cloudflare\API\Endpoints\WAF($mock); + $waf = new WAF($mock); $result = $waf->getGroupInfo('023e105f4ecef8ad9ca31a8372d0c353', 'a25a9a7e9c00afc1fb2e0245519d725b', 'de677e5818985db1285d0e80225f06e5'); $this->assertEquals('de677e5818985db1285d0e80225f06e5', $result->id); @@ -194,7 +200,7 @@ public function testupdateGroup() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/updatePackageGroup.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('patch')->willReturn($response); $details = [ @@ -208,7 +214,7 @@ public function testupdateGroup() $this->equalTo($details) ); - $waf = new \Cloudflare\API\Endpoints\WAF($mock); + $waf = new WAF($mock); $result = $waf->updateGroup('023e105f4ecef8ad9ca31a8372d0c353', 'a25a9a7e9c00afc1fb2e0245519d725b', 'de677e5818985db1285d0e80225f06e5', 'off'); $this->assertEquals('de677e5818985db1285d0e80225f06e5', $result->id); diff --git a/tests/Endpoints/ZoneCacheTest.php b/tests/Endpoints/ZoneCacheTest.php index bdefeeca..52b68554 100644 --- a/tests/Endpoints/ZoneCacheTest.php +++ b/tests/Endpoints/ZoneCacheTest.php @@ -1,12 +1,15 @@ getPsr7JsonResponseForFixture('Endpoints/cachePurgeEverything.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('post')->willReturn($response); $mock->expects($this->once()) @@ -16,7 +19,7 @@ public function testCachePurgeEverything() $this->equalTo(['purge_everything' => true]) ); - $zones = new \Cloudflare\API\Endpoints\Zones($mock); + $zones = new Zones($mock); $result = $zones->cachePurgeEverything('c2547eb745079dac9320b638f5e225cf483cc5cfdda41'); $this->assertTrue($result); @@ -27,7 +30,7 @@ public function testCachePurgeHost() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/cachePurgeHost.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('post')->willReturn($response); $mock->expects($this->once()) @@ -43,7 +46,7 @@ public function testCachePurgeHost() ) ); - $zones = new \Cloudflare\API\Endpoints\Zones($mock); + $zones = new Zones($mock); $result = $zones->cachePurge('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', [], [], ['dash.cloudflare.com']); $this->assertTrue($result); @@ -54,7 +57,7 @@ public function testCachePurge() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/cachePurge.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('post')->willReturn($response); $mock->expects($this->once()) @@ -67,7 +70,7 @@ public function testCachePurge() ]) ); - $zones = new \Cloudflare\API\Endpoints\Zones($mock); + $zones = new Zones($mock); $result = $zones->cachePurge('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', [ 'https://example.com/file.jpg', ]); diff --git a/tests/Endpoints/ZoneDeleteTest.php b/tests/Endpoints/ZoneDeleteTest.php index 5ffd4e1a..fb24499e 100644 --- a/tests/Endpoints/ZoneDeleteTest.php +++ b/tests/Endpoints/ZoneDeleteTest.php @@ -1,17 +1,21 @@ getPsr7JsonResponseForFixture('Endpoints/deleteZoneTest.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('delete')->willReturn($response); $mock->expects($this->once()) ->method('delete') ->with( $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353') ); - $zones = new \Cloudflare\API\Endpoints\Zones($mock); + $zones = new Zones($mock); $result = $zones->deleteZone('023e105f4ecef8ad9ca31a8372d0c353'); $this->assertTrue($result); $this->assertEquals('9a7806061c88ada191ed06f989cc3dac', $zones->getBody()->result->id); diff --git a/tests/Endpoints/ZoneLockdownTest.php b/tests/Endpoints/ZoneLockdownTest.php index 2af55ac6..0a508fd9 100644 --- a/tests/Endpoints/ZoneLockdownTest.php +++ b/tests/Endpoints/ZoneLockdownTest.php @@ -1,5 +1,9 @@ getPsr7JsonResponseForFixture('Endpoints/listLockdowns.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -25,7 +29,7 @@ public function testListLockdowns() ]) ); - $zones = new \Cloudflare\API\Endpoints\ZoneLockdown($mock); + $zones = new ZoneLockdown($mock); $result = $zones->listLockdowns('023e105f4ecef8ad9ca31a8372d0c353'); $this->assertObjectHasAttribute('result', $result); @@ -38,12 +42,12 @@ public function testListLockdowns() public function testAddLockdown() { - $config = new \Cloudflare\API\Configurations\ZoneLockdown(); + $config = new ConfigurationZoneLockdown(); $config->addIP('1.2.3.4'); $response = $this->getPsr7JsonResponseForFixture('Endpoints/addLockdown.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('post')->willReturn($response); $mock->expects($this->once()) @@ -58,7 +62,7 @@ public function testAddLockdown() ]) ); - $zoneLockdown = new \Cloudflare\API\Endpoints\ZoneLockdown($mock); + $zoneLockdown = new ZoneLockdown($mock); $zoneLockdown->createLockdown( '023e105f4ecef8ad9ca31a8372d0c353', ['api.mysite.com/some/endpoint*'], @@ -73,7 +77,7 @@ public function testGetRecordDetails() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getRecordDetails.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -82,7 +86,7 @@ public function testGetRecordDetails() $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/lockdowns/372e67954025e0ba6aaa6d586b9e0b59') ); - $lockdown = new \Cloudflare\API\Endpoints\ZoneLockdown($mock); + $lockdown = new ZoneLockdown($mock); $result = $lockdown->getLockdownDetails('023e105f4ecef8ad9ca31a8372d0c353', '372e67954025e0ba6aaa6d586b9e0b59'); $this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $result->id); @@ -91,12 +95,12 @@ public function testGetRecordDetails() public function testUpdateLockdown() { - $config = new \Cloudflare\API\Configurations\ZoneLockdown(); + $config = new ConfigurationZoneLockdown(); $config->addIP('1.2.3.4'); $response = $this->getPsr7JsonResponseForFixture('Endpoints/updateLockdown.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('put')->willReturn($response); $mock->expects($this->once()) @@ -111,7 +115,7 @@ public function testUpdateLockdown() ]) ); - $zoneLockdown = new \Cloudflare\API\Endpoints\ZoneLockdown($mock); + $zoneLockdown = new ZoneLockdown($mock); $zoneLockdown->updateLockdown( '023e105f4ecef8ad9ca31a8372d0c353', '372e67954025e0ba6aaa6d586b9e0b59', @@ -124,12 +128,12 @@ public function testUpdateLockdown() public function testDeleteLockdown() { - $config = new \Cloudflare\API\Configurations\ZoneLockdown(); + $config = new ConfigurationZoneLockdown(); $config->addIP('1.2.3.4'); $response = $this->getPsr7JsonResponseForFixture('Endpoints/deleteLockdown.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('delete')->willReturn($response); $mock->expects($this->once()) @@ -138,7 +142,7 @@ public function testDeleteLockdown() $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/lockdowns/372e67954025e0ba6aaa6d586b9e0b59') ); - $zoneLockdown = new \Cloudflare\API\Endpoints\ZoneLockdown($mock); + $zoneLockdown = new ZoneLockdown($mock); $zoneLockdown->deleteLockdown('023e105f4ecef8ad9ca31a8372d0c353', '372e67954025e0ba6aaa6d586b9e0b59'); $this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $zoneLockdown->getBody()->result->id); } diff --git a/tests/Endpoints/ZoneSettingsTest.php b/tests/Endpoints/ZoneSettingsTest.php index e4d2d8d6..3f3ba93e 100644 --- a/tests/Endpoints/ZoneSettingsTest.php +++ b/tests/Endpoints/ZoneSettingsTest.php @@ -11,7 +11,7 @@ public function testGetServerSideExcludeSetting() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getServerSideExclude.json'); - $mock = $this->getMockBuilder(Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once())->method('get'); @@ -26,7 +26,7 @@ public function testUpdateServerSideExcludeSetting() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/updateServerSideExclude.json'); - $mock = $this->getMockBuilder(Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('patch')->willReturn($response); $mock->expects($this->once())->method('patch'); @@ -41,7 +41,7 @@ public function testGetBrowserCacheTtlSetting() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getBrowserCacheTtlSetting.json'); - $mock = $this->getMockBuilder(Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once())->method('get'); @@ -56,7 +56,7 @@ public function testUpdateBrowserCacheTtlSetting() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/updateBrowserCacheTtlSetting.json'); - $mock = $this->getMockBuilder(Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('patch')->willReturn($response); $mock->expects($this->once())->method('patch'); diff --git a/tests/Endpoints/ZoneSubscriptionsTest.php b/tests/Endpoints/ZoneSubscriptionsTest.php index bd4b7c45..8a81fa85 100644 --- a/tests/Endpoints/ZoneSubscriptionsTest.php +++ b/tests/Endpoints/ZoneSubscriptionsTest.php @@ -9,7 +9,7 @@ public function testListZoneSubscriptions() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/listZoneSubscriptions.json'); - $mock = $this->getMockBuilder(Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -30,7 +30,7 @@ public function testAddZoneSubscriptionIfMissing() $postResponse = $this->getPsr7JsonResponseForFixture('Endpoints/createZoneSubscription.json'); $getResponse = $this->getPsr7JsonResponseForFixture('Endpoints/listEmptyZoneSubscriptions.json'); - $mock = $this->getMockBuilder(Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('post')->willReturn($postResponse); $mock->method('get')->willReturn($getResponse); @@ -57,7 +57,7 @@ public function testAddZoneSubscriptionIfExisting() $postResponse = $this->getPsr7JsonResponseForFixture('Endpoints/createZoneSubscription.json'); $getResponse = $this->getPsr7JsonResponseForFixture('Endpoints/listZoneSubscriptions.json'); - $mock = $this->getMockBuilder(Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('put')->willReturn($postResponse); $mock->method('get')->willReturn($getResponse); diff --git a/tests/Endpoints/ZonesTest.php b/tests/Endpoints/ZonesTest.php index b4412f78..97910d09 100644 --- a/tests/Endpoints/ZonesTest.php +++ b/tests/Endpoints/ZonesTest.php @@ -1,5 +1,8 @@ getPsr7JsonResponseForFixture('Endpoints/addZone.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('post')->willReturn($response); $mock->expects($this->once()) @@ -22,7 +25,7 @@ public function testAddZone() $this->equalTo(['name' => 'example.com', 'jump_start' => false]) ); - $zones = new \Cloudflare\API\Endpoints\Zones($mock); + $zones = new Zones($mock); $result = $zones->addZone('example.com'); $this->assertObjectHasAttribute('id', $result); @@ -30,7 +33,7 @@ public function testAddZone() $response = $this->getPsr7JsonResponseForFixture('Endpoints/createPageRule.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('post')->willReturn($response); $mock->expects($this->once()) @@ -46,7 +49,7 @@ public function testAddZone() ]) ); - $zones = new \Cloudflare\API\Endpoints\Zones($mock); + $zones = new Zones($mock); $zones->addZone('example.com', true, '01a7362d577a6c3019a474fd6f485823'); $this->assertEquals('9a7806061c88ada191ed06f989cc3dac', $zones->getBody()->result->id); } @@ -55,7 +58,7 @@ public function testAddZoneWithAccountId() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/addZone.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('post')->willReturn($response); $mock->expects($this->once()) @@ -71,7 +74,7 @@ public function testAddZoneWithAccountId() ]) ); - $zones = new \Cloudflare\API\Endpoints\Zones($mock); + $zones = new Zones($mock); $result = $zones->addZone('example.com', false, '023e105f4ecef8ad9ca31a8372d0c353'); $this->assertObjectHasAttribute('id', $result); @@ -82,7 +85,7 @@ public function testActivationTest() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/activationTest.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('put')->willReturn($response); $mock->expects($this->once()) @@ -91,7 +94,7 @@ public function testActivationTest() $this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/activation_check') ); - $zones = new \Cloudflare\API\Endpoints\Zones($mock); + $zones = new Zones($mock); $result = $zones->activationCheck('c2547eb745079dac9320b638f5e225cf483cc5cfdda41'); $this->assertTrue($result); @@ -102,7 +105,7 @@ public function testListZones() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/listZones.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -120,7 +123,7 @@ public function testListZones() ]) ); - $zones = new \Cloudflare\API\Endpoints\Zones($mock); + $zones = new Zones($mock); $result = $zones->listZones('example.com', 'active', 1, 20, 'status', 'desc'); $this->assertObjectHasAttribute('result', $result); @@ -135,17 +138,17 @@ public function testGetZoneByID() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getZoneById.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) ->method('get') ->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353')); - $zones = new \Cloudflare\API\Endpoints\Zones($mock); + $zones = new Zones($mock); $result = $zones->getZoneById('023e105f4ecef8ad9ca31a8372d0c353'); - $this->assertInstanceOf(\stdClass::class, $result); + $this->assertInstanceOf(stdClass::class, $result); $this->assertEquals('023e105f4ecef8ad9ca31a8372d0c353', $zones->getBody()->result->id); $this->assertEquals('example.com', $zones->getBody()->result->name); } @@ -154,7 +157,7 @@ public function testGetZoneID() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getZoneId.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -169,7 +172,7 @@ public function testGetZoneID() ]) ); - $zones = new \Cloudflare\API\Endpoints\Zones($mock); + $zones = new Zones($mock); $result = $zones->getZoneID('example.com'); $this->assertEquals('023e105f4ecef8ad9ca31a8372d0c353', $result); @@ -180,7 +183,7 @@ public function testGetAnalyticsDashboard() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/getAnalyticsDashboard.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('get')->willReturn($response); $mock->expects($this->once()) @@ -190,7 +193,7 @@ public function testGetAnalyticsDashboard() $this->equalTo(['since' => '-10080', 'until' => '0', 'continuous' => var_export(true, true)]) ); - $zones = new \Cloudflare\API\Endpoints\Zones($mock); + $zones = new Zones($mock); $analytics = $zones->getAnalyticsDashboard('c2547eb745079dac9320b638f5e225cf483cc5cfdda41'); $this->assertObjectHasAttribute('since', $analytics->totals); @@ -201,7 +204,7 @@ public function testChangeDevelopmentMode() { $response = $this->getPsr7JsonResponseForFixture('Endpoints/changeDevelopmentMode.json'); - $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock(); $mock->method('patch')->willReturn($response); $mock->expects($this->once()) @@ -211,7 +214,7 @@ public function testChangeDevelopmentMode() $this->equalTo(['value' => 'on']) ); - $zones = new \Cloudflare\API\Endpoints\Zones($mock); + $zones = new Zones($mock); $result = $zones->changeDevelopmentMode('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', true); $this->assertTrue($result); diff --git a/tests/Fixtures/Endpoints/deleteKey.json b/tests/Fixtures/Endpoints/deleteKey.json new file mode 100644 index 00000000..512858d9 --- /dev/null +++ b/tests/Fixtures/Endpoints/deleteKey.json @@ -0,0 +1,5 @@ +{ + "success": true, + "errors": [], + "messages": [] +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/getKeyMetadata.json b/tests/Fixtures/Endpoints/getKeyMetadata.json new file mode 100644 index 00000000..efcb7ecc --- /dev/null +++ b/tests/Fixtures/Endpoints/getKeyMetadata.json @@ -0,0 +1,8 @@ +{ + "success": true, + "errors": [], + "messages": [], + "result": { + "test": "metadata" + } +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/getKeyValue.txt b/tests/Fixtures/Endpoints/getKeyValue.txt new file mode 100644 index 00000000..b448bf13 --- /dev/null +++ b/tests/Fixtures/Endpoints/getKeyValue.txt @@ -0,0 +1 @@ +My-Test-Key-Value \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/listKeys.json b/tests/Fixtures/Endpoints/listKeys.json new file mode 100644 index 00000000..d67c928d --- /dev/null +++ b/tests/Fixtures/Endpoints/listKeys.json @@ -0,0 +1,18 @@ +{ + "success": true, + "errors": [], + "messages": [], + "result": [ + { + "name": "My-Test-Key", + "expiration": 1577836800, + "metadata": { + "someMetadataKey": "someMetadataValue" + } + } + ], + "result_info": { + "count": 1, + "cursor": "6Ck1la0VxJ0djhidm1MdX2FyDGxLKVeeHZZmORS_8XeSuhz9SjIJRaSa2lnsF01tQOHrfTGAP3R5X1Kv5iVUuMbNKhWNAXHOl6ePB0TUL8nw" + } +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/setKeyValue.json b/tests/Fixtures/Endpoints/setKeyValue.json new file mode 100644 index 00000000..512858d9 --- /dev/null +++ b/tests/Fixtures/Endpoints/setKeyValue.json @@ -0,0 +1,5 @@ +{ + "success": true, + "errors": [], + "messages": [] +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/setMultipleKeysValues.json b/tests/Fixtures/Endpoints/setMultipleKeysValues.json new file mode 100644 index 00000000..512858d9 --- /dev/null +++ b/tests/Fixtures/Endpoints/setMultipleKeysValues.json @@ -0,0 +1,5 @@ +{ + "success": true, + "errors": [], + "messages": [] +} \ No newline at end of file diff --git a/tests/TestCase.php b/tests/TestCase.php index 418bc92b..2f10afab 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,10 +1,13 @@ assertFileExists($path); - $stream = Psr7\stream_for(file_get_contents($path)); + $stream = Utils::streamFor(file_get_contents($path)); - $this->assertInstanceOf(Psr7\Stream::class, $stream); + $this->assertInstanceOf(Stream::class, $stream); return $stream; } @@ -32,15 +35,15 @@ protected function getPsr7StreamForFixture($fixture): Psr7\Stream * * @param string $fixture The fixture to create the response for. * @param integer $statusCode A HTTP Status Code for the response. - * @return Psr7\Response + * @return Response */ - protected function getPsr7JsonResponseForFixture($fixture, $statusCode = 200): Psr7\Response + protected function getPsr7JsonResponseForFixture($fixture, $statusCode = 200): Response { $stream = $this->getPsr7StreamForFixture($fixture); - $this->assertNotNull(json_decode($stream)); + $this->assertNotNull(json_decode($stream, false)); $this->assertEquals(JSON_ERROR_NONE, json_last_error()); - return new Psr7\Response($statusCode, ['Content-Type' => 'application/json'], $stream); + return new Response($statusCode, ['Content-Type' => 'application/json'], $stream); } }