diff --git a/.travis.yml b/.travis.yml index 85df0d66..e0381ed6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,8 @@ language: php php: - 7.1 + - 7.2 + - 7.3 before_install: - composer self-update @@ -16,6 +18,7 @@ script: - composer lint - composer sniff - composer test + - composer stan after_script: - cd ${TRAVIS_BUILD_DIR} diff --git a/README.md b/README.md index ed1cfa29..df57d723 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,9 @@ Acquia PHP SDK for CloudAPI v2 [![Build Status](https://travis-ci.org/typhonius/acquia-php-sdk-v2.svg?branch=master)](https://travis-ci.org/typhonius/acquia-php-sdk-v2) [![Total Downloads](https://poser.pugx.org/typhonius/acquia-php-sdk-v2/downloads.png)](https://packagist.org/packages/typhonius/acquia-php-sdk-v2) [![Coverage Status](https://coveralls.io/repos/github/typhonius/acquia-php-sdk-v2/badge.svg?branch=master)](https://coveralls.io/github/typhonius/acquia-php-sdk-v2?branch=master) -[![License](https://poser.pugx.org/typhonius/acquia-php-sdk-v2/license.png)](https://www.versioneye.com/user/projects/5a18bd670fb24f2125873c86#tab-dependencies) +[![Quality Status](https://scrutinizer-ci.com/g/typhonius/acquia-php-sdk-v2/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/typhonius/acquia-php-sdk-v2/) +[![License](https://poser.pugx.org/typhonius/acquia-php-sdk-v2/license.png)](https://www.versioneye.com/user/projects/5a18bd670fb24f2125873c86#tab-dependencies) [![Latest Stable Version](https://poser.pugx.org/typhonius/acquia-php-sdk-v2/v/stable.png)](https://packagist.org/packages/typhonius/acquia-php-sdk-v2) [![Latest Unstable Version](https://poser.pugx.org/typhonius/acquia-php-sdk-v2/v/unstable.png)](https://packagist.org/packages/typhonius/acquia-php-sdk-v2) @@ -20,7 +21,7 @@ library as a dependency to your composer.json file. ```json { "require": { - "typhonius/acquia-php-sdk-v2": "^1.0.0" + "typhonius/acquia-php-sdk-v2": "^2.0.0" } } ``` @@ -42,8 +43,12 @@ Basic usage examples for the SDK. require 'vendor/autoload.php'; -use AcquiaCloudApi\CloudApi\Client; -use AcquiaCloudApi\CloudApi\Connector; +use AcquiaCloudApi\Connector\Client; +use AcquiaCloudApi\Connector\Connector; +use AcquiaCloudApi\Endpoints\Applications; +use AcquiaCloudApi\Endpoints\Environments; +use AcquiaCloudApi\Endpoints\Servers; +use AcquiaCloudApi\Endpoints\DatabaseBackups; $key = 'd0697bfc-7f56-4942-9205-b5686bf5b3f5'; $secret = 'D5UfO/4FfNBWn4+0cUwpLOoFzfP7Qqib4AoY+wYGsKE='; @@ -52,17 +57,26 @@ $config = [ 'key' => $key, 'secret' => $secret, ]; + $connector = new Connector($config); -$cloudapi = Client::factory($connector); +$client = Client::factory($connector); + +$application = new Applications($client); +$environment = new Environments($client); +$server = new Servers($client); +$backup = new DatabaseBackups($client); // Get all applications. -$applications = $cloudapi->applications(); +$applications = $application->getAll(); // Get all environments of an application. -$environments = $cloudapi->environments($application->uuid); +$environments = $environment->getAll($applicationUuid); // Get all servers in an environment. -$servers = $cloudapi->servers($environment->uuid); +$servers = $server->getAll($environmentUuid); + +// Create DB backup +$backup->create($environmentUuid, $dbName); ``` diff --git a/composer.json b/composer.json index febc8ccc..0ea91ecd 100644 --- a/composer.json +++ b/composer.json @@ -10,18 +10,22 @@ "license": "MIT", "require": { "guzzlehttp/guzzle": "^6.3", - "php": ">=5.6", + "php": ">=7.1", "league/oauth2-client": "^2.4" }, "require-dev": { "php-coveralls/php-coveralls": "^2.0.0", - "phpunit/phpunit": "^6.4", - "squizlabs/php_codesniffer": "^2.7" + "phpunit/phpunit": "^7.0", + "squizlabs/php_codesniffer": "^2.7", + "phpstan/phpstan": "^0.11.19", + "phpstan/phpstan-phpunit": "^0.11.2" }, "autoload":{ "psr-4":{ - "AcquiaCloudApi\\CloudApi\\":"src/CloudApi", - "AcquiaCloudApi\\Response\\":"src/Response" + "AcquiaCloudApi\\Connector\\":"src/Connector", + "AcquiaCloudApi\\Endpoints\\":"src/Endpoints", + "AcquiaCloudApi\\Response\\":"src/Response", + "AcquiaCloudApi\\Exception\\":"src/Exception" } }, "autoload-dev": { @@ -31,8 +35,9 @@ }, "scripts": { "lint": "php -l ./src/", - "sniff": "./vendor/bin/phpcs -s --standard=PSR2 ./src/", + "sniff": "./vendor/bin/phpcs -s --standard=PSR2 ./src/ ./tests/", "test": "./vendor/bin/phpunit --coverage-clover ./tests/logs/clover.xml", + "stan": "./vendor/bin/phpstan analyse --level 5 src tests", "coveralls": "php ./vendor/bin/php-coveralls -v" } } diff --git a/composer.lock b/composer.lock index ee20dee3..b98950b5 100644 --- a/composer.lock +++ b/composer.lock @@ -4,31 +4,32 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6bc1b72f0acef84fd5639a52d3e4d0b4", + "content-hash": "ce9ffa48fd8be373b54aabaef609dd9e", "packages": [ { "name": "guzzlehttp/guzzle", - "version": "6.3.0", + "version": "6.4.1", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699" + "reference": "0895c932405407fd3a7368b6910c09a24d26db11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f4db5a78a5ea468d4831de7f0bf9d9415e348699", - "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/0895c932405407fd3a7368b6910c09a24d26db11", + "reference": "0895c932405407fd3a7368b6910c09a24d26db11", "shasum": "" }, "require": { + "ext-json": "*", "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.4", + "guzzlehttp/psr7": "^1.6.1", "php": ">=5.5" }, "require-dev": { "ext-curl": "*", - "phpunit/phpunit": "^4.0 || ^5.0", - "psr/log": "^1.0" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", + "psr/log": "^1.1" }, "suggest": { "psr/log": "Required for using the Log middleware" @@ -36,16 +37,16 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "6.2-dev" + "dev-master": "6.3-dev" } }, "autoload": { - "files": [ - "src/functions_include.php" - ], "psr-4": { "GuzzleHttp\\": "src/" - } + }, + "files": [ + "src/functions_include.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -69,7 +70,7 @@ "rest", "web service" ], - "time": "2017-06-22T18:50:49+00:00" + "time": "2019-10-23T15:58:00+00:00" }, { "name": "guzzlehttp/promises", @@ -124,32 +125,37 @@ }, { "name": "guzzlehttp/psr7", - "version": "1.4.2", + "version": "1.6.1", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c" + "reference": "239400de7a173fe9901b9ac7c06497751f00727a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c", - "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a", "shasum": "" }, "require": { "php": ">=5.4.0", - "psr/http-message": "~1.0" + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" }, "provide": { "psr/http-message-implementation": "1.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "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.4-dev" + "dev-master": "1.6-dev" } }, "autoload": { @@ -179,13 +185,14 @@ "keywords": [ "http", "message", + "psr-7", "request", "response", "stream", "uri", "url" ], - "time": "2017-03-20T17:10:46+00:00" + "time": "2019-07-01T23:21:34+00:00" }, { "name": "league/oauth2-client", @@ -348,32 +355,118 @@ "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/xdebug-handler", + "version": "1.4.0", + "source": { + "type": "git", + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "cbe23383749496fe0f373345208b79568e4bc248" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/cbe23383749496fe0f373345208b79568e4bc248", + "reference": "cbe23383749496fe0f373345208b79568e4bc248", + "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": "2019-11-06T16:40:04+00:00" + }, { "name": "doctrine/instantiator", - "version": "1.1.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1", + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1", "shasum": "" }, "require": { "php": "^7.1" }, "require-dev": { - "athletic/athletic": "~0.1.8", + "doctrine/coding-standard": "^6.0", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "^6.2.3", - "squizlabs/php_codesniffer": "^3.0.2" + "phpbench/phpbench": "^0.13", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-shim": "^0.11", + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { @@ -398,34 +491,88 @@ } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", "keywords": [ "constructor", "instantiate" ], - "time": "2017-07-22T11:58:36+00:00" + "time": "2019-10-21T16:45:58+00:00" + }, + { + "name": "jean85/pretty-package-versions", + "version": "1.2", + "source": { + "type": "git", + "url": "https://github.com/Jean85/pretty-package-versions.git", + "reference": "75c7effcf3f77501d0e0caa75111aff4daa0dd48" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/75c7effcf3f77501d0e0caa75111aff4daa0dd48", + "reference": "75c7effcf3f77501d0e0caa75111aff4daa0dd48", + "shasum": "" + }, + "require": { + "ocramius/package-versions": "^1.2.0", + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Jean85\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alessandro Lai", + "email": "alessandro.lai85@gmail.com" + } + ], + "description": "A wrapper for ocramius/package-versions to get pretty versions strings", + "keywords": [ + "composer", + "package", + "release", + "versions" + ], + "time": "2018-06-13T13:22:40+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.7.0", + "version": "1.9.3", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" + "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/007c053ae6f31bba39dfa19a7726f56e9763bbea", + "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.1" + }, + "replace": { + "myclabs/deep-copy": "self.version" }, "require-dev": { "doctrine/collections": "^1.0", "doctrine/common": "^2.6", - "phpunit/phpunit": "^4.1" + "phpunit/phpunit": "^7.1" }, "type": "library", "autoload": { @@ -448,32 +595,52 @@ "object", "object graph" ], - "time": "2017-10-19T19:58:43+00:00" + "time": "2019-08-09T12:45:53+00:00" }, { - "name": "phar-io/manifest", - "version": "1.0.1", + "name": "nette/bootstrap", + "version": "v3.0.1", "source": { "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" + "url": "https://github.com/nette/bootstrap.git", + "reference": "b45a1e33b6a44beb307756522396551e5a9ff249" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", - "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", + "url": "https://api.github.com/repos/nette/bootstrap/zipball/b45a1e33b6a44beb307756522396551e5a9ff249", + "reference": "b45a1e33b6a44beb307756522396551e5a9ff249", "shasum": "" }, "require": { - "ext-dom": "*", - "ext-phar": "*", - "phar-io/version": "^1.0.1", - "php": "^5.6 || ^7.0" + "nette/di": "^3.0", + "nette/utils": "^3.0", + "php": ">=7.1" + }, + "conflict": { + "tracy/tracy": "<2.6" + }, + "require-dev": { + "latte/latte": "^2.2", + "nette/application": "^3.0", + "nette/caching": "^3.0", + "nette/database": "^3.0", + "nette/forms": "^3.0", + "nette/http": "^3.0", + "nette/mail": "^3.0", + "nette/robot-loader": "^3.0", + "nette/safe-stream": "^2.2", + "nette/security": "^3.0", + "nette/tester": "^2.0", + "tracy/tracy": "^2.6" + }, + "suggest": { + "nette/robot-loader": "to use Configurator::createRobotLoader()", + "tracy/tracy": "to use Configurator::enableTracy()" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -483,249 +650,856 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" ], "authors": [ { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" + "name": "David Grudl", + "homepage": "https://davidgrudl.com" }, { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" + "name": "Nette Community", + "homepage": "https://nette.org/contributors" } ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2017-03-05T18:14:27+00:00" + "description": "🅱 Nette Bootstrap: the simple way to configure and bootstrap your Nette application.", + "homepage": "https://nette.org", + "keywords": [ + "bootstrapping", + "configurator", + "nette" + ], + "time": "2019-09-30T08:19:38+00:00" }, { - "name": "phar-io/version", - "version": "1.0.1", + "name": "nette/di", + "version": "v3.0.1", "source": { "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df" + "url": "https://github.com/nette/di.git", + "reference": "4aff517a1c6bb5c36fa09733d4cea089f529de6d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df", - "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df", + "url": "https://api.github.com/repos/nette/di/zipball/4aff517a1c6bb5c36fa09733d4cea089f529de6d", + "reference": "4aff517a1c6bb5c36fa09733d4cea089f529de6d", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "ext-tokenizer": "*", + "nette/neon": "^3.0", + "nette/php-generator": "^3.2.2", + "nette/robot-loader": "^3.2", + "nette/schema": "^1.0", + "nette/utils": "^3.0", + "php": ">=7.1" + }, + "conflict": { + "nette/bootstrap": "<3.0" + }, + "require-dev": { + "nette/tester": "^2.2", + "tracy/tracy": "^2.3" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, "autoload": { "classmap": [ "src/" + ], + "files": [ + "src/compatibility.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" ], "authors": [ { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" + "name": "David Grudl", + "homepage": "https://davidgrudl.com" }, { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" + "name": "Nette Community", + "homepage": "https://nette.org/contributors" } ], - "description": "Library for handling version information and constraints", - "time": "2017-03-05T17:38:23+00:00" + "description": "💎 Nette Dependency Injection Container: Flexible, compiled and full-featured DIC with perfectly usable autowiring and support for all new PHP 7.1 features.", + "homepage": "https://nette.org", + "keywords": [ + "compiled", + "di", + "dic", + "factory", + "ioc", + "nette", + "static" + ], + "time": "2019-08-07T12:11:33+00:00" }, { - "name": "php-coveralls/php-coveralls", - "version": "v2.0.0", + "name": "nette/finder", + "version": "v2.5.1", "source": { "type": "git", - "url": "https://github.com/php-coveralls/php-coveralls.git", - "reference": "3eaf7eb689cdf6b86801a3843940d974dc657068" + "url": "https://github.com/nette/finder.git", + "reference": "14164e1ddd69e9c5f627ff82a10874b3f5bba5fe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-coveralls/php-coveralls/zipball/3eaf7eb689cdf6b86801a3843940d974dc657068", - "reference": "3eaf7eb689cdf6b86801a3843940d974dc657068", + "url": "https://api.github.com/repos/nette/finder/zipball/14164e1ddd69e9c5f627ff82a10874b3f5bba5fe", + "reference": "14164e1ddd69e9c5f627ff82a10874b3f5bba5fe", "shasum": "" }, "require": { - "ext-json": "*", - "ext-simplexml": "*", - "guzzlehttp/guzzle": "^6.0", - "php": "^5.5 || ^7.0", - "psr/log": "^1.0", - "symfony/config": "^2.1 || ^3.0 || ^4.0", - "symfony/console": "^2.1 || ^3.0 || ^4.0", - "symfony/stopwatch": "^2.0 || ^3.0 || ^4.0", - "symfony/yaml": "^2.0 || ^3.0 || ^4.0" + "nette/utils": "^2.4 || ~3.0.0", + "php": ">=7.1" }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.4.3 || ^6.0" + "conflict": { + "nette/nette": "<2.2" }, - "suggest": { - "symfony/http-kernel": "Allows Symfony integration" + "require-dev": { + "nette/tester": "^2.0", + "tracy/tracy": "^2.3" }, - "bin": [ - "bin/php-coveralls" - ], "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "2.5-dev" } }, "autoload": { - "psr-4": { - "PhpCoveralls\\": "src/" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" ], "authors": [ { - "name": "Kitamura Satoshi", - "email": "with.no.parachute@gmail.com", - "homepage": "https://www.facebook.com/satooshi.jp", - "role": "Original creator" - }, - { - "name": "Takashi Matsuo", - "email": "tmatsuo@google.com" - }, - { - "name": "Google Inc" - }, - { - "name": "Dariusz Ruminski", - "email": "dariusz.ruminski@gmail.com", - "homepage": "https://github.com/keradus" + "name": "David Grudl", + "homepage": "https://davidgrudl.com" }, { - "name": "Contributors", - "homepage": "https://github.com/php-coveralls/php-coveralls/graphs/contributors" + "name": "Nette Community", + "homepage": "https://nette.org/contributors" } ], - "description": "PHP client library for Coveralls API", - "homepage": "https://github.com/php-coveralls/php-coveralls", + "description": "🔍 Nette Finder: find files and directories with an intuitive API.", + "homepage": "https://nette.org", "keywords": [ - "ci", - "coverage", - "github", - "test" + "filesystem", + "glob", + "iterator", + "nette" ], - "time": "2017-12-08T14:28:16+00:00" + "time": "2019-07-11T18:02:17+00:00" }, { - "name": "phpdocumentor/reflection-common", - "version": "1.0.1", + "name": "nette/neon", + "version": "v3.0.0", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + "url": "https://github.com/nette/neon.git", + "reference": "cbff32059cbdd8720deccf9e9eace6ee516f02eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "url": "https://api.github.com/repos/nette/neon/zipball/cbff32059cbdd8720deccf9e9eace6ee516f02eb", + "reference": "cbff32059cbdd8720deccf9e9eace6ee516f02eb", "shasum": "" }, "require": { - "php": ">=5.5" + "ext-iconv": "*", + "ext-json": "*", + "php": ">=7.0" }, "require-dev": { - "phpunit/phpunit": "^4.6" + "nette/tester": "^2.0", + "tracy/tracy": "^2.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" ], "authors": [ { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" } ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", + "description": "? Nette NEON: encodes and decodes NEON file format.", + "homepage": "http://ne-on.org", "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" + "export", + "import", + "neon", + "nette", + "yaml" ], - "time": "2017-09-11T18:02:19+00:00" + "time": "2019-02-05T21:30:40+00:00" }, { - "name": "phpdocumentor/reflection-docblock", - "version": "4.2.0", + "name": "nette/php-generator", + "version": "v3.3.1", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "66465776cfc249844bde6d117abff1d22e06c2da" + "url": "https://github.com/nette/php-generator.git", + "reference": "4240fd7adf499138c07b814ef9b9a6df9f6d7187" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/66465776cfc249844bde6d117abff1d22e06c2da", - "reference": "66465776cfc249844bde6d117abff1d22e06c2da", + "url": "https://api.github.com/repos/nette/php-generator/zipball/4240fd7adf499138c07b814ef9b9a6df9f6d7187", + "reference": "4240fd7adf499138c07b814ef9b9a6df9f6d7187", "shasum": "" }, "require": { - "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0.0", - "phpdocumentor/type-resolver": "^0.4.0", - "webmozart/assert": "^1.0" + "nette/utils": "^2.4.2 || ~3.0.0", + "php": ">=7.1" }, "require-dev": { - "doctrine/instantiator": "~1.0.5", - "mockery/mockery": "^1.0", - "phpunit/phpunit": "^6.4" + "nette/tester": "^2.0", + "tracy/tracy": "^2.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.x-dev" + "dev-master": "3.3-dev" } }, "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🐘 Nette PHP Generator: generates neat PHP code for you. Supports new PHP 7.3 features.", + "homepage": "https://nette.org", + "keywords": [ + "code", + "nette", + "php", + "scaffolding" + ], + "time": "2019-11-22T11:12:11+00:00" + }, + { + "name": "nette/robot-loader", + "version": "v3.2.0", + "source": { + "type": "git", + "url": "https://github.com/nette/robot-loader.git", + "reference": "0712a0e39ae7956d6a94c0ab6ad41aa842544b5c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/robot-loader/zipball/0712a0e39ae7956d6a94c0ab6ad41aa842544b5c", + "reference": "0712a0e39ae7956d6a94c0ab6ad41aa842544b5c", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "nette/finder": "^2.5", + "nette/utils": "^3.0", + "php": ">=7.1" + }, + "require-dev": { + "nette/tester": "^2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "? Nette RobotLoader: high performance and comfortable autoloader that will search and autoload classes within your application.", + "homepage": "https://nette.org", + "keywords": [ + "autoload", + "class", + "interface", + "nette", + "trait" + ], + "time": "2019-03-08T21:57:24+00:00" + }, + { + "name": "nette/schema", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/nette/schema.git", + "reference": "337117df1dade22e2ba1fdc4a4b832c1e9b06b76" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/schema/zipball/337117df1dade22e2ba1fdc4a4b832c1e9b06b76", + "reference": "337117df1dade22e2ba1fdc4a4b832c1e9b06b76", + "shasum": "" + }, + "require": { + "nette/utils": "^3.0.1", + "php": ">=7.1" + }, + "require-dev": { + "nette/tester": "^2.2", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "📐 Nette Schema: validating data structures against a given Schema.", + "homepage": "https://nette.org", + "keywords": [ + "config", + "nette" + ], + "time": "2019-10-31T20:52:19+00:00" + }, + { + "name": "nette/utils", + "version": "v3.0.2", + "source": { + "type": "git", + "url": "https://github.com/nette/utils.git", + "reference": "c133e18c922dcf3ad07673077d92d92cef25a148" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/utils/zipball/c133e18c922dcf3ad07673077d92d92cef25a148", + "reference": "c133e18c922dcf3ad07673077d92d92cef25a148", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "nette/tester": "~2.0", + "tracy/tracy": "^2.3" + }, + "suggest": { + "ext-gd": "to use Image", + "ext-iconv": "to use Strings::webalize() and toAscii()", + "ext-intl": "to use Strings::webalize(), toAscii(), normalize() and compare()", + "ext-json": "to use Nette\\Utils\\Json", + "ext-mbstring": "to use Strings::lower() etc...", + "ext-tokenizer": "to use Nette\\Utils\\Reflection::getUseStatements()", + "ext-xml": "to use Strings::length() etc. when mbstring is not available" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", + "homepage": "https://nette.org", + "keywords": [ + "array", + "core", + "datetime", + "images", + "json", + "nette", + "paginator", + "password", + "slugify", + "string", + "unicode", + "utf-8", + "utility", + "validation" + ], + "time": "2019-10-21T20:40:16+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v4.3.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "9a9981c347c5c49d6dfe5cf826bb882b824080dc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/9a9981c347c5c49d6dfe5cf826bb882b824080dc", + "reference": "9a9981c347c5c49d6dfe5cf826bb882b824080dc", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.0" + }, + "require-dev": { + "ircmaxell/php-yacc": "0.0.5", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.3-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "time": "2019-11-08T13:50:10+00:00" + }, + { + "name": "ocramius/package-versions", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/Ocramius/PackageVersions.git", + "reference": "44af6f3a2e2e04f2af46bcb302ad9600cba41c7d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/44af6f3a2e2e04f2af46bcb302ad9600cba41c7d", + "reference": "44af6f3a2e2e04f2af46bcb302ad9600cba41c7d", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0.0", + "php": "^7.1.0" + }, + "require-dev": { + "composer/composer": "^1.6.3", + "doctrine/coding-standard": "^5.0.1", + "ext-zip": "*", + "infection/infection": "^0.7.1", + "phpunit/phpunit": "^7.5.17" + }, + "type": "composer-plugin", + "extra": { + "class": "PackageVersions\\Installer", + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "PackageVersions\\": "src/PackageVersions" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", + "time": "2019-11-15T16:17:10+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^2.0", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2018-07-08T19:23:20+00:00" + }, + { + "name": "phar-io/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2018-07-08T19:19:57+00:00" + }, + { + "name": "php-coveralls/php-coveralls", + "version": "v2.2.0", + "source": { + "type": "git", + "url": "https://github.com/php-coveralls/php-coveralls.git", + "reference": "3e6420fa666ef7bae5e750ddeac903153e193bae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-coveralls/php-coveralls/zipball/3e6420fa666ef7bae5e750ddeac903153e193bae", + "reference": "3e6420fa666ef7bae5e750ddeac903153e193bae", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-simplexml": "*", + "guzzlehttp/guzzle": "^6.0", + "php": "^5.5 || ^7.0", + "psr/log": "^1.0", + "symfony/config": "^2.1 || ^3.0 || ^4.0 || ^5.0", + "symfony/console": "^2.1 || ^3.0 || ^4.0 || ^5.0", + "symfony/stopwatch": "^2.0 || ^3.0 || ^4.0 || ^5.0", + "symfony/yaml": "^2.0.5 || ^3.0 || ^4.0 || ^5.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.4.3 || ^6.0" + }, + "suggest": { + "symfony/http-kernel": "Allows Symfony integration" + }, + "bin": [ + "bin/php-coveralls" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + }, + "autoload": { + "psr-4": { + "PhpCoveralls\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kitamura Satoshi", + "email": "with.no.parachute@gmail.com", + "homepage": "https://www.facebook.com/satooshi.jp", + "role": "Original creator" + }, + { + "name": "Takashi Matsuo", + "email": "tmatsuo@google.com" + }, + { + "name": "Google Inc" + }, + { + "name": "Dariusz Ruminski", + "email": "dariusz.ruminski@gmail.com", + "homepage": "https://github.com/keradus" + }, + { + "name": "Contributors", + "homepage": "https://github.com/php-coveralls/php-coveralls/graphs/contributors" + } + ], + "description": "PHP client library for Coveralls API", + "homepage": "https://github.com/php-coveralls/php-coveralls", + "keywords": [ + "ci", + "coverage", + "github", + "test" + ], + "time": "2019-11-20T16:29:20+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a", + "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "~6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.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": "2018-08-07T13:53:10+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "4.3.2", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/b83ff7cfcfee7827e1e78b637a5904fe6a96698e", + "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e", + "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", + "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": [ @@ -738,41 +1512,40 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-11-27T17:38:31+00:00" + "time": "2019-09-12T14:27:41+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.4.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", + "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", "shasum": "" }, "require": { - "php": "^5.5 || ^7.0", - "phpdocumentor/reflection-common": "^1.0" + "php": "^7.1", + "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" + "ext-tokenizer": "^7.1", + "mockery/mockery": "~1", + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -785,107 +1558,287 @@ "email": "me@mikevanriel.com" } ], - "time": "2017-07-14T14:27:02+00:00" + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "time": "2019-08-22T18:11:29+00:00" }, { "name": "phpspec/prophecy", - "version": "1.7.3", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf" + "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf", - "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/f6811d96d97bdf400077a0cc100ae56aa32b9203", + "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", - "sebastian/comparator": "^1.1|^2.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", + "sebastian/comparator": "^1.1|^2.0|^3.0", "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7" - }, - "type": "library", + "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.8.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": "2019-10-03T11:07:50+00:00" + }, + { + "name": "phpstan/phpdoc-parser", + "version": "0.3.5", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "8c4ef2aefd9788238897b678a985e1d5c8df6db4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/8c4ef2aefd9788238897b678a985e1d5c8df6db4", + "reference": "8c4ef2aefd9788238897b678a985e1d5c8df6db4", + "shasum": "" + }, + "require": { + "php": "~7.1" + }, + "require-dev": { + "consistence/coding-standard": "^3.5", + "jakub-onderka/php-parallel-lint": "^0.9.2", + "phing/phing": "^2.16.0", + "phpstan/phpstan": "^0.10", + "phpunit/phpunit": "^6.3", + "slevomat/coding-standard": "^4.7.2", + "squizlabs/php_codesniffer": "^3.3.2", + "symfony/process": "^3.4 || ^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.3-dev" + } + }, + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "time": "2019-06-07T19:13:52+00:00" + }, + { + "name": "phpstan/phpstan", + "version": "0.11.19", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "63cc502f6957b7f74efbac444b4cf219dcadffd7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/63cc502f6957b7f74efbac444b4cf219dcadffd7", + "reference": "63cc502f6957b7f74efbac444b4cf219dcadffd7", + "shasum": "" + }, + "require": { + "composer/xdebug-handler": "^1.3.0", + "jean85/pretty-package-versions": "^1.0.3", + "nette/bootstrap": "^2.4 || ^3.0", + "nette/di": "^2.4.7 || ^3.0", + "nette/neon": "^2.4.3 || ^3.0", + "nette/robot-loader": "^3.0.1", + "nette/schema": "^1.0", + "nette/utils": "^2.4.5 || ^3.0", + "nikic/php-parser": "^4.2.3", + "php": "~7.1", + "phpstan/phpdoc-parser": "^0.3.5", + "symfony/console": "~3.2 || ~4.0", + "symfony/finder": "~3.2 || ~4.0" + }, + "conflict": { + "symfony/console": "3.4.16 || 4.1.5" + }, + "require-dev": { + "brianium/paratest": "^2.0 || ^3.0", + "consistence/coding-standard": "^3.5", + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4", + "ext-intl": "*", + "ext-mysqli": "*", + "ext-simplexml": "*", + "ext-soap": "*", + "ext-zip": "*", + "jakub-onderka/php-parallel-lint": "^1.0", + "localheinz/composer-normalize": "^1.1.0", + "phing/phing": "^2.16.0", + "phpstan/phpstan-deprecation-rules": "^0.11", + "phpstan/phpstan-php-parser": "^0.11", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-strict-rules": "^0.11", + "phpunit/phpunit": "^7.5.14 || ^8.0", + "slevomat/coding-standard": "^4.7.2", + "squizlabs/php_codesniffer": "^3.3.2" + }, + "bin": [ + "bin/phpstan" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.11-dev" + } + }, + "autoload": { + "psr-4": { + "PHPStan\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "time": "2019-10-22T20:20:22+00:00" + }, + { + "name": "phpstan/phpstan-phpunit", + "version": "0.11.2", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan-phpunit.git", + "reference": "fbf2ad56c3b13189d29655e226c9b1da47c2fad9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/fbf2ad56c3b13189d29655e226c9b1da47c2fad9", + "reference": "fbf2ad56c3b13189d29655e226c9b1da47c2fad9", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.0", + "php": "~7.1", + "phpstan/phpdoc-parser": "^0.3", + "phpstan/phpstan": "^0.11.4" + }, + "conflict": { + "phpunit/phpunit": "<7.0" + }, + "require-dev": { + "consistence/coding-standard": "^3.0.1", + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4", + "jakub-onderka/php-parallel-lint": "^1.0", + "phing/phing": "^2.16.0", + "phpstan/phpstan-strict-rules": "^0.11", + "phpunit/phpunit": "^7.0", + "satooshi/php-coveralls": "^1.0", + "slevomat/coding-standard": "^4.5.2" + }, + "type": "phpstan-extension", "extra": { "branch-alias": { - "dev-master": "1.7.x-dev" + "dev-master": "0.11-dev" + }, + "phpstan": { + "includes": [ + "extension.neon", + "rules.neon" + ] } }, "autoload": { - "psr-0": { - "Prophecy\\": "src/" + "psr-4": { + "PHPStan\\": "src/" } }, "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": "2017-11-24T13:59:53+00:00" + "description": "PHPUnit extensions and rules for PHPStan", + "time": "2019-05-17T17:50:16+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "5.3.0", + "version": "6.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "661f34d0bd3f1a7225ef491a70a020ad23a057a1" + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/661f34d0bd3f1a7225ef491a70a020ad23a057a1", - "reference": "661f34d0bd3f1a7225ef491a70a020ad23a057a1", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", - "php": "^7.0", - "phpunit/php-file-iterator": "^1.4.2", + "php": "^7.1", + "phpunit/php-file-iterator": "^2.0", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^2.0.1", + "phpunit/php-token-stream": "^3.0", "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.0", + "sebastian/environment": "^3.1 || ^4.0", "sebastian/version": "^2.0.1", "theseer/tokenizer": "^1.1" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^7.0" }, "suggest": { - "ext-xdebug": "^2.5.5" + "ext-xdebug": "^2.6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.3.x-dev" + "dev-master": "6.1-dev" } }, "autoload": { @@ -911,29 +1864,32 @@ "testing", "xunit" ], - "time": "2017-12-06T09:29:45+00:00" + "time": "2018-10-31T16:06:48+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.5", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + "reference": "050bedf145a257b1ff02746c31894800e5122946" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", + "reference": "050bedf145a257b1ff02746c31894800e5122946", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -948,7 +1904,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -958,7 +1914,7 @@ "filesystem", "iterator" ], - "time": "2017-11-27T13:52:08+00:00" + "time": "2018-09-13T20:33:42+00:00" }, { "name": "phpunit/php-text-template", @@ -1003,28 +1959,28 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.9", + "version": "2.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "2.1-dev" } }, "autoload": { @@ -1039,7 +1995,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -1048,33 +2004,33 @@ "keywords": [ "timer" ], - "time": "2017-02-26T11:10:40+00:00" + "time": "2019-06-07T04:22:29+00:00" }, { "name": "phpunit/php-token-stream", - "version": "2.0.2", + "version": "3.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "791198a2c6254db10131eecfe8c06670700904db" + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", - "reference": "791198a2c6254db10131eecfe8c06670700904db", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": "^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^6.2.4" + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1097,57 +2053,57 @@ "keywords": [ "tokenizer" ], - "time": "2017-11-27T05:48:46+00:00" + "time": "2019-09-17T06:23:10+00:00" }, { "name": "phpunit/phpunit", - "version": "6.5.4", + "version": "7.5.17", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "1b2f933d5775f9237369deaa2d2bfbf9d652be4c" + "reference": "4c92a15296e58191a4cd74cff3b34fc8e374174a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1b2f933d5775f9237369deaa2d2bfbf9d652be4c", - "reference": "1b2f933d5775f9237369deaa2d2bfbf9d652be4c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4c92a15296e58191a4cd74cff3b34fc8e374174a", + "reference": "4c92a15296e58191a4cd74cff3b34fc8e374174a", "shasum": "" }, "require": { + "doctrine/instantiator": "^1.1", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "^1.6.1", - "phar-io/manifest": "^1.0.1", - "phar-io/version": "^1.0", - "php": "^7.0", + "myclabs/deep-copy": "^1.7", + "phar-io/manifest": "^1.0.2", + "phar-io/version": "^2.0", + "php": "^7.1", "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^5.3", - "phpunit/php-file-iterator": "^1.4.3", + "phpunit/php-code-coverage": "^6.0.7", + "phpunit/php-file-iterator": "^2.0.1", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^1.0.9", - "phpunit/phpunit-mock-objects": "^5.0.5", - "sebastian/comparator": "^2.1", - "sebastian/diff": "^2.0", - "sebastian/environment": "^3.1", + "phpunit/php-timer": "^2.1", + "sebastian/comparator": "^3.0", + "sebastian/diff": "^3.0", + "sebastian/environment": "^4.0", "sebastian/exporter": "^3.1", "sebastian/global-state": "^2.0", "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^1.0", + "sebastian/resource-operations": "^2.0", "sebastian/version": "^2.0.1" }, "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2", - "phpunit/dbunit": "<3.0" + "phpunit/phpunit-mock-objects": "*" }, "require-dev": { "ext-pdo": "*" }, "suggest": { + "ext-soap": "*", "ext-xdebug": "*", - "phpunit/php-invoker": "^1.1" + "phpunit/php-invoker": "^2.0" }, "bin": [ "phpunit" @@ -1155,7 +2111,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "6.5.x-dev" + "dev-master": "7.5-dev" } }, "autoload": { @@ -1181,80 +2137,69 @@ "testing", "xunit" ], - "time": "2017-12-10T08:06:19+00:00" + "time": "2019-10-28T10:37:36+00:00" }, { - "name": "phpunit/phpunit-mock-objects", - "version": "5.0.5", + "name": "psr/container", + "version": "1.0.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "283b9f4f670e3a6fd6c4ff95c51a952eb5c75933" + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/283b9f4f670e3a6fd6c4ff95c51a952eb5c75933", - "reference": "283b9f4f670e3a6fd6c4ff95c51a952eb5c75933", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.5", - "php": "^7.0", - "phpunit/php-text-template": "^1.2.1", - "sebastian/exporter": "^3.1" - }, - "conflict": { - "phpunit/phpunit": "<6.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.5" - }, - "suggest": { - "ext-soap": "*" + "php": ">=5.3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "Psr\\Container\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" } ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", "keywords": [ - "mock", - "xunit" + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" ], - "abandoned": true, - "time": "2017-12-10T08:01:53+00:00" + "time": "2017-02-14T16:28:37+00:00" }, { "name": "psr/log", - "version": "1.0.2", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801", + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801", "shasum": "" }, "require": { @@ -1263,7 +2208,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { @@ -1288,7 +2233,7 @@ "psr", "psr-3" ], - "time": "2016-10-10T12:19:37+00:00" + "time": "2019-11-01T11:05:21+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -1337,30 +2282,30 @@ }, { "name": "sebastian/comparator", - "version": "2.1.0", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "1174d9018191e93cb9d719edec01257fc05f8158" + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1174d9018191e93cb9d719edec01257fc05f8158", - "reference": "1174d9018191e93cb9d719edec01257fc05f8158", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", "shasum": "" }, "require": { - "php": "^7.0", - "sebastian/diff": "^2.0", + "php": "^7.1", + "sebastian/diff": "^3.0", "sebastian/exporter": "^3.1" }, "require-dev": { - "phpunit/phpunit": "^6.4" + "phpunit/phpunit": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1397,32 +2342,33 @@ "compare", "equality" ], - "time": "2017-11-03T07:16:52+00:00" + "time": "2018-07-12T15:12:46+00:00" }, { "name": "sebastian/diff", - "version": "2.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd" + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", - "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", "shasum": "" }, "require": { - "php": "^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^6.2" + "phpunit/phpunit": "^7.5 || ^8.0", + "symfony/process": "^2 || ^3.3 || ^4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1447,34 +2393,40 @@ "description": "Diff implementation", "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ - "diff" + "diff", + "udiff", + "unidiff", + "unified diff" ], - "time": "2017-08-03T08:09:46+00:00" + "time": "2019-02-04T06:01:07+00:00" }, { "name": "sebastian/environment", - "version": "3.1.0", + "version": "4.2.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", - "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368", "shasum": "" }, "require": { - "php": "^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^6.1" + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1.x-dev" + "dev-master": "4.2-dev" } }, "autoload": { @@ -1499,20 +2451,20 @@ "environment", "hhvm" ], - "time": "2017-07-01T08:51:00+00:00" + "time": "2019-11-20T08:46:58+00:00" }, { "name": "sebastian/exporter", - "version": "3.1.0", + "version": "3.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", - "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", "shasum": "" }, "require": { @@ -1539,6 +2491,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -1547,17 +2503,13 @@ "name": "Volker Dusch", "email": "github@wallbash.com" }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, { "name": "Adam Harvey", "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" } ], "description": "Provides the functionality to export PHP variables for visualization", @@ -1566,7 +2518,7 @@ "export", "exporter" ], - "time": "2017-04-03T13:19:02+00:00" + "time": "2019-09-14T09:02:43+00:00" }, { "name": "sebastian/global-state", @@ -1766,25 +2718,25 @@ }, { "name": "sebastian/resource-operations", - "version": "1.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", "shasum": "" }, "require": { - "php": ">=5.6.0" + "php": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1804,7 +2756,7 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" + "time": "2018-10-04T04:07:39+00:00" }, { "name": "sebastian/version", @@ -1851,16 +2803,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "2.9.1", + "version": "2.9.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62" + "reference": "2acf168de78487db620ab4bc524135a13cfe6745" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dcbed1074f8244661eecddfc2a675430d8d33f62", - "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/2acf168de78487db620ab4bc524135a13cfe6745", + "reference": "2acf168de78487db620ab4bc524135a13cfe6745", "shasum": "" }, "require": { @@ -1925,34 +2877,36 @@ "phpcs", "standards" ], - "time": "2017-05-22T02:43:20+00:00" + "time": "2018-11-07T22:31:41+00:00" }, { "name": "symfony/config", - "version": "v3.4.1", + "version": "v4.4.1", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "1de51a6c76359897ab32c309934b93d036bccb60" + "reference": "7aa5817f1b7a8ed377752b90fcc47dfb3c67b40c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/1de51a6c76359897ab32c309934b93d036bccb60", - "reference": "1de51a6c76359897ab32c309934b93d036bccb60", + "url": "https://api.github.com/repos/symfony/config/zipball/7aa5817f1b7a8ed377752b90fcc47dfb3c67b40c", + "reference": "7aa5817f1b7a8ed377752b90fcc47dfb3c67b40c", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/filesystem": "~2.8|~3.0|~4.0" + "php": "^7.1.3", + "symfony/filesystem": "^3.4|^4.0|^5.0", + "symfony/polyfill-ctype": "~1.8" }, "conflict": { - "symfony/dependency-injection": "<3.3", - "symfony/finder": "<3.3" + "symfony/finder": "<3.4" }, "require-dev": { - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/finder": "~3.3|~4.0", - "symfony/yaml": "~3.0|~4.0" + "symfony/event-dispatcher": "^3.4|^4.0|^5.0", + "symfony/finder": "^3.4|^4.0|^5.0", + "symfony/messenger": "^4.1|^5.0", + "symfony/service-contracts": "^1.1|^2", + "symfony/yaml": "^3.4|^4.0|^5.0" }, "suggest": { "symfony/yaml": "To use the yaml reference dumper" @@ -1960,7 +2914,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -1987,38 +2941,45 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2017-11-19T20:09:36+00:00" + "time": "2019-12-01T10:50:45+00:00" }, { "name": "symfony/console", - "version": "v3.4.1", + "version": "v4.4.1", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "2cdef78de8f54f68ff16a857e710e7302b47d4c7" + "reference": "f0aea3df20d15635b3cb9730ca5eea1c65b7f201" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/2cdef78de8f54f68ff16a857e710e7302b47d4c7", - "reference": "2cdef78de8f54f68ff16a857e710e7302b47d4c7", + "url": "https://api.github.com/repos/symfony/console/zipball/f0aea3df20d15635b3cb9730ca5eea1c65b7f201", + "reference": "f0aea3df20d15635b3cb9730ca5eea1c65b7f201", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/debug": "~2.8|~3.0|~4.0", - "symfony/polyfill-mbstring": "~1.0" + "php": "^7.1.3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.8", + "symfony/service-contracts": "^1.1|^2" }, "conflict": { "symfony/dependency-injection": "<3.4", + "symfony/event-dispatcher": "<4.3|>=5", + "symfony/lock": "<4.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" + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/dependency-injection": "^3.4|^4.0|^5.0", + "symfony/event-dispatcher": "^4.3", + "symfony/lock": "^4.4|^5.0", + "symfony/process": "^3.4|^4.0|^5.0", + "symfony/var-dumper": "^4.3|^5.0" }, "suggest": { "psr/log": "For using the console logger", @@ -2029,7 +2990,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -2056,41 +3017,35 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-12-02T18:20:11+00:00" + "time": "2019-12-01T10:06:17+00:00" }, { - "name": "symfony/debug", - "version": "v3.4.1", + "name": "symfony/filesystem", + "version": "v4.4.1", "source": { "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "fb2001e5d85f95d8b6ab94ae3be5d2672df128fd" + "url": "https://github.com/symfony/filesystem.git", + "reference": "40c2606131d56eff6f193b6e2ceb92414653b591" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/fb2001e5d85f95d8b6ab94ae3be5d2672df128fd", - "reference": "fb2001e5d85f95d8b6ab94ae3be5d2672df128fd", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/40c2606131d56eff6f193b6e2ceb92414653b591", + "reference": "40c2606131d56eff6f193b6e2ceb92414653b591", "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" + "php": "^7.1.3", + "symfony/polyfill-ctype": "~1.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.4-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Debug\\": "" + "Symfony\\Component\\Filesystem\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -2110,36 +3065,36 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Debug Component", + "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2017-11-21T09:01:46+00:00" + "time": "2019-11-26T23:16:41+00:00" }, { - "name": "symfony/filesystem", - "version": "v3.4.1", + "name": "symfony/finder", + "version": "v4.4.1", "source": { "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "de56eee71e0a128d8c54ccc1909cdefd574bad0f" + "url": "https://github.com/symfony/finder.git", + "reference": "ce8743441da64c41e2a667b8eb66070444ed911e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/de56eee71e0a128d8c54ccc1909cdefd574bad0f", - "reference": "de56eee71e0a128d8c54ccc1909cdefd574bad0f", + "url": "https://api.github.com/repos/symfony/finder/zipball/ce8743441da64c41e2a667b8eb66070444ed911e", + "reference": "ce8743441da64c41e2a667b8eb66070444ed911e", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.4-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Filesystem\\": "" + "Symfony\\Component\\Finder\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -2159,22 +3114,80 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Filesystem Component", + "description": "Symfony Finder Component", + "homepage": "https://symfony.com", + "time": "2019-11-17T21:56:56+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.13.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-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", - "time": "2017-11-19T18:59:05+00:00" + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2019-11-27T13:56:44+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.6.0", + "version": "v1.13.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" + "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", - "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f", + "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f", "shasum": "" }, "require": { @@ -2186,7 +3199,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6-dev" + "dev-master": "1.13-dev" } }, "autoload": { @@ -2220,29 +3233,146 @@ "portable", "shim" ], - "time": "2017-10-11T12:05:26+00:00" + "time": "2019-11-27T14:18:11+00:00" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.13.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "4b0e2222c55a25b4541305a053013d5647d3a25f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/4b0e2222c55a25b4541305a053013d5647d3a25f", + "reference": "4b0e2222c55a25b4541305a053013d5647d3a25f", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "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.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2019-11-27T16:25:15+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v1.1.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "ffc7f5692092df31515df2a5ecf3b7302b3ddacf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/ffc7f5692092df31515df2a5ecf3b7302b3ddacf", + "reference": "ffc7f5692092df31515df2a5ecf3b7302b3ddacf", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "psr/container": "^1.0" + }, + "suggest": { + "symfony/service-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + } + }, + "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": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "time": "2019-10-14T12:27:06+00:00" }, { "name": "symfony/stopwatch", - "version": "v3.4.1", + "version": "v4.4.1", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "52510fe1aefdc1c5d2076ac6030421d387e689d1" + "reference": "5745b514fc56ae1907c6b8ed74f94f90f64694e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/52510fe1aefdc1c5d2076ac6030421d387e689d1", - "reference": "52510fe1aefdc1c5d2076ac6030421d387e689d1", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/5745b514fc56ae1907c6b8ed74f94f90f64694e9", + "reference": "5745b514fc56ae1907c6b8ed74f94f90f64694e9", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3", + "symfony/service-contracts": "^1.0|^2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -2269,30 +3399,31 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2017-11-07T14:28:09+00:00" + "time": "2019-11-05T16:11:08+00:00" }, { "name": "symfony/yaml", - "version": "v3.4.1", + "version": "v4.4.1", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "f6a99b95b338799645fe9f7880d7d4ca1bf79cc1" + "reference": "76de473358fe802578a415d5bb43c296cf09d211" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/f6a99b95b338799645fe9f7880d7d4ca1bf79cc1", - "reference": "f6a99b95b338799645fe9f7880d7d4ca1bf79cc1", + "url": "https://api.github.com/repos/symfony/yaml/zipball/76de473358fe802578a415d5bb43c296cf09d211", + "reference": "76de473358fe802578a415d5bb43c296cf09d211", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3", + "symfony/polyfill-ctype": "~1.8" }, "conflict": { "symfony/console": "<3.4" }, "require-dev": { - "symfony/console": "~3.4|~4.0" + "symfony/console": "^3.4|^4.0|^5.0" }, "suggest": { "symfony/console": "For validating YAML files using the lint command" @@ -2300,7 +3431,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -2327,20 +3458,20 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-12-04T18:15:22+00:00" + "time": "2019-11-12T14:51:11+00:00" }, { "name": "theseer/tokenizer", - "version": "1.1.0", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", "shasum": "" }, "require": { @@ -2367,35 +3498,33 @@ } ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2017-04-07T12:08:54+00:00" + "time": "2019-06-13T22:48:21+00:00" }, { "name": "webmozart/assert", - "version": "1.2.0", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" + "reference": "573381c0a64f155a0d9a23f4b0c797194805b925" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", + "url": "https://api.github.com/repos/webmozart/assert/zipball/573381c0a64f155a0d9a23f4b0c797194805b925", + "reference": "573381c0a64f155a0d9a23f4b0c797194805b925", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^5.3.3 || ^7.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "vimeo/psalm": "<3.6.0" }, "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" + "phpunit/phpunit": "^4.8.36 || ^7.5.13" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -2417,7 +3546,7 @@ "check", "validate" ], - "time": "2016-11-23T20:04:58+00:00" + "time": "2019-11-24T13:36:37+00:00" } ], "aliases": [], @@ -2426,7 +3555,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=5.6" + "php": ">=7.1" }, "platform-dev": [] } diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 00000000..18c6d6d7 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,2 @@ +includes: + - vendor/phpstan/phpstan-phpunit/extension.neon diff --git a/src/CloudApi/Client.php b/src/CloudApi/Client.php deleted file mode 100644 index e1bea11f..00000000 --- a/src/CloudApi/Client.php +++ /dev/null @@ -1,1209 +0,0 @@ -connector = $connector; - } - - /** - * Client factory method for instantiating . - * - * @param ConnectorInterface $connector - * - * @return static - */ - public static function factory(ConnectorInterface $connector) - { - $client = new static( - $connector - ); - - return $client; - } - - /** - * Get query from Client. - * - * @return array - */ - public function getQuery() - { - return $this->query; - } - - /** - * Clear query. - */ - public function clearQuery() - { - $this->query = []; - } - - /** - * Add a query parameter to filter results. - * - * @param string $name - * @param string $value - */ - public function addQuery($name, $value) - { - $this->query = array_merge_recursive($this->query, [$name => $value]); - } - - /** - * Returns details about your account. - * - * @return AccountResponse - */ - public function account() - { - return new AccountResponse($this->connector->request('get', '/account', $this->query)); - } - - /** - * Returns details about a notification. - * - * @return NotificationResponse - */ - public function notification($notificationUuid) - { - return new NotificationResponse( - $this->connector->request( - 'get', - "/notifications/${notificationUuid}", - $this->query - ) - ); - } - - /** - * Returns a list of notifications. - * - * @param string $applicationUuid - * - * @return NotificationsResponse - */ - public function notifications($applicationUuid) - { - return new NotificationsResponse( - $this->connector->request( - 'get', - "/applications/${applicationUuid}/notifications", - $this->query - ) - ); - } - - /** - * Shows all applications. - * - * @return ApplicationsResponse - */ - public function applications() - { - return new ApplicationsResponse($this->connector->request('get', '/applications', $this->query)); - } - - /** - * Shows information about an application. - * - * @param string $applicationUuid - * @return ApplicationResponse - */ - public function application($applicationUuid) - { - return new ApplicationResponse( - $this->connector->request( - 'get', - "/applications/${applicationUuid}", - $this->query - ) - ); - } - - /** - * Renames an application. - * - * @param string $applicationUuid - * @param string $name - * @return OperationResponse - */ - public function renameApplication($applicationUuid, $name) - { - - $options = [ - 'form_params' => [ - 'name' => $name, - ], - ]; - - return new OperationResponse( - $this->connector->request( - 'put', - "/applications/${applicationUuid}", - $options, - $this->query - ) - ); - } - - /** - * Shows all code branches and tags in an application. - * - * @param string $applicationUuid - * @return BranchesResponse - */ - public function code($applicationUuid) - { - return new BranchesResponse( - $this->connector->request( - 'get', - "/applications/${applicationUuid}/code", - $this->query - ) - ); - } - - /** - * Shows all databases in an application. - * - * @param string $applicationUuid - * @return DatabasesResponse - */ - public function databases($applicationUuid) - { - return new DatabasesResponse( - $this->connector->request( - 'get', - "/applications/${applicationUuid}/databases", - $this->query - ) - ); - } - - /** - * Shows all databases in an environment. - * - * @param string $environmentUuid - * @return DatabasesResponse - */ - public function environmentDatabases($environmentUuid) - { - return new DatabasesResponse( - $this->connector->request( - 'get', - "/environments/${environmentUuid}/databases", - $this->query - ) - ); - } - - /** - * Copies a database from an environment to an environment. - * - * @param string $environmentFromUuid - * @param string $dbName - * @param string $environmentToUuid - * @return OperationResponse - */ - public function databaseCopy($environmentFromUuid, $dbName, $environmentToUuid) - { - $options = [ - 'form_params' => [ - 'name' => $dbName, - 'source' => $environmentFromUuid, - ], - ]; - - return new OperationResponse( - $this->connector->request('post', "/environments/${environmentToUuid}/databases", $this->query, $options) - ); - } - - /** - * Create a new database. - * - * @param string $applicationUuid - * @param string $name - * @return OperationResponse - */ - public function databaseCreate($applicationUuid, $name) - { - $options = [ - 'form_params' => [ - 'name' => $name, - ], - ]; - - return new OperationResponse( - $this->connector->request('post', "/applications/${applicationUuid}/databases", $this->query, $options) - ); - } - - /** - * Delete a database. - * - * @param string $applicationUuid - * @param string $name - * @return OperationResponse - */ - public function databaseDelete($applicationUuid, $name) - { - return new OperationResponse( - $this->connector->request('delete', "/applications/${applicationUuid}/databases/${name}", $this->query) - ); - } - - /** - * Backup a database. - * - * @param string $environmentUuid - * @param string $dbName - * @return OperationResponse - */ - public function createDatabaseBackup($environmentUuid, $dbName) - { - return new OperationResponse( - $this->connector->request( - 'post', - "/environments/${environmentUuid}/databases/${dbName}/backups", - $this->query - ) - ); - } - - /** - * Shows all database backups in an environment. - * - * @param string $environmentUuid - * @param string $dbName - * @return BackupsResponse - */ - public function databaseBackups($environmentUuid, $dbName) - { - return new BackupsResponse( - $this->connector->request( - 'get', - "/environments/${environmentUuid}/databases/${dbName}/backups", - $this->query - ) - ); - } - - /** - * Gets information about a database backup. - * - * @param string $environmentUuid - * @param string $dbName - * @param int $backupId - * @return BackupResponse - */ - public function databaseBackup($environmentUuid, $dbName, $backupId) - { - return new BackupResponse( - $this->connector->request( - 'get', - "/environments/${environmentUuid}/databases/${dbName}/backups/${backupId}", - $this->query - ) - ); - } - - /** - * Restores a database backup to a database in an environment. - * - * @param string $environmentUuid - * @param string $dbName - * @param int $backupId - * @return OperationResponse - */ - public function restoreDatabaseBackup($environmentUuid, $dbName, $backupId) - { - return new OperationResponse( - $this->connector->request( - 'post', - "/environments/${environmentUuid}/databases/${dbName}/backups/${backupId}/actions/restore", - $this->query - ) - ); - } - - /** - * Copies files from an environment to another environment. - * - * @param string $environmentUuidFrom - * @param string $environmentUuidTo - * @return OperationResponse - */ - public function copyFiles($environmentUuidFrom, $environmentUuidTo) - { - $options = [ - 'form_params' => [ - 'source' => $environmentUuidFrom, - ], - ]; - - return new OperationResponse( - $this->connector->request('post', "/environments/${environmentUuidTo}/files", $this->query, $options) - ); - } - - /** - * Deploys a code branch/tag to an environment. - * - * @param string $environmentUuid - * @param string $branch - * @return OperationResponse - */ - public function switchCode($environmentUuid, $branch) - { - - $options = [ - 'form_params' => [ - 'branch' => $branch, - ], - ]; - - return new OperationResponse( - $this->connector->request( - 'post', - "/environments/${environmentUuid}/code/actions/switch", - $this->query, - $options - ) - ); - } - - /** - * Deploys code from one environment to another environment. - * - * @param string $environmentFromUuid - * @param string $environmentToUuid - * @param string $commitMessage - */ - public function deployCode($environmentFromUuid, $environmentToUuid, $commitMessage = null) - { - - $options = [ - 'form_params' => [ - 'source' => $environmentFromUuid, - 'message' => $commitMessage, - ], - ]; - - return new OperationResponse( - $this->connector->request( - 'post', - "/environments/${environmentToUuid}/code", - $this->query, - $options - ) - ); - } - - /** - * Shows all domains on an environment. - * - * @param string $environmentUuid - * @return DomainsResponse - */ - public function domains($environmentUuid) - { - return new DomainsResponse( - $this->connector->request( - 'get', - "/environments/${environmentUuid}/domains", - $this->query - ) - ); - } - - /** - * Return details about a domain. - * - * @param string $environmentUuid - * @param string $domain - * @return DomainResponse - */ - public function domain($environmentUuid, $domain) - { - return new DomainResponse( - $this->connector->request( - 'get', - "/environments/${environmentUuid}/domains/${domain}", - $this->query - ) - ); - } - - /** - * Adds a domain to an environment. - * - * @param string $environmentUuid - * @param string $hostname - * @return OperationResponse - */ - public function createDomain($environmentUuid, $hostname) - { - - $options = [ - 'form_params' => [ - 'hostname' => $hostname, - ], - ]; - - return new OperationResponse( - $this->connector->request('post', "/environments/${environmentUuid}/domains", $this->query, $options) - ); - } - - /** - * Deletes a domain from an environment. - * - * @param string $environmentUuid - * @param string $domain - * @return OperationResponse - */ - public function deleteDomain($environmentUuid, $domain) - { - return new OperationResponse( - $this->connector->request('delete', "/environments/${environmentUuid}/domains/${domain}", $this->query) - ); - } - - /** - * Purges varnish for selected domains in an environment. - * - * @param string $environmentUuid - * @param array $domains - * @return OperationResponse - */ - public function purgeVarnishCache($environmentUuid, array $domains) - { - - $options = [ - 'form_params' => [ - 'domains' => $domains, - ], - ]; - - return new OperationResponse( - $this->connector->request( - 'post', - "/environments/${environmentUuid}/domains/actions/clear-varnish", - $this->query, - $options - ) - ); - } - - /** - * Shows all tasks in an application. - * - * @param string $applicationUuid - * @return TasksResponse - */ - public function tasks($applicationUuid) - { - return new TasksResponse( - $this->connector->request( - 'get', - "/applications/${applicationUuid}/tasks", - $this->query - ) - ); - } - - /** - * Shows all environments in an application. - * - * @param string $applicationUuid - * @return EnvironmentsResponse - */ - public function environments($applicationUuid) - { - return new EnvironmentsResponse( - $this->connector->request( - 'get', - "/applications/${applicationUuid}/environments", - $this->query - ) - ); - } - - /** - * Gets information about an environment. - * - * @param string $environmentUuid - * @return EnvironmentResponse - */ - public function environment($environmentUuid) - { - return new EnvironmentResponse( - $this->connector->request( - 'get', - "/environments/${environmentUuid}", - $this->query - ) - ); - } - - /** - * Modifies configuration settings for an environment. - * - * @param string $environmentUuid - * @param array $config - * @return OperationResponse - */ - public function modifyEnvironment($environmentUuid, array $config) - { - - $options = [ - 'form_params' => $config, - ]; - - return new OperationResponse( - $this->connector->request( - 'put', - "/environments/${environmentUuid}", - $this->query, - $options - ) - ); - } - - /** - * Renames an environment. - * - * @param string $environmentUuid - * @param string $label - * @return OperationResponse - */ - public function renameEnvironment($environmentUuid, $label) - { - - $options = [ - 'form_params' => [ - 'label' => $label, - ], - ]; - - return new OperationResponse( - $this->connector->request( - 'post', - "/environments/${environmentUuid}/actions/change-label", - $this->query, - $options - ) - ); - } - - /** - * Deletes an environment. - * - * @param string $environmentUuid - * @return OperationResponse - */ - public function deleteEnvironment($environmentUuid) - { - - return new OperationResponse( - $this->connector->request( - 'delete', - "/environments/${environmentUuid}", - $this->query - ) - ); - } - - /** - * Show all servers associated with an environment. - * - * @param string $environmentUuid - * @return ServersResponse - */ - public function servers($environmentUuid) - { - return new ServersResponse( - $this->connector->request( - 'get', - "/environments/${environmentUuid}/servers", - $this->query - ) - ); - } - - /** - * Enable livedev mode for an environment. - * - * @param string $environmentUuid - * @return OperationResponse - */ - public function enableLiveDev($environmentUuid) - { - return new OperationResponse( - $this->connector->request('post', "/environments/${environmentUuid}/livedev/actions/enable", $this->query) - ); - } - - /** - * Disable livedev mode for an environment. - * - * @param string $environmentUuid - * @return OperationResponse - */ - public function disableLiveDev($environmentUuid) - { - - $options = [ - 'form_params' => [ - 'discard' => 1, - ], - ]; - - return new OperationResponse( - $this->connector->request( - 'post', - "/environments/${environmentUuid}/livedev/actions/disable", - $this->query, - $options - ) - ); - } - - /** - * Enable production mode for an environment. - * - * @param string $environmentUuid - * @return OperationResponse - */ - public function enableProductionMode($environmentUuid) - { - return new OperationResponse( - $this->connector->request( - 'post', - "/environments/${environmentUuid}/production-mode/actions/enable", - $this->query - ) - ); - } - - /** - * Disable production mode for an environment. - * - * @param string $environmentUuid - * @return OperationResponse - */ - public function disableProductionMode($environmentUuid) - { - return new OperationResponse( - $this->connector->request( - 'post', - "/environments/${environmentUuid}/production-mode/actions/disable", - $this->query - ) - ); - } - - /** - * Show all cron tasks for an environment. - * - * @param string $environmentUuid The environment ID - * @return CronsResponse - */ - public function crons($environmentUuid) - { - return new CronsResponse( - $this->connector->request( - 'get', - "/environments/${environmentUuid}/crons", - $this->query - ) - ); - } - - /** - * Get information about a cron task. - * - * @param string $environmentUuid The environment ID - * @param int $cronId - * @return CronResponse - */ - public function cron($environmentUuid, $cronId) - { - return new CronResponse( - $this->connector->request( - 'get', - "/environments/${environmentUuid}/crons/${cronId}", - $this->query - ) - ); - } - - /** - * Add a cron task. - * - * @param string $environmentUuid - * @param string $command - * @param string $frequency - * @param string $label - * @return OperationResponse - */ - public function createCron($environmentUuid, $command, $frequency, $label) - { - - $options = [ - 'form_params' => [ - 'command' => $command, - 'frequency' => $frequency, - 'label' => $label, - ], - ]; - - return new OperationResponse( - $this->connector->request('post', "/environments/${environmentUuid}/crons", $this->query, $options) - ); - } - - /** - * Delete a cron task. - * - * @param string $environmentUuid - * @param int $cronId - * @return OperationResponse - */ - public function deleteCron($environmentUuid, $cronId) - { - return new OperationResponse( - $this->connector->request('delete', "/environments/${environmentUuid}/crons/${cronId}", $this->query) - ); - } - - /** - * Disable a cron task. - * - * @param string $environmentUuid - * @param int $cronId - * @return OperationResponse - */ - public function disableCron($environmentUuid, $cronId) - { - return new OperationResponse( - $this->connector->request( - 'post', - "/environments/${environmentUuid}/crons/${cronId}/actions/disable", - $this->query - ) - ); - } - - /** - * Enable a cron task. - * - * @param string $environmentUuid - * @param int $cronId - * @return OperationResponse - */ - public function enableCron($environmentUuid, $cronId) - { - return new OperationResponse( - $this->connector->request( - 'post', - "/environments/${environmentUuid}/crons/${cronId}/actions/enable", - $this->query - ) - ); - } - - /** - * Provides an archived set of files for Acquia Drush aliases. - * - * @return StreamInterface - */ - public function drushAliases() - { - return $this->connector->request('get', '/account/drush-aliases/download', $this->query); - } - - /** - * Show insights data from an application. - * - * @param string $applicationUuid - * @return InsightsResponse - */ - public function applicationInsights($applicationUuid) - { - return new InsightsResponse( - $this->connector->request('get', "/applications/${applicationUuid}/insight", $this->query) - ); - } - - /** - * Show insights data from a specific environment. - * - * @param string $environmentUuid - * @return InsightsResponse - */ - public function environmentInsights($environmentUuid) - { - return new InsightsResponse( - $this->connector->request('get', "/environments/${environmentUuid}/insight", $this->query) - ); - } - - /** - * Show all organizations. - * - * @return OrganizationsResponse - */ - public function organizations() - { - return new OrganizationsResponse($this->connector->request('get', '/organizations', $this->query)); - } - - /** - * Show all applications in an organisation. - * - * @param string $organizationUuid - * - * @return ApplicationsResponse - */ - public function organizationApplications($organizationUuid) - { - return new ApplicationsResponse( - $this->connector->request('get', "/organizations/${organizationUuid}/applications", $this->query) - ); - } - - /** - * Show all roles in an organization. - * - * @param string $organizationUuid - * @return RolesResponse - */ - public function organizationRoles($organizationUuid) - { - return new RolesResponse( - $this->connector->request('get', "/organizations/${organizationUuid}/roles", $this->query) - ); - } - - /** - * Update the permissions associated with a role. - * - * @param string $roleUuid - * @param array $permissions - * @return OperationResponse - */ - public function updateRole($roleUuid, array $permissions) - { - $options = [ - 'form_params' => [ - 'permissions' => $permissions, - ], - ]; - - return new OperationResponse( - $this->connector->request('put', "/roles/${roleUuid}", $this->query, $options) - ); - } - - /** - * Create a new role. - * - * @param string $organizationUuid - * @param string $name - * @param array $permissions - * @param null|string $description - * @return OperationResponse - */ - public function createRole($organizationUuid, $name, array $permissions, $description = null) - { - $options = [ - 'form_params' => [ - 'name' => $name, - 'permissions' => $permissions, - 'description' => $description, - ], - ]; - - return new OperationResponse( - $this->connector->request('post', "/organizations/${organizationUuid}/roles", $this->query, $options) - ); - } - - /** - * Delete a role. - * - * @param string $roleUuid - * @return OperationResponse - */ - public function deleteRole($roleUuid) - { - return new OperationResponse($this->connector->request('delete', "/roles/${roleUuid}", $this->query)); - } - - /** - * Show all teams in an organization. - * - * @param string $organizationUuid - * @return TeamsResponse - */ - public function organizationTeams($organizationUuid) - { - return new TeamsResponse( - $this->connector->request('get', "/organizations/${organizationUuid}/teams", $this->query) - ); - } - - /** - * Show all teams. - * - * @return TeamsResponse - */ - public function teams() - { - return new TeamsResponse( - $this->connector->request('get', '/teams', $this->query) - ); - } - - /** - * Rename an existing team. - * - * @param string $teamUuid - * @param string $name - * @return OperationResponse - */ - public function renameTeam($teamUuid, $name) - { - $options = [ - 'form_params' => [ - 'name' => $name, - ], - ]; - - return new OperationResponse( - $this->connector->request('put', "/teams/${teamUuid}", $options) - ); - } - - /** - * Create a new team. - * - * @param string $organizationUuid - * @param string $name - * @return OperationResponse - */ - public function createTeam($organizationUuid, $name) - { - $options = [ - 'form_params' => [ - 'name' => $name, - ], - ]; - - return new OperationResponse( - $this->connector->request('post', "/organizations/${organizationUuid}/teams", $this->query, $options) - ); - } - - /** - * Delete a team. - * - * @param string $teamUuid - * @return OperationResponse - */ - public function deleteTeam($teamUuid) - { - return new OperationResponse( - $this->connector->request('delete', "/teams/${teamUuid}", $this->query) - ); - } - - /** - * Add an application to a team. - * - * @param string $teamUuid - * @param string $applicationUuid - * @return OperationResponse - */ - public function addApplicationToTeam($teamUuid, $applicationUuid) - { - $options = [ - 'form_params' => [ - 'uuid' => $applicationUuid, - ], - ]; - - return new OperationResponse( - $this->connector->request('post', "/teams/${teamUuid}/applications", $this->query, $options) - ); - } - - /** - * Invites a user to join a team. - * - * @param string $teamUuid - * @param string $email - * @param array $roles - * @return OperationResponse - */ - public function createTeamInvite($teamUuid, $email, $roles) - { - $options = [ - 'form_params' => [ - 'email' => $email, - 'roles' => $roles - ], - ]; - - return new OperationResponse( - $this->connector->request('post', "/teams/${teamUuid}/invites", $options) - ); - } - - /** - * Invites a user to become admin of an organization. - * - * @param string $organizationUuid - * @param string $email - * @return OperationResponse - */ - public function createOrganizationAdminInvite($organizationUuid, $email) - { - $options = [ - 'form_params' => [ - 'email' => $email, - ], - ]; - - return new OperationResponse( - $this->connector->request('post', "/teams/${organizationUuid}/invites", $this->query, $options) - ); - } - - /** - * Show all applications associated with a team. - * - * @param string $teamUuid - * @return ApplicationsResponse - */ - public function teamApplications($teamUuid) - { - return new ApplicationsResponse( - $this->connector->request('get', "/teams/${teamUuid}/applications", $this->query) - ); - } - - /** - * Show all members of an organisation. - * - * @param string $organizationUuid - * @return MembersResponse - */ - public function members($organizationUuid) - { - return new MembersResponse( - $this->connector->request('get', "/organizations/${organizationUuid}/members", $this->query) - ); - } - - /** - * Show all members invited to an organisation. - * - * @param string $organizationUuid - * @return InvitationsResponse - */ - public function invitees($organizationUuid) - { - return new InvitationsResponse( - $this->connector->request('get', "/organizations/${organizationUuid}/team-invites", $this->query) - ); - } - - /** - * Delete a member from an organisation. - * - * @param string $organizationUuid - * @param string $memberUuid - * @return OperationResponse - */ - public function deleteMember($organizationUuid, $memberUuid) - { - return new OperationResponse( - $this->connector->request( - 'delete', - "/organizations/${organizationUuid}/members/${memberUuid}", - $this->query - ) - ); - } - - /** - * Show all available permissions. - * - * @return PermissionsResponse - */ - public function permissions() - { - return new PermissionsResponse($this->connector->request('get', '/permissions', $this->query)); - } - - /** - * Returns logstream WSS streams. - * - * @return LogstreamResponse - */ - public function logstream($environmentUuid) - { - return new LogstreamResponse($this->connector->request('get', "/environments/${environmentUuid}/logstream")); - } -} diff --git a/src/CloudApi/ClientInterface.php b/src/CloudApi/ClientInterface.php deleted file mode 100644 index b2a32a2f..00000000 --- a/src/CloudApi/ClientInterface.php +++ /dev/null @@ -1,586 +0,0 @@ -provider = new GenericProvider([ - 'clientId' => $config['key'], - 'clientSecret' => $config['secret'], - 'urlAuthorize' => '', - 'urlAccessToken' => 'https://accounts.acquia.com/api/auth/oauth/token', - 'urlResourceOwnerDetails' => '', - ]); - } - - /** - * Takes parameters passed in, makes a request to the API, and processes the response. - * - * @param string $verb - * @param string $path - * @param array $query - * @param array $options - * - * @return object|array|StreamInterface - */ - public function request(string $verb, string $path, array $query = [], array $options = []) - { - $options['query'] = $query; - - if (!empty($options['query']['filter']) && is_array($options['query']['filter'])) { - // Default to an AND filter. - $options['query']['filter'] = implode(',', $options['query']['filter']); - } - $response = $this->makeRequest($verb, $path, $query, $options); - - return $this->processResponse($response); - } - - /** - * Makes a request to the API. - * - * @param string $verb - * @param string $path - * @param array $query - * @param array $options - * @return ResponseInterface - */ - public function makeRequest(string $verb, string $path, array $query = [], array $options = []) - { - if (! isset($this->accessToken)) { - $this->accessToken = $this->provider->getAccessToken('client_credentials'); - } - - try { - $request = $this->provider->getAuthenticatedRequest( - $verb, - self::BASE_URI . $path, - $this->accessToken - ); - $client = new GuzzleClient(); - $response = $client->send($request, $options); - } catch (ClientException $e) { - print $e->getMessage(); - $response = $e->getResponse(); - } - - return $response; - } - - /** - * Processes the returned response from the API. - * - * @param ResponseInterface $response - * @return object|array|StreamInterface - * @throws \Exception - */ - public function processResponse(ResponseInterface $response) - { - - $body = $response->getBody(); - - $object = json_decode($body); - if (json_last_error() === JSON_ERROR_NONE) { - // JSON is valid - if (property_exists($object, '_embedded') && property_exists($object->_embedded, 'items')) { - $return = $object->_embedded->items; - } elseif (property_exists($object, 'error')) { - if (is_array($object->message)) { - foreach ($object->message as $message) { - $output .= $message; - } - throw new \Exception($output); - } else { - throw new \Exception($object->message); - } - } else { - $return = $object; - } - } else { - $return = $body; - } - - return $return; - } -} diff --git a/src/Connector/Client.php b/src/Connector/Client.php new file mode 100644 index 00000000..d03732f5 --- /dev/null +++ b/src/Connector/Client.php @@ -0,0 +1,146 @@ +connector = $connector; + } + + /** + * Client factory method for instantiating . + * + * @param ConnectorInterface $connector + * + * @return static + */ + public static function factory(ConnectorInterface $connector) + { + $client = new static( + $connector + ); + + return $client; + } + + /** + * Takes parameters passed in, makes a request to the API, and processes the response. + * + * @param string $verb + * @param string $path + * @param array $options + * + * @return object|array + */ + public function request(string $verb, string $path, array $options = []) + { + $options['query'] = $this->query; + + if (!empty($options['query']['filter']) && is_array($options['query']['filter'])) { + // Default to an AND filter. + $options['query']['filter'] = implode(',', $options['query']['filter']); + } + $response = $this->makeRequest($verb, $path, $options); + + return $this->processResponse($response); + } + + /** + * Makes a request to the API. + * + * @param string $verb + * @param string $path + * @param array $options + * + * @return ResponseInterface + */ + public function makeRequest(string $verb, string $path, array $options = []) + { + try { + $response = $this->connector->sendRequest($verb, $path, $options); + } catch (BadResponseException $e) { + $response = $e->getResponse(); + } + + return $response; + } + + /** + * Processes the returned response from the API. + * + * @param ResponseInterface $response + * @return object|array + * @throws ApiErrorException + */ + public function processResponse(ResponseInterface $response) + { + + $body = $response->getBody(); + + $object = json_decode($body); + if (json_last_error() !== JSON_ERROR_NONE) { + return $body; + } + + if (property_exists($object, '_embedded') && property_exists($object->_embedded, 'items')) { + return $object->_embedded->items; + } + + if (property_exists($object, 'error') && property_exists($object, 'message')) { + throw new ApiErrorException($object); + } + + return $object; + } + + /** + * Get query from Client. + * + * @return array + */ + public function getQuery() + { + return $this->query; + } + + /** + * Clear query. + */ + public function clearQuery() + { + $this->query = []; + } + + /** + * Add a query parameter to filter results. + * + * @param string $name + * @param string|int $value + */ + public function addQuery($name, $value) + { + $this->query = array_merge_recursive($this->query, [$name => $value]); + } +} diff --git a/src/CloudApi/ConnectorInterface.php b/src/Connector/ClientInterface.php similarity index 51% rename from src/CloudApi/ConnectorInterface.php rename to src/Connector/ClientInterface.php index 91a94000..838ddd6c 100644 --- a/src/CloudApi/ConnectorInterface.php +++ b/src/Connector/ClientInterface.php @@ -1,44 +1,64 @@ provider = new GenericProvider([ + 'clientId' => $config['key'], + 'clientSecret' => $config['secret'], + 'urlAuthorize' => '', + 'urlAccessToken' => self::URL_ACCESS_TOKEN, + 'urlResourceOwnerDetails' => '', + ]); + } + + /** + * Creates an authenticated Request instance. + * + * @param string $verb + * @param string $path + * + * @return RequestInterface + */ + public function createRequest($verb, $path) + { + if (!isset($this->accessToken)) { + $this->accessToken = $this->provider->getAccessToken('client_credentials'); + } + + return $this->provider->getAuthenticatedRequest( + $verb, + self::BASE_URI . $path, + $this->accessToken + ); + } + + /** + * Sends the request to the API using Guzzle. + * + * @param string $verb + * @param string $path + * @param array $options + * + * @return ResponseInterface + */ + public function sendRequest($verb, $path, $options) + { + $request = $this->createRequest($verb, $path); + $client = new GuzzleClient(); + return $client->send($request, $options); + } +} diff --git a/src/Connector/ConnectorInterface.php b/src/Connector/ConnectorInterface.php new file mode 100644 index 00000000..d58303aa --- /dev/null +++ b/src/Connector/ConnectorInterface.php @@ -0,0 +1,44 @@ +client->request('get', '/account')); + } + + /** + * Provides an archived set of files for Acquia Drush aliases. + * + * @return object + */ + public function getDrushAliases() + { + return $this->client->request('get', '/account/drush-aliases/download'); + } +} diff --git a/src/Endpoints/Applications.php b/src/Endpoints/Applications.php new file mode 100644 index 00000000..b6e2d34d --- /dev/null +++ b/src/Endpoints/Applications.php @@ -0,0 +1,131 @@ +client->request('get', '/applications')); + } + + /** + * Shows information about an application. + * + * @param string $applicationUuid + * @return ApplicationResponse + */ + public function get($applicationUuid) + { + return new ApplicationResponse( + $this->client->request( + 'get', + "/applications/${applicationUuid}" + ) + ); + } + + /** + * Renames an application. + * + * @param string $applicationUuid + * @param string $name + * @return OperationResponse + */ + public function rename($applicationUuid, $name) + { + + $options = [ + 'form_params' => [ + 'name' => $name, + ], + ]; + + return new OperationResponse( + $this->client->request( + 'put', + "/applications/${applicationUuid}", + $options + ) + ); + } + + /** + * Returns a list of application tags associated with this application. + * + * @param string $applicationUuid + * @return TagsResponse + */ + public function getAllTags($applicationUuid) + { + + return new TagsResponse( + $this->client->request( + 'get', + "/applications/${applicationUuid}/tags" + ) + ); + } + + /** + * Creates a new application tag. + * + * @param string $applicationUuid + * @param string $name + * @param string $color + * @return OperationResponse + */ + public function createTag($applicationUuid, $name, $color) + { + + $options = [ + 'form_params' => [ + 'name' => $name, + 'color' => $color, + ], + ]; + + return new OperationResponse( + $this->client->request( + 'post', + "/applications/${applicationUuid}/tags", + $options + ) + ); + } + + /** + * Deletes an application tag. + * + * @param string $applicationUuid + * @param string $tagName + * @return OperationResponse + */ + public function deleteTag($applicationUuid, $tagName) + { + + return new OperationResponse( + $this->client->request( + 'delete', + "/applications/${applicationUuid}/tags/${tagName}" + ) + ); + } +} diff --git a/src/Endpoints/CloudApiBase.php b/src/Endpoints/CloudApiBase.php new file mode 100644 index 00000000..983f732c --- /dev/null +++ b/src/Endpoints/CloudApiBase.php @@ -0,0 +1,26 @@ +client = $client; + } +} diff --git a/src/Endpoints/CloudApiInterface.php b/src/Endpoints/CloudApiInterface.php new file mode 100644 index 00000000..c515b8f5 --- /dev/null +++ b/src/Endpoints/CloudApiInterface.php @@ -0,0 +1,18 @@ +client->request( + 'get', + "/applications/${applicationUuid}/code" + ) + ); + } + + /** + * Deploys a code branch/tag to an environment. + * + * @param string $environmentUuid + * @param string $branch + * @return OperationResponse + */ + public function switch($environmentUuid, $branch) + { + + $options = [ + 'form_params' => [ + 'branch' => $branch, + ], + ]; + + return new OperationResponse( + $this->client->request( + 'post', + "/environments/${environmentUuid}/code/actions/switch", + $options + ) + ); + } + + /** + * Deploys code from one environment to another environment. + * + * @param string $environmentFromUuid + * @param string $environmentToUuid + * @param string $commitMessage + */ + public function deploy($environmentFromUuid, $environmentToUuid, $commitMessage = null) + { + + $options = [ + 'form_params' => [ + 'source' => $environmentFromUuid, + 'message' => $commitMessage, + ], + ]; + + return new OperationResponse( + $this->client->request( + 'post', + "/environments/${environmentToUuid}/code", + $options + ) + ); + } +} diff --git a/src/Endpoints/Crons.php b/src/Endpoints/Crons.php new file mode 100644 index 00000000..421ca2fd --- /dev/null +++ b/src/Endpoints/Crons.php @@ -0,0 +1,152 @@ +client->request( + 'get', + "/environments/${environmentUuid}/crons" + ) + ); + } + + /** + * Get information about a cron task. + * + * @param string $environmentUuid The environment ID + * @param int $cronId + * @return CronResponse + */ + public function get($environmentUuid, $cronId) + { + return new CronResponse( + $this->client->request( + 'get', + "/environments/${environmentUuid}/crons/${cronId}" + ) + ); + } + + /** + * Add a cron task. + * + * @param string $environmentUuid + * @param string $command + * @param string $frequency + * @param string $label + * @param string $serverId + * @return OperationResponse + */ + public function create($environmentUuid, $command, $frequency, $label, $serverId = null) + { + + $options = [ + 'form_params' => [ + 'command' => $command, + 'frequency' => $frequency, + 'label' => $label, + 'server_id' => $serverId + ], + ]; + + return new OperationResponse( + $this->client->request('post', "/environments/${environmentUuid}/crons", $options) + ); + } + + /** + * Update a cron task. + * + * @param string $environmentUuid + * @param string $cronId + * @param string $command + * @param string $frequency + * @param string $label + * @param string $serverId + * @return OperationResponse + */ + public function update($environmentUuid, $cronId, $command, $frequency, $label, $serverId = null) + { + + $options = [ + 'form_params' => [ + 'command' => $command, + 'frequency' => $frequency, + 'label' => $label, + 'server_id' => $serverId + ], + ]; + + return new OperationResponse( + $this->client->request('post', "/environments/${environmentUuid}/crons/${cronId}", $options) + ); + } + + /** + * Delete a cron task. + * + * @param string $environmentUuid + * @param int $cronId + * @return OperationResponse + */ + public function delete($environmentUuid, $cronId) + { + return new OperationResponse( + $this->client->request('delete', "/environments/${environmentUuid}/crons/${cronId}") + ); + } + + /** + * Disable a cron task. + * + * @param string $environmentUuid + * @param int $cronId + * @return OperationResponse + */ + public function disable($environmentUuid, $cronId) + { + return new OperationResponse( + $this->client->request( + 'post', + "/environments/${environmentUuid}/crons/${cronId}/actions/disable" + ) + ); + } + + /** + * Enable a cron task. + * + * @param string $environmentUuid + * @param int $cronId + * @return OperationResponse + */ + public function enable($environmentUuid, $cronId) + { + return new OperationResponse( + $this->client->request( + 'post', + "/environments/${environmentUuid}/crons/${cronId}/actions/enable" + ) + ); + } +} diff --git a/src/Endpoints/DatabaseBackups.php b/src/Endpoints/DatabaseBackups.php new file mode 100644 index 00000000..20101cdc --- /dev/null +++ b/src/Endpoints/DatabaseBackups.php @@ -0,0 +1,86 @@ +client->request( + 'post', + "/environments/${environmentUuid}/databases/${dbName}/backups" + ) + ); + } + + /** + * Shows all database backups in an environment. + * + * @param string $environmentUuid + * @param string $dbName + * @return BackupsResponse + */ + public function getAll($environmentUuid, $dbName) + { + return new BackupsResponse( + $this->client->request( + 'get', + "/environments/${environmentUuid}/databases/${dbName}/backups" + ) + ); + } + + /** + * Gets information about a database backup. + * + * @param string $environmentUuid + * @param string $dbName + * @param int $backupId + * @return BackupResponse + */ + public function get($environmentUuid, $dbName, $backupId) + { + return new BackupResponse( + $this->client->request( + 'get', + "/environments/${environmentUuid}/databases/${dbName}/backups/${backupId}" + ) + ); + } + + /** + * Restores a database backup to a database in an environment. + * + * @param string $environmentUuid + * @param string $dbName + * @param int $backupId + * @return OperationResponse + */ + public function restore($environmentUuid, $dbName, $backupId) + { + return new OperationResponse( + $this->client->request( + 'post', + "/environments/${environmentUuid}/databases/${dbName}/backups/${backupId}/actions/restore" + ) + ); + } +} diff --git a/src/Endpoints/Databases.php b/src/Endpoints/Databases.php new file mode 100644 index 00000000..53ad7446 --- /dev/null +++ b/src/Endpoints/Databases.php @@ -0,0 +1,87 @@ +client->request( + 'get', + "/applications/${applicationUuid}/databases" + ) + ); + } + + /** + * Create a new database. + * + * @param string $applicationUuid + * @param string $name + * @return OperationResponse + */ + public function create($applicationUuid, $name) + { + $options = [ + 'form_params' => [ + 'name' => $name, + ], + ]; + + return new OperationResponse( + $this->client->request('post', "/applications/${applicationUuid}/databases", $options) + ); + } + + /** + * Delete a database. + * + * @param string $applicationUuid + * @param string $name + * @return OperationResponse + */ + public function delete($applicationUuid, $name) + { + return new OperationResponse( + $this->client->request('delete', "/applications/${applicationUuid}/databases/${name}") + ); + } + + /** + * Copies a database from an environment to an environment. + * + * @param string $environmentFromUuid + * @param string $dbName + * @param string $environmentToUuid + * @return OperationResponse + */ + public function copy($environmentFromUuid, $dbName, $environmentToUuid) + { + $options = [ + 'form_params' => [ + 'name' => $dbName, + 'source' => $environmentFromUuid, + ], + ]; + + return new OperationResponse( + $this->client->request('post', "/environments/${environmentToUuid}/databases", $options) + ); + } +} diff --git a/src/Endpoints/Domains.php b/src/Endpoints/Domains.php new file mode 100644 index 00000000..76d38ad4 --- /dev/null +++ b/src/Endpoints/Domains.php @@ -0,0 +1,144 @@ +client->request( + 'get', + "/environments/${environmentUuid}/domains" + ) + ); + } + + /** + * Return details about a domain. + * + * @param string $environmentUuid + * @param string $domain + * @return DomainResponse + */ + public function get($environmentUuid, $domain) + { + return new DomainResponse( + $this->client->request( + 'get', + "/environments/${environmentUuid}/domains/${domain}" + ) + ); + } + + /** + * Adds a domain to an environment. + * + * @param string $environmentUuid + * @param string $hostname + * @return OperationResponse + */ + public function create($environmentUuid, $hostname) + { + + $options = [ + 'form_params' => [ + 'hostname' => $hostname, + ], + ]; + + return new OperationResponse( + $this->client->request('post', "/environments/${environmentUuid}/domains", $options) + ); + } + + /** + * Deletes a domain from an environment. + * + * @param string $environmentUuid + * @param string $domain + * @return OperationResponse + */ + public function delete($environmentUuid, $domain) + { + return new OperationResponse( + $this->client->request('delete', "/environments/${environmentUuid}/domains/${domain}") + ); + } + + /** + * Purges varnish for selected domains in an environment. + * + * @param string $environmentUuid + * @param array $domains + * @return OperationResponse + */ + public function purge($environmentUuid, array $domains) + { + + $options = [ + 'form_params' => [ + 'domains' => $domains, + ], + ]; + + return new OperationResponse( + $this->client->request( + 'post', + "/environments/${environmentUuid}/domains/actions/clear-varnish", + $options + ) + ); + } + + /** + * Retrieves the scan data for a domain name that is part of this environment. + * + * @param string $environmentUuid + * @param string $domain + * @return MetricsResponse + */ + public function metrics($environmentUuid, $domain) + { + return new MetricsResponse( + $this->client->request( + 'get', + "/environments/${environmentUuid}/domains/${domain}/metrics/uptime" + ) + ); + } + + /** + * Returns details about the domain. + * + * @param string $environmentUuid + * @param string $domain + * @return DomainResponse + */ + public function status($environmentUuid, $domain) + { + return new DomainResponse( + $this->client->request( + 'get', + "/environments/${environmentUuid}/domains/${domain}/status" + ) + ); + } +} diff --git a/src/Endpoints/Environments.php b/src/Endpoints/Environments.php new file mode 100644 index 00000000..b8789f0c --- /dev/null +++ b/src/Endpoints/Environments.php @@ -0,0 +1,229 @@ + [ + 'source' => $environmentUuidFrom, + ], + ]; + + return new OperationResponse( + $this->client->request('post', "/environments/${environmentUuidTo}/files", $options) + ); + } + + /** + * Gets information about an environment. + * + * @param string $environmentUuid + * @return EnvironmentResponse + */ + public function get($environmentUuid) + { + return new EnvironmentResponse( + $this->client->request( + 'get', + "/environments/${environmentUuid}" + ) + ); + } + + /** + * Shows all environments in an application. + * + * @param string $applicationUuid + * @return EnvironmentsResponse + */ + public function getAll($applicationUuid) + { + return new EnvironmentsResponse( + $this->client->request( + 'get', + "/applications/${applicationUuid}/environments" + ) + ); + } + + /** + * Modifies configuration settings for an environment. + * + * @param string $environmentUuid + * @param array $config + * @return OperationResponse + */ + public function update($environmentUuid, array $config) + { + + $options = [ + 'form_params' => $config, + ]; + + return new OperationResponse( + $this->client->request( + 'put', + "/environments/${environmentUuid}", + $options + ) + ); + } + + /** + * Renames an environment. + * + * @param string $environmentUuid + * @param string $label + * @return OperationResponse + */ + public function rename($environmentUuid, $label) + { + + $options = [ + 'form_params' => [ + 'label' => $label, + ], + ]; + + return new OperationResponse( + $this->client->request( + 'post', + "/environments/${environmentUuid}/actions/change-label", + $options + ) + ); + } + + /** + * Enable livedev mode for an environment. + * + * @param string $environmentUuid + * @return OperationResponse + */ + public function enableLiveDev($environmentUuid) + { + return new OperationResponse( + $this->client->request('post', "/environments/${environmentUuid}/livedev/actions/enable") + ); + } + + /** + * Disable livedev mode for an environment. + * + * @param string $environmentUuid + * @return OperationResponse + */ + public function disableLiveDev($environmentUuid) + { + + $options = [ + 'form_params' => [ + 'discard' => 1, + ], + ]; + + return new OperationResponse( + $this->client->request( + 'post', + "/environments/${environmentUuid}/livedev/actions/disable", + $options + ) + ); + } + + /** + * Enable production mode for an environment. + * + * @param string $environmentUuid + * @return OperationResponse + */ + public function enableProductionMode($environmentUuid) + { + return new OperationResponse( + $this->client->request( + 'post', + "/environments/${environmentUuid}/production-mode/actions/enable" + ) + ); + } + + /** + * Disable production mode for an environment. + * + * @param string $environmentUuid + * @return OperationResponse + */ + public function disableProductionMode($environmentUuid) + { + return new OperationResponse( + $this->client->request( + 'post', + "/environments/${environmentUuid}/production-mode/actions/disable" + ) + ); + } + + /** + * Add a new continuous delivery environment to an application. + * + * @param string $applicationUuid + * @param string $label + * @param string $branch + * @param array $databases + * @return OperationResponse + */ + public function create($applicationUuid, $label, $branch, array $databases) + { + $options = [ + 'form_params' => [ + 'label' => $label, + 'branch' => $branch, + 'databases' => $databases, + ], + ]; + + return new OperationResponse( + $this->client->request( + 'post', + "/applications/${applicationUuid}/environments", + $options + ) + ); + } + + /** + * Deletes a CD environment. + * + * @param string $environmentUuid + * @return OperationResponse + */ + public function delete($environmentUuid) + { + return new OperationResponse( + $this->client->request( + 'delete', + "/environments/${environmentUuid}" + ) + ); + } +} diff --git a/src/Endpoints/IdentityProviders.php b/src/Endpoints/IdentityProviders.php new file mode 100644 index 00000000..130f7d8d --- /dev/null +++ b/src/Endpoints/IdentityProviders.php @@ -0,0 +1,126 @@ +client->request( + 'get', + "/identity-providers" + ) + ); + } + + /** + * Returns a specific identity provider by UUID. + * + * @param string $idpUuid The identity provider ID + * @return IdentityProviderResponse + */ + public function get($idpUuid) + { + return new IdentityProviderResponse( + $this->client->request( + 'get', + "/identity-providers/${idpUuid}" + ) + ); + } + + /** + * Delete a specific identity provider by UUID. + * + * @param string $idpUuid + * @return OperationResponse + */ + public function delete($idpUuid) + { + return new OperationResponse( + $this->client->request( + 'delete', + "/identity-providers/${idpUuid}" + ) + ); + } + + /** + * Disables an identity provider by UUID. + * + * @param string $idpUuid + * @return OperationResponse + */ + public function disable($idpUuid) + { + return new OperationResponse( + $this->client->request( + 'post', + "/identity-providers/${idpUuid}/actions/disable" + ) + ); + } + + /** + * Enables an identity provider by UUID. + * + * @param string $idpUuid + * @return OperationResponse + */ + public function enable($idpUuid) + { + return new OperationResponse( + $this->client->request( + 'post', + "/identity-providers/${idpUuid}/actions/enable" + ) + ); + } + + /** + * Updates a identity provider by UUID. + * + * @param string $idpUuid + * @param string $label + * @param string $entityId + * @param string $ssoUrl + * @param string $certificate + * @return OperationResponse + */ + public function update($idpUuid, $label, $entityId, $ssoUrl, $certificate) + { + + $options = [ + 'form_params' => [ + 'label' => $label, + 'entity_id' => $entityId, + 'sso_url' => $ssoUrl, + 'certificate' => $certificate, + ], + ]; + + return new OperationResponse( + $this->client->request( + 'put', + "/identity-providers/${idpUuid}", + $options + ) + ); + } +} diff --git a/src/Endpoints/Ides.php b/src/Endpoints/Ides.php new file mode 100644 index 00000000..9914e6f1 --- /dev/null +++ b/src/Endpoints/Ides.php @@ -0,0 +1,82 @@ +client->request( + 'get', + "/applications/${applicationUuid}/ides" + ) + ); + } + + /** + * Get remote IDE info. + * + * @param string $ideUuid The Remote IDE universally unique identifier. + * @return IdeResponse + */ + public function get($ideUuid) + { + return new IdeResponse( + $this->client->request( + 'get', + "/ides/${ideUuid}" + ) + ); + } + + /** + * Creates a new remote IDE. + * + * @param string $applicationUuid + * @param string $name + * @return OperationResponse + */ + public function create($applicationUuid, $name) + { + + $options = [ + 'form_params' => [ + 'name' => $name, + ], + ]; + + return new OperationResponse( + $this->client->request('post', "/applications/${applicationUuid}/ides", $options) + ); + } + + /** + * De-provisions a specific Remote IDE. + * + * @param string $ideUuid + * @return OperationResponse + */ + public function delete($ideUuid) + { + return new OperationResponse( + $this->client->request('delete', "/ides/{ideUuid}") + ); + } +} diff --git a/src/Endpoints/Insights.php b/src/Endpoints/Insights.php new file mode 100644 index 00000000..d75a1227 --- /dev/null +++ b/src/Endpoints/Insights.php @@ -0,0 +1,167 @@ +client->request( + 'get', + "/applications/${applicationUuid}/insight" + ) + ); + } + + /** + * Returns insight data for a particular site. + * + * @param string $siteId + * @return InsightResponse + */ + public function get($siteId) + { + return new InsightResponse( + $this->client->request( + 'get', + "/insight/${siteId}" + ) + ); + } + + /** + * Returns a list of Insight alerts for this site. + * + * @param string $siteId + * @return InsightAlertsResponse + */ + public function getAllAlerts($siteId) + { + return new InsightAlertsResponse( + $this->client->request( + 'get', + "/insight/${siteId}/alerts" + ) + ); + } + + /** + * Returns a specific Insight alert for this site. + * + * @param string $siteId + * @param string $alertUuid + * @return InsightAlertResponse + */ + public function getAlert($siteId, $alertUuid) + { + return new InsightAlertResponse( + $this->client->request( + 'get', + "/insight/${siteId}/alerts/${alertUuid}" + ) + ); + } + + /** + * Ignores an alert. An ignored alert will be included will not be counted in the Insight score calculation. + * + * @param string $siteId + * @param string $alertUuid + * @return OperationResponse + */ + public function ignoreAlert($siteId, $alertUuid) + { + return new OperationResponse( + $this->client->request( + 'post', + "/insight/${siteId}/alerts/${alertUuid}/actions/ignore" + ) + ); + } + + /** + * Restores an alert. A restored alert will be included in the calculation of the Insight score. + * + * @param string $siteId + * @param string $alertUuid + * @return OperationResponse + */ + public function restoreAlert($siteId, $alertUuid) + { + return new OperationResponse( + $this->client->request( + 'post', + "/insight/${siteId}/alerts/${alertUuid}/actions/restore" + ) + ); + } + + /** + * Revokes an Insight install so it can no longer submit data using the Acquia Connector module. + * + * @param string $siteId + * @return OperationResponse + */ + public function revoke($siteId) + { + return new OperationResponse( + $this->client->request( + 'post', + "/insight/${siteId}/actions/revoke" + ) + ); + } + + /** + * Un-revokes an Insight site so it can once again submit data using the Acquia Connector module. + * Note that the site must also be unblocked using the Acquia Connector module. + * + * @param string $siteId + * @return OperationResponse + */ + public function unrevoke($siteId) + { + return new OperationResponse( + $this->client->request( + 'post', + "/insight/${siteId}/actions/unrevoke" + ) + ); + } + + /** + * Returns a list of Drupal modules for this site. + * + * @param string $siteId + * @return InsightModulesResponse + */ + public function getModules($siteId) + { + return new InsightModulesResponse( + $this->client->request( + 'get', + "/insight/${siteId}/modules" + ) + ); + } +} diff --git a/src/Endpoints/LogForwardingDestinations.php b/src/Endpoints/LogForwardingDestinations.php new file mode 100644 index 00000000..d86c428e --- /dev/null +++ b/src/Endpoints/LogForwardingDestinations.php @@ -0,0 +1,160 @@ +client->request( + 'get', + "/environments/${environmentUuid}/log-forwarding-destinations" + ) + ); + } + + /** + * Returns a specific log forwarding destination. + * + * @param string $environmentUuid The environment ID + * @param int $destinationId + * @return LogForwardingDestinationResponse + */ + public function get($environmentUuid, $destinationId) + { + return new LogForwardingDestinationResponse( + $this->client->request( + 'get', + "/environments/${environmentUuid}/log-forwarding-destinations/${destinationId}" + ) + ); + } + + /** + * Creates a log forwarding destination. + * + * @param string $environmentUuid + * @param string $label + * @param array $sources + * @param string $consumer + * @param array $credentials + * @param string $address + * @return OperationResponse + */ + public function create($environmentUuid, $label, $sources, $consumer, $credentials, $address) + { + + $options = [ + 'form_params' => [ + 'label' => $label, + 'sources' => $sources, + 'consumer' => $consumer, + 'credentials' => $credentials, + 'address' => $address + ], + ]; + + return new OperationResponse( + $this->client->request('post', "/environments/${environmentUuid}/log-forwarding-destinations", $options) + ); + } + + /** + * Delete a specific log forwarding destination. + * + * @param string $environmentUuid + * @param int $destId + * @return OperationResponse + */ + public function delete($environmentUuid, $destId) + { + return new OperationResponse( + $this->client->request('delete', "/environments/${environmentUuid}/log-forwarding-destinations/${destId}") + ); + } + + /** + * Disables a log forwarding destination. + * + * @param string $environmentUuid + * @param int $destId + * @return OperationResponse + */ + public function disable($environmentUuid, $destId) + { + return new OperationResponse( + $this->client->request( + 'post', + "/environments/${environmentUuid}/log-forwarding-destinations/${destId}/actions/disable" + ) + ); + } + + /** + * Enables a log forwarding destination. + * + * @param string $environmentUuid + * @param int $destId + * @return OperationResponse + */ + public function enable($environmentUuid, $destId) + { + return new OperationResponse( + $this->client->request( + 'post', + "/environments/${environmentUuid}/log-forwarding-destinations/${destId}/actions/enable" + ) + ); + } + + /** + * Updates a log forwarding destination. + * + * @param string $environmentUuid + * @param int $destId + * @param string $label + * @param array $sources + * @param string $consumer + * @param array $creds + * @param string $address + * @return OperationResponse + */ + public function update($environmentUuid, $destId, $label, $sources, $consumer, $creds, $address) + { + + $options = [ + 'form_params' => [ + 'label' => $label, + 'sources' => $sources, + 'consumer' => $consumer, + 'credentials' => $creds, + 'address' => $address + ], + ]; + + return new OperationResponse( + $this->client->request( + 'put', + "/environments/${environmentUuid}/log-forwarding-destinations/${destId}", + $options + ) + ); + } +} diff --git a/src/Endpoints/Logs.php b/src/Endpoints/Logs.php new file mode 100644 index 00000000..1f92cc47 --- /dev/null +++ b/src/Endpoints/Logs.php @@ -0,0 +1,70 @@ +client->request('get', "/environments/${environmentUuid}/logs") + ); + } + + /** + * Downloads a log file. + * + * @param string $environmentUuid + * @param string $logType + * @return object + */ + public function download($environmentUuid, $logType) + { + return $this->client->request('get', "/environments/${environmentUuid}/logs/${logType}"); + } + + /** + * Creates a log file snapshot. + * + * @param string $environmentUuid + * @param string $logType + * @return OperationResponse + */ + public function snapshot($environmentUuid, $logType) + { + return new OperationResponse( + $this->client->request('post', "/environments/${environmentUuid}/logs/${logType}") + ); + } + + /** + * Returns logstream WSS stream information. + * + * @param string $environmentUuid + * @return LogstreamResponse + */ + public function stream($environmentUuid) + { + return new LogstreamResponse( + $this->client->request('get', "/environments/${environmentUuid}/logstream") + ); + } +} diff --git a/src/Endpoints/Metrics.php b/src/Endpoints/Metrics.php new file mode 100644 index 00000000..303b5fb6 --- /dev/null +++ b/src/Endpoints/Metrics.php @@ -0,0 +1,117 @@ +client->request( + 'get', + "/applications/${applicationUuid}/metrics/usage/data" + )); + } + + /** + * Retrieves aggregate usage metric data for an application. + * + * @return MetricResponse + * @param string $applicationUuid + * @param string $usageMetric + */ + public function getAggregateUsageMetrics($applicationUuid, $usageMetric) + { + return new MetricResponse($this->client->request( + 'get', + "/applications/${applicationUuid}/metrics/usage/${usageMetric}" + )); + } + + /** + * Retrieves usage data for an application, broken down by environment. + * + * @return MetricsResponse + * @param string $applicationUuid + */ + public function getDataByEnvironment($applicationUuid) + { + return new MetricsResponse($this->client->request( + 'get', + "/applications/${applicationUuid}/metrics/usage/data-by-environment" + )); + } + + /** + * Retrieves views data for an application, broken down by environment. + * + * @return MetricsResponse + * @param string $applicationUuid + */ + public function getViewsByEnvironment($applicationUuid) + { + return new MetricsResponse($this->client->request( + 'get', + "/applications/${applicationUuid}/metrics/usage/views-by-environment" + )); + } + + /** + * Retrieves visits data for an application, broken down by environment. + * + * @return MetricsResponse + * @param string $applicationUuid + */ + public function getVisitsByEnvironment($applicationUuid) + { + return new MetricsResponse($this->client->request( + 'get', + "/applications/${applicationUuid}/metrics/usage/visits-by-environment" + )); + } + + /** + * Returns StackMetrics data for the metrics specified in the filter paramater + * (e.g., apache-access, web-cpu). + * + * @return MetricsResponse + * @param string $environmentUuid + */ + public function getStackMetricsData($environmentUuid) + { + return new MetricsResponse($this->client->request( + 'get', + "/environments/${environmentUuid}/metrics/stackmetrics/data" + )); + } + + /** + * Returns StackMetrics data for the metric (e.g., apache-access). + * + * @return MetricResponse + * @param string $environmentUuid + * @param string $metricType + * + */ + public function getStackMetricsDataByMetric($environmentUuid, $metricType) + { + return new MetricResponse($this->client->request( + 'get', + "/environments/${environmentUuid}/metrics/stackmetrics/${metricType}" + )); + } +} diff --git a/src/Endpoints/Notifications.php b/src/Endpoints/Notifications.php new file mode 100644 index 00000000..96e3f99c --- /dev/null +++ b/src/Endpoints/Notifications.php @@ -0,0 +1,47 @@ +client->request( + 'get', + "/notifications/${notificationUuid}" + ) + ); + } + + /** + * Returns a list of notifications. + * + * @param string $applicationUuid + * @return NotificationsResponse + */ + public function getAll($applicationUuid) + { + return new NotificationsResponse( + $this->client->request( + 'get', + "/applications/${applicationUuid}/notifications" + ) + ); + } +} diff --git a/src/Endpoints/Organizations.php b/src/Endpoints/Organizations.php new file mode 100644 index 00000000..dd30a193 --- /dev/null +++ b/src/Endpoints/Organizations.php @@ -0,0 +1,119 @@ +client->request('get', '/organizations')); + } + + /** + * Show all applications in an organisation. + * + * @param string $organizationUuid + * + * @return ApplicationsResponse + */ + public function getApplications($organizationUuid) + { + return new ApplicationsResponse( + $this->client->request('get', "/organizations/${organizationUuid}/applications") + ); + } + + /** + * Show all members of an organisation. + * + * @param string $organizationUuid + * @return MembersResponse + */ + public function getMembers($organizationUuid) + { + return new MembersResponse( + $this->client->request('get', "/organizations/${organizationUuid}/members") + ); + } + + /** + * Show all members invited to an organisation. + * + * @param string $organizationUuid + * @return InvitationsResponse + */ + public function getMemberInvitations($organizationUuid) + { + return new InvitationsResponse( + $this->client->request('get', "/organizations/${organizationUuid}/team-invites") + ); + } + + /** + * Delete a member from an organisation. + * + * @param string $organizationUuid + * @param string $memberUuid + * @return OperationResponse + */ + public function deleteMember($organizationUuid, $memberUuid) + { + return new OperationResponse( + $this->client->request( + 'delete', + "/organizations/${organizationUuid}/members/${memberUuid}" + ) + ); + } + + /** + * Show all teams in an organization. + * + * @param string $organizationUuid + * @return TeamsResponse + */ + public function getTeams($organizationUuid) + { + return new TeamsResponse( + $this->client->request('get', "/organizations/${organizationUuid}/teams") + ); + } + + /** + * Invites a user to become admin of an organization. + * + * @param string $organizationUuid + * @param string $email + * @return OperationResponse + */ + public function inviteAdmin($organizationUuid, $email) + { + $options = [ + 'form_params' => [ + 'email' => $email, + ], + ]; + + return new OperationResponse( + $this->client->request('post', "/teams/${organizationUuid}/invites", $options) + ); + } +} diff --git a/src/Endpoints/Permissions.php b/src/Endpoints/Permissions.php new file mode 100644 index 00000000..a9cf53c3 --- /dev/null +++ b/src/Endpoints/Permissions.php @@ -0,0 +1,24 @@ +client->request('get', '/permissions')); + } +} diff --git a/src/Endpoints/Roles.php b/src/Endpoints/Roles.php new file mode 100644 index 00000000..de7cd3b0 --- /dev/null +++ b/src/Endpoints/Roles.php @@ -0,0 +1,97 @@ +client->request('get', "/organizations/${organizationUuid}/roles") + ); + } + + /** + * Return details about a specific role. + * + * @param string $roleUuid + * @return RoleResponse + */ + public function get($roleUuid) + { + return new RoleResponse( + $this->client->request('get', "/roles/${roleUuid}") + ); + } + + /** + * Create a new role. + * + * @param string $organizationUuid + * @param string $name + * @param array $permissions + * @param null|string $description + * @return OperationResponse + */ + public function create($organizationUuid, $name, array $permissions, $description = null) + { + $options = [ + 'form_params' => [ + 'name' => $name, + 'permissions' => $permissions, + 'description' => $description, + ], + ]; + + return new OperationResponse( + $this->client->request('post', "/organizations/${organizationUuid}/roles", $options) + ); + } + + /** + * Update the permissions associated with a role. + * + * @param string $roleUuid + * @param array $permissions + * @return OperationResponse + */ + public function update($roleUuid, array $permissions) + { + $options = [ + 'form_params' => [ + 'permissions' => $permissions, + ], + ]; + + return new OperationResponse( + $this->client->request('put', "/roles/${roleUuid}", $options) + ); + } + + /** + * Delete a role. + * + * @param string $roleUuid + * @return OperationResponse + */ + public function delete($roleUuid) + { + return new OperationResponse($this->client->request('delete', "/roles/${roleUuid}")); + } +} diff --git a/src/Endpoints/Servers.php b/src/Endpoints/Servers.php new file mode 100644 index 00000000..42a61f47 --- /dev/null +++ b/src/Endpoints/Servers.php @@ -0,0 +1,69 @@ +client->request( + 'get', + "/environments/${environmentUuid}/servers/${serverId}" + ) + ); + } + + /** + * Modifies configuration settings for a server. + * + * @param string $environmentUuid + * @param string $serverId + * @param array $config + * @return OperationResponse + */ + public function update($environmentUuid, $serverId, array $config) + { + + return new OperationResponse( + $this->client->request( + 'put', + "/environments/${environmentUuid}/servers/${serverId}", + $config + ) + ); + } + + /** + * Show all servers associated with an environment. + * + * @param string $environmentUuid + * @return ServersResponse + */ + public function getAll($environmentUuid) + { + return new ServersResponse( + $this->client->request( + 'get', + "/environments/${environmentUuid}/servers" + ) + ); + } +} diff --git a/src/Endpoints/SslCertificates.php b/src/Endpoints/SslCertificates.php new file mode 100644 index 00000000..1e585b39 --- /dev/null +++ b/src/Endpoints/SslCertificates.php @@ -0,0 +1,128 @@ +client->request( + 'get', + "/environments/${environmentUuid}/ssl/certificates" + ) + ); + } + + /** + * Returns a specific certificate by certificate ID. + * + * @param string $environmentUuid The environment ID + * @param int $certificateId + * @return SslCertificateResponse + */ + public function get($environmentUuid, $certificateId) + { + return new SslCertificateResponse( + $this->client->request( + 'get', + "/environments/${environmentUuid}/ssl/certificates/${certificateId}" + ) + ); + } + + /** + * Install an SSL certificate. + * + * @param string $envUuid + * @param string $label + * @param string $cert + * @param string $key + * @param string $ca + * @param int $csr + * @param bool $legacy + * @return OperationResponse + */ + public function create($envUuid, $label, $cert, $key, $ca = null, $csr = null, $legacy = false) + { + + $options = [ + 'form_params' => [ + 'label' => $label, + 'certificate' => $cert, + 'private_key' => $key, + 'ca_certificates' => $ca, + 'csr_id' => $csr, + 'legacy' => $legacy + ], + ]; + + return new OperationResponse( + $this->client->request('post', "/environments/${envUuid}/ssl/certificates", $options) + ); + } + + /** + * Delete a specific certificate by ID. + * + * @param string $environmentUuid + * @param int $certificateId + * @return OperationResponse + */ + public function delete($environmentUuid, $certificateId) + { + return new OperationResponse( + $this->client->request('delete', "/environments/${environmentUuid}/ssl/certificates/${certificateId}") + ); + } + + /** + * Deactivates an active SSL certificate. + * + * @param string $environmentUuid + * @param int $certificateId + * @return OperationResponse + */ + public function disable($environmentUuid, $certificateId) + { + return new OperationResponse( + $this->client->request( + 'post', + "/environments/${environmentUuid}/ssl/certificate/${certificateId}/actions/deactivate" + ) + ); + } + + /** + * Activates an SSL certificate. + * + * @param string $environmentUuid + * @param int $certificateId + * @return OperationResponse + */ + public function enable($environmentUuid, $certificateId) + { + return new OperationResponse( + $this->client->request( + 'post', + "/environments/${environmentUuid}/ssl/certificate/${certificateId}/actions/activate" + ) + ); + } +} diff --git a/src/Endpoints/Teams.php b/src/Endpoints/Teams.php new file mode 100644 index 00000000..62f80b7c --- /dev/null +++ b/src/Endpoints/Teams.php @@ -0,0 +1,138 @@ + [ + 'name' => $name, + ], + ]; + + return new OperationResponse( + $this->client->request('post', "/organizations/${organizationUuid}/teams", $options) + ); + } + + /** + * Show all teams. + * + * @return TeamsResponse + */ + public function getAll() + { + return new TeamsResponse( + $this->client->request('get', '/teams') + ); + } + + /** + * Rename an existing team. + * + * @param string $teamUuid + * @param string $name + * @return OperationResponse + */ + public function rename($teamUuid, $name) + { + $options = [ + 'form_params' => [ + 'name' => $name, + ], + ]; + + return new OperationResponse( + $this->client->request('put', "/teams/${teamUuid}", $options) + ); + } + + + /** + * Delete a team. + * + * @param string $teamUuid + * @return OperationResponse + */ + public function delete($teamUuid) + { + return new OperationResponse( + $this->client->request('delete', "/teams/${teamUuid}") + ); + } + + /** + * Add an application to a team. + * + * @param string $teamUuid + * @param string $applicationUuid + * @return OperationResponse + */ + public function addApplication($teamUuid, $applicationUuid) + { + $options = [ + 'form_params' => [ + 'uuid' => $applicationUuid, + ], + ]; + + return new OperationResponse( + $this->client->request('post', "/teams/${teamUuid}/applications", $options) + ); + } + + /** + * Invites a user to join a team. + * + * @param string $teamUuid + * @param string $email + * @param array $roles + * @return OperationResponse + */ + public function invite($teamUuid, $email, $roles) + { + $options = [ + 'form_params' => [ + 'email' => $email, + 'roles' => $roles + ], + ]; + + return new OperationResponse( + $this->client->request('post', "/teams/${teamUuid}/invites", $options) + ); + } + + /** + * Show all applications associated with a team. + * + * @param string $teamUuid + * @return ApplicationsResponse + */ + public function getApplications($teamUuid) + { + return new ApplicationsResponse( + $this->client->request('get', "/teams/${teamUuid}/applications") + ); + } +} diff --git a/src/Exception/ApiErrorException.php b/src/Exception/ApiErrorException.php new file mode 100644 index 00000000..c3772907 --- /dev/null +++ b/src/Exception/ApiErrorException.php @@ -0,0 +1,53 @@ +setError($object); + } + + /** + * __toString() magic method. + */ + public function __toString() + { + return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; + } + + /** + * Sets the error. + * + * @param object $object + */ + public function setError($object) + { + if (is_array($object->message) || is_object($object->message)) { + $output = ''; + foreach ($object->message as $message) { + $output .= $message . PHP_EOL; + } + $this->message = $output; + } else { + $this->code = $object->error; + $this->message = $object->message; + } + } +} diff --git a/src/Response/DomainResponse.php b/src/Response/DomainResponse.php index 52c66c18..4a8d8c91 100644 --- a/src/Response/DomainResponse.php +++ b/src/Response/DomainResponse.php @@ -11,7 +11,10 @@ class DomainResponse public $hostname; public $flags; + public $ip_addresses; + public $cnames; public $environment; + public $links; /** * DomainResponse constructor. @@ -22,5 +25,12 @@ public function __construct($domain) $this->hostname = $domain->hostname; $this->flags = $domain->flags; $this->environment = $domain->environment; + if (property_exists($domain, 'ip_addresses')) { + $this->ip_addresses = $domain->ip_addresses; + } + if (property_exists($domain, 'cnames')) { + $this->cnames = $domain->cnames; + } + $this->links = $domain->_links; } } diff --git a/src/Response/IdeResponse.php b/src/Response/IdeResponse.php new file mode 100644 index 00000000..cfc3ee92 --- /dev/null +++ b/src/Response/IdeResponse.php @@ -0,0 +1,25 @@ +uuid = $ide->uuid; + $this->label = $ide->label; + $this->links = $ide->_links; + } +} diff --git a/src/Response/IdentityProviderResponse.php b/src/Response/IdentityProviderResponse.php new file mode 100644 index 00000000..df21b659 --- /dev/null +++ b/src/Response/IdentityProviderResponse.php @@ -0,0 +1,36 @@ +uuid = $idp->uuid; + $this->label = $idp->label; + $this->idp_entity_id = $idp->idp_entity_id; + $this->sp_entity_id = $idp->sp_entity_id; + $this->sso_url = $idp->sso_url; + $this->certificate = $idp->certificate; + $this->status = $idp->status; + $this->links = $idp->_links; + } +} diff --git a/src/Response/IdentityProvidersResponse.php b/src/Response/IdentityProvidersResponse.php new file mode 100644 index 00000000..9f7873d7 --- /dev/null +++ b/src/Response/IdentityProvidersResponse.php @@ -0,0 +1,22 @@ +alert_id = $alert->alert_id; + $this->uuid = $alert->uuid; + $this->name = $alert->name; + $this->message = $alert->message; + $this->article_link = $alert->article_link; + $this->severity = $alert->severity; + $this->severity_label = $alert->severity_label; + $this->failed_value = $alert->failed_value; + $this->fix_details = $alert->fix_details; + $this->categories = $alert->categories; + $this->flags = $alert->flags; + $this->links = $alert->_links; + } +} diff --git a/src/Response/InsightAlertsResponse.php b/src/Response/InsightAlertsResponse.php new file mode 100644 index 00000000..f8d73104 --- /dev/null +++ b/src/Response/InsightAlertsResponse.php @@ -0,0 +1,22 @@ +module_id = $module->module_id; + $this->name = $module->name; + $this->filename = $module->filename; + $this->version = $module->version; + $this->supported_majors = $module->supported_majors; + $this->recommended_major = $module->recommended_major; + $this->package = $module->package; + $this->core = $module->core; + $this->project = $module->project; + $this->release_date = $module->release_date; + $this->flags = $module->tags; + } +} diff --git a/src/Response/InsightModulesResponse.php b/src/Response/InsightModulesResponse.php new file mode 100644 index 00000000..48906c73 --- /dev/null +++ b/src/Response/InsightModulesResponse.php @@ -0,0 +1,22 @@ +uuid = $destination->uuid; + $this->label = $destination->label; + $this->address = $destination->address; + $this->consumer = $destination->consumer; + $this->credentials = $destination->credentials; + $this->sources = $destination->sources; + $this->status = $destination->status; + $this->flags = $destination->flags; + $this->health = $destination->health; + $this->environment = $destination->environment; + } +} diff --git a/src/Response/LogForwardingDestinationsResponse.php b/src/Response/LogForwardingDestinationsResponse.php new file mode 100644 index 00000000..ecbe04cb --- /dev/null +++ b/src/Response/LogForwardingDestinationsResponse.php @@ -0,0 +1,22 @@ +type = $log->type; + $this->label = $log->label; + $this->flags = $log->flags; + $this->links = $log->_links; + } +} diff --git a/src/Response/LogsResponse.php b/src/Response/LogsResponse.php new file mode 100644 index 00000000..673998d3 --- /dev/null +++ b/src/Response/LogsResponse.php @@ -0,0 +1,22 @@ +metric = $metric->metric; + $this->datapoints = $metric->datapoints; + if (property_exists($metric, 'last_data_at')) { + $this->last_data_at = $metric->last_data_at; + } + $this->metadata = $metric->metadata; + if (property_exists($metric, '_links')) { + $this->links = $metric->_links; + } + } +} diff --git a/src/Response/MetricsResponse.php b/src/Response/MetricsResponse.php new file mode 100644 index 00000000..7af236d0 --- /dev/null +++ b/src/Response/MetricsResponse.php @@ -0,0 +1,22 @@ +id = $certificate->id; + $this->label = $certificate->label; + $this->certificate = $certificate->certificate; + $this->private_key = $certificate->private_key; + $this->ca = $certificate->ca; + $this->flags = $certificate->flags; + $this->expires_at = $certificate->expires_at; + $this->domains = $certificate->domains; + $this->environment = $certificate->environment; + $this->links = $certificate->_links; + } +} diff --git a/src/Response/SslCertificatesResponse.php b/src/Response/SslCertificatesResponse.php new file mode 100644 index 00000000..c8716741 --- /dev/null +++ b/src/Response/SslCertificatesResponse.php @@ -0,0 +1,22 @@ +name = $tag->name; + $this->color = $tag->color; + $this->context = $tag->context; + $this->links = $tag->_links; + } +} diff --git a/src/Response/TagsResponse.php b/src/Response/TagsResponse.php new file mode 100644 index 00000000..7c2a8cca --- /dev/null +++ b/src/Response/TagsResponse.php @@ -0,0 +1,22 @@ +uuid = $task->uuid; - $this->user = $task->user; - $this->name = $task->name; - $this->description = $task->description; - $this->title = $task->title; - $this->createdAt = $task->created_at; - $this->startedAt = $task->started_at; - $this->completedAt = $task->completed_at; - $this->status = $task->status; - $this->type = $task->type; - $this->metadata = $task->metadata; - } -} diff --git a/src/Response/TasksResponse.php b/src/Response/TasksResponse.php deleted file mode 100644 index 2cac192c..00000000 --- a/src/Response/TasksResponse.php +++ /dev/null @@ -1,22 +0,0 @@ -assertNotEmpty($operationResponse->links); - $this->assertNotEmpty($operationResponse->links->notification); - $this->assertNotEmpty($operationResponse->links->notification->href); - } /** * Returns a PSR7 Stream for a given fixture. * @@ -75,24 +62,25 @@ protected function getPsr7GzipResponseForFixture($fixture, $statusCode = 200): P /** * Mock client class. * - * @param $response - * @return static + * @param mixed $response + * @return Client */ protected function getMockClient($response = '') { if ($response) { $connector = $this - ->getMockBuilder('AcquiaCloudApi\CloudApi\Connector') + ->getMockBuilder('AcquiaCloudApi\Connector\Connector') ->disableOriginalConstructor() - ->setMethods(['makeRequest']) + ->setMethods(['sendRequest']) ->getMock(); + $connector ->expects($this->atLeastOnce()) - ->method('makeRequest') + ->method('sendRequest') ->willReturn($response); } else { $connector = $this - ->getMockBuilder('AcquiaCloudApi\CloudApi\Connector') + ->getMockBuilder('AcquiaCloudApi\Connector\Connector') ->disableOriginalConstructor() ->getMock(); } diff --git a/tests/Endpoints/AccountTest.php b/tests/Endpoints/AccountTest.php index 2c92962d..f38a8a66 100644 --- a/tests/Endpoints/AccountTest.php +++ b/tests/Endpoints/AccountTest.php @@ -3,6 +3,7 @@ namespace AcquiaCloudApi\Tests\Endpoints; use AcquiaCloudApi\Tests\CloudApiTestCase; +use AcquiaCloudApi\Endpoints\Account; class AccountTest extends CloudApiTestCase { @@ -22,11 +23,12 @@ class AccountTest extends CloudApiTestCase public function testGetAccount() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getAccount.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Account/getAccount.json'); $client = $this->getMockClient($response); /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->account(); + $account = new Account($client); + $result = $account->get(); $this->assertInstanceOf('\AcquiaCloudApi\Response\AccountResponse', $result); diff --git a/tests/Endpoints/ApplicationsTest.php b/tests/Endpoints/ApplicationsTest.php index c7f10555..a7487d12 100644 --- a/tests/Endpoints/ApplicationsTest.php +++ b/tests/Endpoints/ApplicationsTest.php @@ -3,6 +3,7 @@ namespace AcquiaCloudApi\Tests\Endpoints; use AcquiaCloudApi\Tests\CloudApiTestCase; +use AcquiaCloudApi\Endpoints\Applications; class ApplicationsTest extends CloudApiTestCase { @@ -19,13 +20,21 @@ class ApplicationsTest extends CloudApiTestCase 'links' ]; + protected $tagProperties = [ + 'name', + 'color', + 'context', + 'links' + ]; + public function testGetApplications() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getApplications.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Applications/getAllApplications.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->applications(); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $application = new Applications($client); + $result = $application->getAll(); $this->assertInstanceOf('\ArrayObject', $result); $this->assertInstanceOf('\AcquiaCloudApi\Response\ApplicationsResponse', $result); @@ -41,11 +50,12 @@ public function testGetApplications() public function testGetApplication() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getApplication.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Applications/getApplication.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->application('8ff6c046-ec64-4ce4-bea6-27845ec18600'); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $application = new Applications($client); + $result = $application->get('8ff6c046-ec64-4ce4-bea6-27845ec18600'); $this->assertNotInstanceOf('\AcquiaCloudApi\Response\ApplicationsResponse', $result); $this->assertInstanceOf('\AcquiaCloudApi\Response\ApplicationResponse', $result); @@ -57,54 +67,64 @@ public function testGetApplication() public function testRenameApplication() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/renameApplication.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Applications/renameApplication.json'); $client = $this->getMockClient($response); /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->renameApplication('8ff6c046-ec64-4ce4-bea6-27845ec18600', "My application's new name"); + $application = new Applications($client); + $result = $application->rename('8ff6c046-ec64-4ce4-bea6-27845ec18600', "My application's new name"); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); $this->assertEquals('Application renamed.', $result->message); } - public function testGetTeamApplications() + public function testGetAllTags() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getTeamApplications.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Applications/getAllTags.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->teamApplications('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $application = new Applications($client); + $result = $application->getAllTags('8ff6c046-ec64-4ce4-bea6-27845ec18600'); $this->assertInstanceOf('\ArrayObject', $result); - $this->assertInstanceOf('\AcquiaCloudApi\Response\ApplicationsResponse', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\TagsResponse', $result); foreach ($result as $record) { - $this->assertInstanceOf('\AcquiaCloudApi\Response\ApplicationResponse', $record); + $this->assertInstanceOf('\AcquiaCloudApi\Response\TagResponse', $record); - foreach ($this->properties as $property) { + foreach ($this->tagProperties as $property) { $this->assertObjectHasAttribute($property, $record); } } } - public function testGetOrganizationApplications() + public function testCreateTag() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getOrganizationApplications.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Applications/createTag.json'); $client = $this->getMockClient($response); /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->organizationApplications('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + $application = new Applications($client); + $result = $application->createTag('8ff6c046-ec64-4ce4-bea6-27845ec18600', "deloitte", "orange"); - $this->assertInstanceOf('\ArrayObject', $result); - $this->assertInstanceOf('\AcquiaCloudApi\Response\ApplicationsResponse', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); - foreach ($result as $record) { - $this->assertInstanceOf('\AcquiaCloudApi\Response\ApplicationResponse', $record); + $this->assertEquals('The tag has been added to the application.', $result->message); + } - foreach ($this->properties as $property) { - $this->assertObjectHasAttribute($property, $record); - } - } + public function testDeleteTag() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Applications/deleteTag.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $application = new Applications($client); + $result = $application->deleteTag('8ff6c046-ec64-4ce4-bea6-27845ec18600', "deloitte"); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + + $this->assertEquals('The tag has been removed from the application.', $result->message); } } diff --git a/tests/Endpoints/ClientTest.php b/tests/Endpoints/ClientTest.php index 47381f11..a416327a 100644 --- a/tests/Endpoints/ClientTest.php +++ b/tests/Endpoints/ClientTest.php @@ -3,20 +3,16 @@ namespace AcquiaCloudApi\Tests\Endpoints; use AcquiaCloudApi\Tests\CloudApiTestCase; -use AcquiaCloudApi\CloudApi\Client; -use AcquiaCloudApi\CloudApi\Connector; +use AcquiaCloudApi\Connector\Client; +use AcquiaCloudApi\Connector\Connector; +use AcquiaCloudApi\Endpoints\Code; class ClientTest extends CloudApiTestCase { public function testAddQuery() { - $config = [ - 'key' => 'd0697bfc-7f56-4942-9205-b5686bf5b3f5', - 'secret' => 'D5UfO/4FfNBWn4+0cUwpLOoFzfP7Qqib4AoY+wYGsKE=', - ]; - $connector = new Connector($config); - $client = Client::factory($connector); + $client = $this->getMockClient(); $client->addQuery('filter', 'name=dev'); $client->addQuery('filter', 'type=file'); @@ -33,13 +29,14 @@ public function testAddQuery() public function testFilteredQuery() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getFilteredCode.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Client/getFilteredCode.json'); $client = $this->getMockClient($response); /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ $client->addQuery('filter', 'name=@*2014*'); $client->addQuery('filter', 'type=@*true*'); - $result = $client->code('8ff6c046-ec64-4ce4-bea6-27845ec18600'); + $code = new Code($client); + $result = $code->getAll('8ff6c046-ec64-4ce4-bea6-27845ec18600'); foreach ($result as $record) { $this->assertContains('2014', $record->name); @@ -48,12 +45,7 @@ public function testFilteredQuery() public function testClearQuery() { - $config = [ - 'key' => 'd0697bfc-7f56-4942-9205-b5686bf5b3f5', - 'secret' => 'D5UfO/4FfNBWn4+0cUwpLOoFzfP7Qqib4AoY+wYGsKE=', - ]; - $connector = new Connector($config); - $client = Client::factory($connector); + $client = $this->getMockClient(); $client->addQuery('filter', 'name=dev'); $this->assertEquals(['filter' => 'name=dev'], $client->getQuery()); diff --git a/tests/Endpoints/CodeTest.php b/tests/Endpoints/CodeTest.php index 4cdda2d2..e113552c 100644 --- a/tests/Endpoints/CodeTest.php +++ b/tests/Endpoints/CodeTest.php @@ -3,6 +3,7 @@ namespace AcquiaCloudApi\Tests\Endpoints; use AcquiaCloudApi\Tests\CloudApiTestCase; +use AcquiaCloudApi\Endpoints\Code; class CodeTest extends CloudApiTestCase { @@ -14,11 +15,12 @@ class CodeTest extends CloudApiTestCase public function testGetBranches() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getCode.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Code/getAllCode.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->code('8ff6c046-ec64-4ce4-bea6-27845ec18600'); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $code = new Code($client); + $result = $code->getAll('8ff6c046-ec64-4ce4-bea6-27845ec18600'); $this->assertInstanceOf('\ArrayObject', $result); $this->assertInstanceOf('\AcquiaCloudApi\Response\BranchesResponse', $result); @@ -34,27 +36,31 @@ public function testGetBranches() public function testCodeSwitch() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/switchCode.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Code/switchCode.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->switchCode('8ff6c046-ec64-4ce4-bea6-27845ec18600', 'my-feature-branch'); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $code = new Code($client); + $result = $code->switch('8ff6c046-ec64-4ce4-bea6-27845ec18600', 'my-feature-branch'); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); - $this->assertOperationResponse($result); $this->assertEquals('Switching code.', $result->message); } public function testCodeDeploy() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/deployCode.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Code/deployCode.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->deployCode('8ff6c046-ec64-4ce4-bea6-27845ec18600', 'f9ef59eb-13ee-4050-8120-5524d8ce9821', 'Commit message'); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $code = new Code($client); + $result = $code->deploy( + '8ff6c046-ec64-4ce4-bea6-27845ec18600', + 'f9ef59eb-13ee-4050-8120-5524d8ce9821', + 'Commit message' + ); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); - $this->assertOperationResponse($result); $this->assertEquals('Deploying code.', $result->message); } } diff --git a/tests/Endpoints/ConnectorTest.php b/tests/Endpoints/ConnectorTest.php new file mode 100644 index 00000000..1e7d420d --- /dev/null +++ b/tests/Endpoints/ConnectorTest.php @@ -0,0 +1,31 @@ + 'key', + 'secret' => 'secret' + ]; + + $connector = new Connector($config); + + $this->assertEquals( + $connector::BASE_URI, + 'https://cloud.acquia.com/api' + ); + $this->assertEquals( + $connector::URL_ACCESS_TOKEN, + 'https://accounts.acquia.com/api/auth/oauth/token' + ); + } +} diff --git a/tests/Endpoints/CronsTest.php b/tests/Endpoints/CronsTest.php index d8fba725..276effc8 100644 --- a/tests/Endpoints/CronsTest.php +++ b/tests/Endpoints/CronsTest.php @@ -3,6 +3,7 @@ namespace AcquiaCloudApi\Tests\Endpoints; use AcquiaCloudApi\Tests\CloudApiTestCase; +use AcquiaCloudApi\Endpoints\Crons; class CronsTest extends CloudApiTestCase { @@ -22,14 +23,15 @@ class CronsTest extends CloudApiTestCase 'links' ]; - public function testGetCrons() + public function testGetAllCrons() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getCrons.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Crons/getAllCrons.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->crons('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $cron = new Crons($client); + $result = $cron->getAll('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); $this->assertInstanceOf('\ArrayObject', $result); $this->assertInstanceOf('\AcquiaCloudApi\Response\CronsResponse', $result); @@ -45,11 +47,12 @@ public function testGetCrons() public function testGetCron() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getCron.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Crons/getCron.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->cron('8ff6c046-ec64-4ce4-bea6-27845ec18600', 3); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $cron = new Crons($client); + $result = $cron->get('8ff6c046-ec64-4ce4-bea6-27845ec18600', 3); $this->assertNotInstanceOf('\AcquiaCloudApi\Response\CronsResponse', $result); $this->assertInstanceOf('\AcquiaCloudApi\Response\CronResponse', $result); @@ -59,55 +62,79 @@ public function testGetCron() } } - public function testCronAdd() + public function testCreateCron() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/addCron.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Crons/createCron.json'); $client = $this->getMockClient($response); /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->createCron('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', '/usr/local/bin/drush cc all', '*/30 * * * *', 'My New Cron'); + $cron = new Crons($client); + $result = $cron->create( + '14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', + '/usr/local/bin/drush cc all', + '*/30 * * * *', + 'My New Cron' + ); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); - $this->assertOperationResponse($result); $this->assertEquals('Creating a new cron.', $result->message); } - public function testCronDelete() + public function testUpdateCron() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/deleteCron.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Crons/updateCron.json'); $client = $this->getMockClient($response); /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->deleteCron('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', 14); + $cron = new Crons($client); + $result = $cron->update( + '14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', + '14', + '/usr/local/bin/drush cc all', + '*/30 * * * *', + 'My New Cron' + ); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); - $this->assertOperationResponse($result); - $this->assertEquals('Deleting cron.', $result->message); + $this->assertEquals('Updating cron.', $result->message); } - public function testCronEnable() + public function testDeleteCron() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/enableCron.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Crons/deleteCron.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->enableCron('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', 2); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $cron = new Crons($client); + $result = $cron->delete('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', 14); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + $this->assertEquals('Deleting cron.', $result->message); + } + + public function testEnableCron() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Crons/enableCron.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $cron = new Crons($client); + $result = $cron->enable('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', 2); + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); $this->assertEquals('The cron is being enabled.', $result->message); } - public function testCronDisable() + public function testDisableCron() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/disableCron.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Crons/disableCron.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->disableCron('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', 2); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $cron = new Crons($client); + $result = $cron->disable('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', 2); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); - $this->assertEquals('The cron is being disabled.', $result->message); } } diff --git a/tests/Endpoints/DatabaseBackupsTest.php b/tests/Endpoints/DatabaseBackupsTest.php new file mode 100644 index 00000000..c9e2accc --- /dev/null +++ b/tests/Endpoints/DatabaseBackupsTest.php @@ -0,0 +1,88 @@ +getPsr7JsonResponseForFixture('Endpoints/DatabaseBackups/createDatabaseBackup.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $databaseBackup = new DatabaseBackups($client); + $result = $databaseBackup->create('185f07c7-9c4f-407b-8968-67892ebcb38a', 'db_name'); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + + $this->assertEquals('Creating the backup.', $result->message); + } + + public function testGetDatabaseBackups() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/DatabaseBackups/getAllDatabaseBackups.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $databaseBackup = new DatabaseBackups($client); + $result = $databaseBackup->getAll('185f07c7-9c4f-407b-8968-67892ebcb38a', 'db_name'); + + $this->assertInstanceOf('\ArrayObject', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\BackupsResponse', $result); + + foreach ($result as $record) { + $this->assertInstanceOf('\AcquiaCloudApi\Response\BackupResponse', $record); + + foreach ($this->properties as $property) { + $this->assertObjectHasAttribute($property, $record); + } + } + } + + public function testGetDatabaseBackup() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/DatabaseBackups/getDatabaseBackup.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $databaseBackup = new DatabaseBackups($client); + $result = $databaseBackup->get('24-a47ac10b-58cc-4372-a567-0e02b2c3d470', 'db_name', 12); + + $this->assertNotInstanceOf('\AcquiaCloudApi\Response\BackupsResponse', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\BackupResponse', $result); + + foreach ($this->properties as $property) { + $this->assertObjectHasAttribute($property, $result); + } + } + + public function testRestoreDatabaseBackup() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/DatabaseBackups/restoreDatabaseBackup.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $databaseBackup = new DatabaseBackups($client); + $result = $databaseBackup->restore('24-a47ac10b-58cc-4372-a567-0e02b2c3d470', 'db_name', 12); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + + $this->assertEquals('Restoring the database backup.', $result->message); + } +} diff --git a/tests/Endpoints/DatabasesTest.php b/tests/Endpoints/DatabasesTest.php index 0710e503..82d101b2 100644 --- a/tests/Endpoints/DatabasesTest.php +++ b/tests/Endpoints/DatabasesTest.php @@ -3,6 +3,8 @@ namespace AcquiaCloudApi\Tests\Endpoints; use AcquiaCloudApi\Tests\CloudApiTestCase; +use AcquiaCloudApi\Endpoints\Databases; +use AcquiaCloudApi\Endpoints\DatabaseBackups; class DatabasesTest extends CloudApiTestCase { @@ -11,44 +13,14 @@ class DatabasesTest extends CloudApiTestCase 'name', ]; - public $backupProperties = [ - 'id', - 'database', - 'type', - 'startedAt', - 'completedAt', - 'flags', - 'environment', - 'links', - ]; - - public function testGetDatabases() + public function testGetApplicationDatabases() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getDatabases.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Databases/getAllDatabases.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->databases('185f07c7-9c4f-407b-8968-67892ebcb38a'); - - $this->assertInstanceOf('\ArrayObject', $result); - $this->assertInstanceOf('\AcquiaCloudApi\Response\DatabasesResponse', $result); - - foreach ($result as $record) { - $this->assertInstanceOf('\AcquiaCloudApi\Response\DatabaseResponse', $record); - - foreach ($this->properties as $property) { - $this->assertObjectHasAttribute($property, $record); - } - } - } - - public function testGetEnvironmentDatabases() - { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getEnvironmentDatabases.json'); - $client = $this->getMockClient($response); - - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->environmentDatabases('24-a47ac10b-58cc-4372-a567-0e02b2c3d470'); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $databases = new Databases($client); + $result = $databases->getAll('185f07c7-9c4f-407b-8968-67892ebcb38a'); $this->assertInstanceOf('\ArrayObject', $result); $this->assertInstanceOf('\AcquiaCloudApi\Response\DatabasesResponse', $result); @@ -64,102 +36,45 @@ public function testGetEnvironmentDatabases() public function testDatabaseCopy() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/copyDatabases.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Databases/copyDatabases.json'); $client = $this->getMockClient($response); /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->databaseCopy('24-a47ac10b-58cc-4372-a567-0e02b2c3d470', 'db_name', '14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + $databases = new Databases($client); + $result = $databases->copy( + '24-a47ac10b-58cc-4372-a567-0e02b2c3d470', + 'db_name', + '14-0c7e79ab-1c4a-424e-8446-76ae8be7e851' + ); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); - $this->assertOperationResponse($result); $this->assertEquals('The database is being copied', $result->message); } public function testDatabaseCreate() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/createDatabases.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Databases/createDatabases.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->databaseCreate('8ff6c046-ec64-4ce4-bea6-27845ec18600', 'db_name'); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $databases = new Databases($client); + $result = $databases->create('8ff6c046-ec64-4ce4-bea6-27845ec18600', 'db_name'); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); - $this->assertOperationResponse($result); $this->assertEquals('The database is being created.', $result->message); } public function testDatabaseDelete() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/deleteDatabases.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Databases/deleteDatabases.json'); $client = $this->getMockClient($response); /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->databaseDelete('8ff6c046-ec64-4ce4-bea6-27845ec18600', 'db_name'); + $databases = new Databases($client); + $result = $databases->delete('8ff6c046-ec64-4ce4-bea6-27845ec18600', 'db_name'); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); $this->assertEquals('The database is being deleted.', $result->message); } - - public function testDatabaseBackup() - { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/backupDatabases.json'); - $client = $this->getMockClient($response); - - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->createDatabaseBackup('185f07c7-9c4f-407b-8968-67892ebcb38a', 'db_name'); - - $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); - $this->assertOperationResponse($result); - $this->assertEquals('Creating the backup.', $result->message); - } - - public function testGetDatabaseBackups() - { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getDatabaseBackups.json'); - $client = $this->getMockClient($response); - - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->databaseBackups('185f07c7-9c4f-407b-8968-67892ebcb38a', 'db_name'); - - $this->assertInstanceOf('\ArrayObject', $result); - $this->assertInstanceOf('\AcquiaCloudApi\Response\BackupsResponse', $result); - - foreach ($result as $record) { - $this->assertInstanceOf('\AcquiaCloudApi\Response\BackupResponse', $record); - - foreach ($this->backupProperties as $property) { - $this->assertObjectHasAttribute($property, $record); - } - } - } - - public function testGetDatabaseBackup() - { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getDatabaseBackup.json'); - $client = $this->getMockClient($response); - - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->databaseBackup('24-a47ac10b-58cc-4372-a567-0e02b2c3d470', 'db_name', 12); - - $this->assertNotInstanceOf('\AcquiaCloudApi\Response\BackupsResponse', $result); - $this->assertInstanceOf('\AcquiaCloudApi\Response\BackupResponse', $result); - - foreach ($this->backupProperties as $property) { - $this->assertObjectHasAttribute($property, $result); - } - } - - public function testRestoreDatabaseBackup() - { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/restoreDatabaseBackup.json'); - $client = $this->getMockClient($response); - - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->restoreDatabaseBackup('24-a47ac10b-58cc-4372-a567-0e02b2c3d470', 'db_name', 12); - - $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); - $this->assertOperationResponse($result); - $this->assertEquals('Restoring the database backup.', $result->message); - } } diff --git a/tests/Endpoints/DomainsTest.php b/tests/Endpoints/DomainsTest.php index 4a77a1fc..b51054a2 100644 --- a/tests/Endpoints/DomainsTest.php +++ b/tests/Endpoints/DomainsTest.php @@ -3,6 +3,7 @@ namespace AcquiaCloudApi\Tests\Endpoints; use AcquiaCloudApi\Tests\CloudApiTestCase; +use AcquiaCloudApi\Endpoints\Domains; class DomainsTest extends CloudApiTestCase { @@ -13,14 +14,23 @@ class DomainsTest extends CloudApiTestCase 'environment', ]; + public $metricsProperties = [ + 'metric', + 'datapoints', + 'last_data_at', + 'metadata', + 'links' + ]; + public function testGetDomains() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getDomains.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Domains/getAllDomains.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->domains('185f07c7-9c4f-407b-8968-67892ebcb38a'); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $domain = new Domains($client); + $result = $domain->getAll('185f07c7-9c4f-407b-8968-67892ebcb38a'); $this->assertInstanceOf('\ArrayObject', $result); $this->assertInstanceOf('\AcquiaCloudApi\Response\DomainsResponse', $result); @@ -36,11 +46,12 @@ public function testGetDomains() public function testGetDomain() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getDomain.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Domains/getDomain.json'); $client = $this->getMockClient($response); /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->domain('185f07c7-9c4f-407b-8968-67892ebcb38a', 'example.com'); + $domain = new Domains($client); + $result = $domain->get('185f07c7-9c4f-407b-8968-67892ebcb38a', 'example.com'); $this->assertInstanceOf('\AcquiaCloudApi\Response\DomainResponse', $result); $this->assertEquals('example.com', $result->hostname); @@ -52,27 +63,65 @@ public function testGetDomain() public function testDomainAdd() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/addDomain.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Domains/createDomain.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->createDomain('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', 'example.com'); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $domain = new Domains($client); + $result = $domain->create('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', 'new-domain.com'); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); - $this->assertOperationResponse($result); $this->assertEquals("Adding domain example.com", $result->message); } public function testDomainDelete() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/deleteDomain.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Domains/deleteDomain.json'); $client = $this->getMockClient($response); /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->deleteDomain('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', 'example.com'); + $domain = new Domains($client); + $result = $domain->delete('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', 'deleted-domain.com'); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); - $this->assertOperationResponse($result); $this->assertEquals("Removing the domain example.com", $result->message); } + + public function testDomainStatus() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Domains/getDomainStatus.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $domain = new Domains($client); + $result = $domain->status('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', 'domain.com'); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\DomainResponse', $result); + $this->assertEquals('example.com', $result->hostname); + + foreach ($this->properties as $property) { + $this->assertObjectHasAttribute($property, $result); + } + } + + public function testDomainMetrics() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Domains/getDomainMetrics.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $domain = new Domains($client); + $result = $domain->metrics('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', 'example.com'); + + $this->assertInstanceOf('\ArrayObject', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\MetricsResponse', $result); + + foreach ($result as $record) { + $this->assertInstanceOf('\AcquiaCloudApi\Response\MetricResponse', $record); + + foreach ($this->metricsProperties as $property) { + $this->assertObjectHasAttribute($property, $record); + } + } + } } diff --git a/tests/Endpoints/DrushTest.php b/tests/Endpoints/DrushTest.php index 85802195..110698c8 100644 --- a/tests/Endpoints/DrushTest.php +++ b/tests/Endpoints/DrushTest.php @@ -3,17 +3,19 @@ namespace AcquiaCloudApi\Tests\Endpoints; use AcquiaCloudApi\Tests\CloudApiTestCase; +use AcquiaCloudApi\Endpoints\Account; class DrushTest extends CloudApiTestCase { public function testGetApplications() { - $response = $this->getPsr7GzipResponseForFixture('Endpoints/getDrushAliases.json'); + $response = $this->getPsr7GzipResponseForFixture('Endpoints/Account/getDrushAliases.json'); $client = $this->getMockClient($response); /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->drushAliases(); + $account = new Account($client); + $result = $account->getDrushAliases(); $headers = $response->getHeader('Content-Type'); $this->assertEquals('application/gzip', reset($headers)); diff --git a/tests/Endpoints/EnvironmentsTest.php b/tests/Endpoints/EnvironmentsTest.php index ee55b4a4..920e3b78 100644 --- a/tests/Endpoints/EnvironmentsTest.php +++ b/tests/Endpoints/EnvironmentsTest.php @@ -3,6 +3,7 @@ namespace AcquiaCloudApi\Tests\Endpoints; use AcquiaCloudApi\Tests\CloudApiTestCase; +use AcquiaCloudApi\Endpoints\Environments; class EnvironmentsTest extends CloudApiTestCase { @@ -26,11 +27,12 @@ class EnvironmentsTest extends CloudApiTestCase public function testGetEnvironments() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getEnvironments.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Environments/getAllEnvironments.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->environments('8ff6c046-ec64-4ce4-bea6-27845ec18600'); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $environments = new Environments($client); + $result = $environments->getAll('8ff6c046-ec64-4ce4-bea6-27845ec18600'); $this->assertInstanceOf('\ArrayObject', $result); $this->assertInstanceOf('\AcquiaCloudApi\Response\EnvironmentsResponse', $result); @@ -46,12 +48,13 @@ public function testGetEnvironments() public function testGetEnvironment() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getEnvironment.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Environments/getEnvironment.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->environment('24-a47ac10b-58cc-4372-a567-0e02b2c3d470'); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $environment = new Environments($client); + $result = $environment->get('24-a47ac10b-58cc-4372-a567-0e02b2c3d470'); $this->assertNotInstanceOf('\AcquiaCloudApi\Response\EnvironmentsResponse', $result); $this->assertInstanceOf('\AcquiaCloudApi\Response\EnvironmentResponse', $result); @@ -63,40 +66,66 @@ public function testGetEnvironment() public function testModifyEnvironment() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/modifyEnvironment.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Environments/updateEnvironment.json'); - $client = $this->getMockClient($response); + $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->modifyEnvironment('24-a47ac10b-58cc-4372-a567-0e02b2c3d470', ['version' => '7.2']); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $environment = new Environments($client); + $result = $environment->update('24-a47ac10b-58cc-4372-a567-0e02b2c3d470', ['version' => '7.2']); - $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); - $this->assertEquals('The environment configuration is being updated.', $result->message); + $this->assertEquals('The environment configuration is being updated.', $result->message); } public function testRenameEnvironment() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/renameEnvironment.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Environments/renameEnvironment.json'); $client = $this->getMockClient($response); /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->renameEnvironment('24-a47ac10b-58cc-4372-a567-0e02b2c3d470', 'Alpha'); + $environment = new Environments($client); + $result = $environment->rename('24-a47ac10b-58cc-4372-a567-0e02b2c3d470', 'Alpha'); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); $this->assertEquals('Changing environment label.', $result->message); } - public function testDeleteEnvironment() + public function testCreateCDEnvironment() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Environments/createCDEnvironment.json'); + + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $environment = new Environments($client); + $result = $environment->create( + '24-a47ac10b-58cc-4372-a567-0e02b2c3d470', + 'CD label', + 'my-feature-branch', + [ + "database1", + "database2" + ] + ); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + + $this->assertEquals('Adding an environment.', $result->message); + } + + public function testDeleteCDEnvironment() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/deleteEnvironment.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Environments/deleteCDEnvironment.json'); $client = $this->getMockClient($response); /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->deleteEnvironment('24-a47ac10b-58cc-4372-a567-0e02b2c3d470', 'Alpha'); + $environment = new Environments($client); + $result = $environment->delete('24-a47ac10b-58cc-4372-a567-0e02b2c3d470'); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); diff --git a/tests/Endpoints/ErrorTest.php b/tests/Endpoints/ErrorTest.php index 5cabd368..dc51c454 100644 --- a/tests/Endpoints/ErrorTest.php +++ b/tests/Endpoints/ErrorTest.php @@ -3,43 +3,90 @@ namespace AcquiaCloudApi\Tests\Endpoints; use AcquiaCloudApi\Tests\CloudApiTestCase; +use GuzzleHttp\Exception\BadResponseException; +use AcquiaCloudApi\Exception\ApiErrorException; +use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Response; +use Psr\Http\Message\RequestInterface; +use AcquiaCloudApi\Endpoints\Applications; +use AcquiaCloudApi\Connector\Client; +use AcquiaCloudApi\Connector\Connector; class ErrorTest extends CloudApiTestCase { public function testError403() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/error403.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Error/error403.json'); + $client = $this->getMockClient($response); + $this->expectException(ApiErrorException::class); + $this->expectExceptionMessage('You do not have permission to view applications.'); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $application = new Applications($client); + $application->getAll(); + } + public function testError404() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Error/error404.json'); $client = $this->getMockClient($response); + $this->expectException(ApiErrorException::class); + $this->expectExceptionMessage( + 'The application you are trying to access does not exist, or you do not have permission to access it.' + ); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $application = new Applications($client); + $application->getAll(); + } - try { - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $client->applications(); - } catch (\Exception $e) { - $this->assertEquals($e->getMessage(), 'You do not have permission to view applications.'); + public function testMultipleErrors() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Error/multipleErrors.json'); + $client = $this->getMockClient($response); + $this->expectException(ApiErrorException::class); + $errorMessage = <<< EOM +The application you are trying to access does not exist, or you do not have permission to access it. +You do not have sufficient permissions to do this task. - return; - } +EOM; + $this->expectExceptionMessage($errorMessage); - $this->fail(); + $application = new Applications($client); + $application->getAll(); } - public function testError404() + public function testErrorException() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/error404.json'); - $client = $this->getMockClient($response); + $request = new Request('GET', '/test'); + $response = new Response(500); + $exception = new BadResponseException('Internal Server Error', $request, $response); - try { - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $client->applications(); - } catch (\Exception $e) { - $this->assertEquals($e->getMessage(), 'The application you are trying to access does not exist, or you do not have permission to access it.'); + $connector = $this + ->getMockBuilder('AcquiaCloudApi\Connector\Connector') + ->disableOriginalConstructor() + ->setMethods(['sendRequest']) + ->getMock(); + + $connector->method('sendRequest')->willThrowException($exception); + $client = Client::factory($connector); + $response = $client->makeRequest('GET', '/test'); - return; - } + $this->assertEquals($response->getStatusCode(), 500); + $this->assertEquals($response->getReasonPhrase(), 'Internal Server Error'); + } + + public function testApiErrorException() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Error/error403.json'); + $body = $response->getBody(); + $object = json_decode($body); - $this->fail(); + $exception = new ApiErrorException($object); + $errorMessage = <<< EOM +AcquiaCloudApi\Exception\ApiErrorException: [forbidden]: You do not have permission to view applications.\n +EOM; + $this->assertEquals($exception->__toString(), $errorMessage); } } diff --git a/tests/Endpoints/FilesTest.php b/tests/Endpoints/FilesTest.php index d2a9ac40..fa213b59 100644 --- a/tests/Endpoints/FilesTest.php +++ b/tests/Endpoints/FilesTest.php @@ -3,19 +3,23 @@ namespace AcquiaCloudApi\Tests\Endpoints; use AcquiaCloudApi\Tests\CloudApiTestCase; +use AcquiaCloudApi\Endpoints\Environments; class FilesTest extends CloudApiTestCase { public function testFilesCopy() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/copyFiles.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Environments/copyFiles.json'); $client = $this->getMockClient($response); /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->copyFiles('8ff6c046-ec64-4ce4-bea6-27845ec18600', '14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + $environment = new Environments($client); + $result = $environment->copyFiles( + '8ff6c046-ec64-4ce4-bea6-27845ec18600', + '14-0c7e79ab-1c4a-424e-8446-76ae8be7e851' + ); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); - $this->assertOperationResponse($result); $this->assertEquals('Copying files.', $result->message); } } diff --git a/tests/Endpoints/FiltersTest.php b/tests/Endpoints/FiltersTest.php index f859c617..83f4b1cf 100644 --- a/tests/Endpoints/FiltersTest.php +++ b/tests/Endpoints/FiltersTest.php @@ -10,7 +10,6 @@ class FiltersTest extends CloudApiTestCase public function testAddFilter() { - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $object */ $object = $this->getMockClient(); $expectedValue = ['filter' => 'name=@"foobar"']; diff --git a/tests/Endpoints/IdentityProviderTest.php b/tests/Endpoints/IdentityProviderTest.php new file mode 100644 index 00000000..3a0857e5 --- /dev/null +++ b/tests/Endpoints/IdentityProviderTest.php @@ -0,0 +1,121 @@ +getPsr7JsonResponseForFixture('Endpoints/IdentityProviders/getAllIdentityProviders.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $idp = new IdentityProviders($client); + $result = $idp->getAll(); + + $this->assertInstanceOf('\ArrayObject', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\IdentityProvidersResponse', $result); + + foreach ($result as $record) { + $this->assertInstanceOf('\AcquiaCloudApi\Response\IdentityProviderResponse', $record); + + foreach ($this->properties as $property) { + $this->assertObjectHasAttribute($property, $record); + } + } + } + + public function testGetLogForwardingDestination() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/IdentityProviders/getIdentityProvider.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $idp = new IdentityProviders($client); + $result = $idp->get('8ff6c046-ec64-4ce4-bea6-27845ec18600'); + + $this->assertNotInstanceOf('\AcquiaCloudApi\Response\IdentityProvidersResponse', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\IdentityProviderResponse', $result); + + foreach ($this->properties as $property) { + $this->assertObjectHasAttribute($property, $result); + } + } + + public function testDeleteLogForwardingDestination() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/IdentityProviders/deleteIdentityProvider.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $idp = new IdentityProviders($client); + $result = $idp->delete('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + + $this->assertEquals('Identity provider has been deleted.', $result->message); + } + + public function testEnableLogForwardingDestination() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/IdentityProviders/enableIdentityProvider.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $idp = new IdentityProviders($client); + $result = $idp->enable('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + + $this->assertEquals('Identity Provider has been enabled.', $result->message); + } + + public function testDisableLogForwardingDestination() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/IdentityProviders/disableIdentityProvider.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $idp = new IdentityProviders($client); + $result = $idp->disable('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + + $this->assertEquals('Identity Provider has been disabled.', $result->message); + } + + public function testUpdateLogForwardingDestination() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/IdentityProviders/updateIdentityProvider.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $idp = new IdentityProviders($client); + $result = $idp->update( + '14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', + 'Test IDP', + 'entity-id', + 'https://idp.example.com', + "-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----" + ); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + + $this->assertEquals('Identity Provider has been updated.', $result->message); + } +} diff --git a/tests/Endpoints/IdesTest.php b/tests/Endpoints/IdesTest.php new file mode 100644 index 00000000..f00bd6bd --- /dev/null +++ b/tests/Endpoints/IdesTest.php @@ -0,0 +1,86 @@ +getPsr7JsonResponseForFixture('Endpoints/Ides/getAllIdes.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $ide = new Ides($client); + $result = $ide->getAll('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + + $this->assertInstanceOf('\ArrayObject', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\IdesResponse', $result); + + foreach ($result as $record) { + $this->assertInstanceOf('\AcquiaCloudApi\Response\IdeResponse', $record); + + foreach ($this->properties as $property) { + $this->assertObjectHasAttribute($property, $record); + } + } + } + + public function testGetIde() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Ides/getIde.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $ide = new Ides($client); + $result = $ide->get('8ff6c046-ec64-4ce4-bea6-27845ec18600'); + + $this->assertNotInstanceOf('\AcquiaCloudApi\Response\IdesResponse', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\IdeResponse', $result); + + foreach ($this->properties as $property) { + $this->assertObjectHasAttribute($property, $result); + } + } + + public function testCreateIde() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Ides/createIde.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $ide = new Ides($client); + $result = $ide->create( + '14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', + 'My new IDE' + ); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + + $this->assertEquals('The remote IDE is being created.', $result->message); + } + + public function testDeleteIde() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Ides/deleteIde.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $ide = new Ides($client); + $result = $ide->delete('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + + $this->assertEquals('The remote IDE is being deleted.', $result->message); + } +} diff --git a/tests/Endpoints/InsightsTest.php b/tests/Endpoints/InsightsTest.php index 72e87419..c0505c97 100644 --- a/tests/Endpoints/InsightsTest.php +++ b/tests/Endpoints/InsightsTest.php @@ -3,6 +3,7 @@ namespace AcquiaCloudApi\Tests\Endpoints; use AcquiaCloudApi\Tests\CloudApiTestCase; +use AcquiaCloudApi\Endpoints\Insights; class InsightsTest extends CloudApiTestCase { @@ -17,14 +18,45 @@ class InsightsTest extends CloudApiTestCase 'links' ]; + public $alertProperties = [ + 'alert_id', + 'uuid', + 'name', + 'message', + 'article_link', + 'severity', + 'severity_label', + 'failed_value', + 'fix_details', + 'categories', + 'flags', + 'links' + ]; + + public $moduleProperties = [ + 'module_id', + 'name', + 'filename', + 'version', + 'supported_majors', + 'recommended_major', + 'package', + 'core', + 'project', + 'release_date', + 'flags', + 'tags' + ]; + public function testGetInsights() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getInsights.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Insights/getAllInsights.json'); $client = $this->getMockClient($response); /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->applicationInsights('8ff6c046-ec64-4ce4-bea6-27845ec18600'); + $insights = new Insights($client); + $result = $insights->getAll('8ff6c046-ec64-4ce4-bea6-27845ec18600'); $this->assertInstanceOf('\ArrayObject', $result); $this->assertInstanceOf('\AcquiaCloudApi\Response\InsightsResponse', $result); @@ -38,21 +70,140 @@ public function testGetInsights() } } - public function testGetEnvironmentInsights() + public function testGetInsight() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Insights/getInsight.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $insights = new Insights($client); + $result = $insights->get('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\InsightResponse', $result); + foreach ($this->properties as $property) { + $this->assertObjectHasAttribute($property, $result); + } + } + + public function testGetAllAlerts() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getEnvironmentInsights.json'); + + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Insights/getAllAlerts.json'); $client = $this->getMockClient($response); /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->environmentInsights('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + $insights = new Insights($client); + $result = $insights->getAllAlerts('8ff6c046-ec64-4ce4-bea6-27845ec18600'); $this->assertInstanceOf('\ArrayObject', $result); - $this->assertInstanceOf('\AcquiaCloudApi\Response\InsightsResponse', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\InsightAlertsResponse', $result); foreach ($result as $record) { - $this->assertInstanceOf('\AcquiaCloudApi\Response\InsightResponse', $record); + $this->assertInstanceOf('\AcquiaCloudApi\Response\InsightAlertResponse', $record); - foreach ($this->properties as $property) { + foreach ($this->alertProperties as $property) { + $this->assertObjectHasAttribute($property, $record); + } + } + } + + public function testGetAlert() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Insights/getAlert.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $insights = new Insights($client); + $result = $insights->getAlert( + '14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', + 'da1c0a8e-ff69-45db-88fc-acd6d2affbb7' + ); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\InsightAlertResponse', $result); + foreach ($this->alertProperties as $property) { + $this->assertObjectHasAttribute($property, $result); + } + } + + public function testIgnoreAlert() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Insights/ignoreAlert.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $insights = new Insights($client); + $result = $insights->ignoreAlert( + '8ff6c046-ec64-4ce4-bea6-27845ec18600', + 'da1c0a8e-ff69-45db-88fc-acd6d2affbb7' + ); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + + $this->assertEquals('Alert ignored.', $result->message); + } + + public function testRestoreAlert() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Insights/restoreAlert.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $insights = new Insights($client); + $result = $insights->restoreAlert( + '8ff6c046-ec64-4ce4-bea6-27845ec18600', + 'da1c0a8e-ff69-45db-88fc-acd6d2affbb7' + ); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + + $this->assertEquals('Alert restored.', $result->message); + } + + public function testRevokeSite() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Insights/revokeSite.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $insights = new Insights($client); + $result = $insights->revoke('8ff6c046-ec64-4ce4-bea6-27845ec18600'); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + + $this->assertEquals('Site revoked from submitting Insight score data.', $result->message); + } + + public function testUnrevokeSite() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Insights/unrevokeSite.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $insights = new Insights($client); + $result = $insights->unrevoke('8ff6c046-ec64-4ce4-bea6-27845ec18600'); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + + $this->assertEquals('Site un-revoked.', $result->message); + } + + public function testGetModules() + { + + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Insights/getModules.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $insights = new Insights($client); + $result = $insights->getModules('8ff6c046-ec64-4ce4-bea6-27845ec18600'); + + $this->assertInstanceOf('\ArrayObject', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\InsightModulesResponse', $result); + + foreach ($result as $record) { + $this->assertInstanceOf('\AcquiaCloudApi\Response\InsightModuleResponse', $record); + + foreach ($this->moduleProperties as $property) { $this->assertObjectHasAttribute($property, $record); } } diff --git a/tests/Endpoints/InvitesTest.php b/tests/Endpoints/InvitesTest.php deleted file mode 100644 index 52a6402e..00000000 --- a/tests/Endpoints/InvitesTest.php +++ /dev/null @@ -1,44 +0,0 @@ -getPsr7JsonResponseForFixture('Endpoints/getOrganizationInvitees.json'); - $client = $this->getMockClient($response); - - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->invitees('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); - - $this->assertInstanceOf('\ArrayObject', $result); - $this->assertInstanceOf('\AcquiaCloudApi\Response\InvitationsResponse', $result); - - foreach ($result as $record) { - $this->assertInstanceOf('\AcquiaCloudApi\Response\InvitationResponse', $record); - - foreach ($this->properties as $property) { - $this->assertObjectHasAttribute($property, $record); - } - } - } -} diff --git a/tests/Endpoints/LiveDevTest.php b/tests/Endpoints/LiveDevTest.php index d1293c22..3fd823a3 100644 --- a/tests/Endpoints/LiveDevTest.php +++ b/tests/Endpoints/LiveDevTest.php @@ -3,17 +3,19 @@ namespace AcquiaCloudApi\Tests\Endpoints; use AcquiaCloudApi\Tests\CloudApiTestCase; +use AcquiaCloudApi\Endpoints\Environments; class LiveDevTest extends CloudApiTestCase { public function testLiveDevEnable() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/enableLiveDev.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Environments/enableLiveDev.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->enableLiveDev('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $environment = new Environments($client); + $result = $environment->enableLiveDev('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); @@ -22,11 +24,12 @@ public function testLiveDevEnable() public function testLiveDevDisable() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/disableLiveDev.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Environments/disableLiveDev.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->disableLiveDev('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $environment = new Environments($client); + $result = $environment->disableLiveDev('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); diff --git a/tests/Endpoints/LogForwardingTest.php b/tests/Endpoints/LogForwardingTest.php new file mode 100644 index 00000000..eadade0e --- /dev/null +++ b/tests/Endpoints/LogForwardingTest.php @@ -0,0 +1,148 @@ +getPsr7JsonResponseForFixture('Endpoints/LogForwarding/getAllLogForwarding.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $logForwarding = new LogForwardingDestinations($client); + $result = $logForwarding->getAll('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + + $this->assertInstanceOf('\ArrayObject', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\LogForwardingDestinationsResponse', $result); + + foreach ($result as $record) { + $this->assertInstanceOf('\AcquiaCloudApi\Response\LogForwardingDestinationResponse', $record); + + foreach ($this->properties as $property) { + $this->assertObjectHasAttribute($property, $record); + } + } + } + + public function testGetLogForwardingDestination() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/LogForwarding/getLogForwarding.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $logForwarding = new LogForwardingDestinations($client); + $result = $logForwarding->get('8ff6c046-ec64-4ce4-bea6-27845ec18600', 3); + + $this->assertNotInstanceOf('\AcquiaCloudApi\Response\LogForwardingDestinationsResponse', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\LogForwardingDestinationResponse', $result); + + foreach ($this->properties as $property) { + $this->assertObjectHasAttribute($property, $result); + } + } + + public function testCreateLogForwardingDestination() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/LogForwarding/createLogForwarding.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $logForwarding = new LogForwardingDestinations($client); + + $result = $logForwarding->create( + '14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', + 'Test destination', + ["apache-access", "apache-error"], + 'syslog', + ["certificate" => "-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----"], + 'example.com:1234' + ); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + + $this->assertEquals('Log forwarding destination for the environment has been created.', $result->message); + } + + public function testDeleteLogForwardingDestination() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/LogForwarding/deleteLogForwarding.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $logForwarding = new LogForwardingDestinations($client); + $result = $logForwarding->delete('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', 14); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + + $this->assertEquals('Log forwarding destination has been deleted.', $result->message); + } + + public function testEnableLogForwardingDestination() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/LogForwarding/enableLogForwarding.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $logForwarding = new LogForwardingDestinations($client); + $result = $logForwarding->enable('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', 2); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + + $this->assertEquals('Log forwarding destination has been enabled.', $result->message); + } + + public function testDisableLogForwardingDestination() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/LogForwarding/disableLogForwarding.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $logForwarding = new LogForwardingDestinations($client); + $result = $logForwarding->disable('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', 2); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + + $this->assertEquals('Log forwarding destination has been disabled.', $result->message); + } + + public function testUpdateLogForwardingDestination() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/LogForwarding/updateLogForwarding.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $logForwarding = new LogForwardingDestinations($client); + $result = $logForwarding->update( + '14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', + 12, + 'Test destination', + ["apache-access", "apache-error"], + 'syslog', + ["certificate" => "-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----"], + 'example.com:1234' + ); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + + $this->assertEquals('Log forwarding destination has been updated.', $result->message); + } +} diff --git a/tests/Endpoints/LogsTest.php b/tests/Endpoints/LogsTest.php new file mode 100644 index 00000000..49280631 --- /dev/null +++ b/tests/Endpoints/LogsTest.php @@ -0,0 +1,91 @@ +getPsr7JsonResponseForFixture('Endpoints/Logs/getAllLogs.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $logs = new Logs($client); + $result = $logs->getAll('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + + $this->assertInstanceOf('\ArrayObject', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\LogsResponse', $result); + + foreach ($result as $record) { + $this->assertInstanceOf('\AcquiaCloudApi\Response\LogResponse', $record); + + foreach ($this->properties as $property) { + $this->assertObjectHasAttribute($property, $record); + } + } + } + + public function testLogSnapshot() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Logs/createLogSnapshot.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $logs = new Logs($client); + $result = $logs->snapshot('r47ac10b-58cc-4372-a567-0e02b2c3d470', 'php-error'); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + $this->assertEquals('The log file is being created.', $result->message); + } + + public function testDownloadLog() + { + $response = $this->getPsr7GzipResponseForFixture('Endpoints/Logs/downloadLog.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $logs = new Logs($client); + $result = $logs->download('8ff6c046-ec64-4ce4-bea6-27845ec18600', 'php-error'); + + $headers = $response->getHeader('Content-Type'); + $this->assertEquals('application/gzip', reset($headers)); + + $this->assertNotInstanceOf('\ArrayObject', $result); + $this->assertInstanceOf('GuzzleHttp\Psr7\Stream', $result); + } + + + public function testGetLogstream() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Logs/getLogstream.json'); + + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $logs = new Logs($client); + $result = $logs->stream('24-a47ac10b-58cc-4372-a567-0e02b2c3d470'); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\LogstreamResponse', $result); + + foreach ($this->logstreamProperties as $property) { + $this->assertObjectHasAttribute($property, $result); + } + } +} diff --git a/tests/Endpoints/LogstreamTest.php b/tests/Endpoints/LogstreamTest.php deleted file mode 100644 index d5656ac2..00000000 --- a/tests/Endpoints/LogstreamTest.php +++ /dev/null @@ -1,28 +0,0 @@ -getPsr7JsonResponseForFixture('Endpoints/getLogstream.json'); - - $client = $this->getMockClient($response); - - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->logstream('24-a47ac10b-58cc-4372-a567-0e02b2c3d470'); - - $this->assertInstanceOf('\AcquiaCloudApi\Response\LogstreamResponse', $result); - - foreach ($this->properties as $property) { - $this->assertObjectHasAttribute($property, $result); - } - } -} diff --git a/tests/Endpoints/MembersTest.php b/tests/Endpoints/MembersTest.php index d700c7f4..26c34e24 100644 --- a/tests/Endpoints/MembersTest.php +++ b/tests/Endpoints/MembersTest.php @@ -3,6 +3,7 @@ namespace AcquiaCloudApi\Tests\Endpoints; use AcquiaCloudApi\Tests\CloudApiTestCase; +use AcquiaCloudApi\Endpoints\Organizations; class MembersTest extends CloudApiTestCase { @@ -20,11 +21,12 @@ class MembersTest extends CloudApiTestCase public function testGetOrganizationMembers() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getOrganizationMembers.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Organizations/getMembers.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->members('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $organization = new Organizations($client); + $result = $organization->getMembers('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); $this->assertInstanceOf('\ArrayObject', $result); $this->assertInstanceOf('\AcquiaCloudApi\Response\MembersResponse', $result); @@ -40,11 +42,15 @@ public function testGetOrganizationMembers() public function testMemberDelete() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/deleteMember.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Organizations/deleteMember.json'); $client = $this->getMockClient($response); /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->deleteMember('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', '14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + $organization = new Organizations($client); + $result = $organization->deleteMember( + '14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', + '14-0c7e79ab-1c4a-424e-8446-76ae8be7e851' + ); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); diff --git a/tests/Endpoints/MetricsTest.php b/tests/Endpoints/MetricsTest.php new file mode 100644 index 00000000..5b2ef59d --- /dev/null +++ b/tests/Endpoints/MetricsTest.php @@ -0,0 +1,145 @@ +getPsr7JsonResponseForFixture('Endpoints/Metrics/getAggregateData.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $account = new Metrics($client); + $result = $account->getAggregateData('8ff6c046-ec64-4ce4-bea6-27845ec18600'); + + $this->assertInstanceOf('\ArrayObject', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\MetricsResponse', $result); + + foreach ($result as $record) { + $this->assertInstanceOf('\AcquiaCloudApi\Response\MetricResponse', $record); + foreach ($this->properties as $property) { + $this->assertObjectHasAttribute($property, $record); + } + } + } + + public function testGetAggregateUsageMetrics() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Metrics/getAggregateUsageMetrics.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $account = new Metrics($client); + $result = $account->getAggregateUsageMetrics('8ff6c046-ec64-4ce4-bea6-27845ec18600', 'views'); + + $this->assertNotInstanceOf('\AcquiaCloudApi\Response\MetricsResponse', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\MetricResponse', $result); + foreach ($this->properties as $property) { + $this->assertObjectHasAttribute($property, $result); + } + } + public function testGetDataByEnvironment() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Metrics/getDataByEnvironment.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $account = new Metrics($client); + $result = $account->getDataByEnvironment('8ff6c046-ec64-4ce4-bea6-27845ec18600'); + + $this->assertInstanceOf('\ArrayObject', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\MetricsResponse', $result); + + foreach ($result as $record) { + $this->assertInstanceOf('\AcquiaCloudApi\Response\MetricResponse', $record); + foreach ($this->properties as $property) { + $this->assertObjectHasAttribute($property, $record); + } + } + } + public function testGetViewsByEnvironment() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Metrics/getViewsByEnvironment.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $account = new Metrics($client); + $result = $account->getViewsByEnvironment('8ff6c046-ec64-4ce4-bea6-27845ec18600'); + + $this->assertInstanceOf('\ArrayObject', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\MetricsResponse', $result); + + foreach ($result as $record) { + $this->assertInstanceOf('\AcquiaCloudApi\Response\MetricResponse', $record); + foreach ($this->properties as $property) { + $this->assertObjectHasAttribute($property, $record); + } + } + } + public function testGetVisitsByEnvironment() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Metrics/getVisitsByEnvironment.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $account = new Metrics($client); + $result = $account->getVisitsByEnvironment('8ff6c046-ec64-4ce4-bea6-27845ec18600'); + + $this->assertInstanceOf('\ArrayObject', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\MetricsResponse', $result); + + foreach ($result as $record) { + $this->assertInstanceOf('\AcquiaCloudApi\Response\MetricResponse', $record); + foreach ($this->properties as $property) { + $this->assertObjectHasAttribute($property, $record); + } + } + } + public function testGetStackMetricsData() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Metrics/getStackMetricsData.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $account = new Metrics($client); + $result = $account->getStackMetricsData('8ff6c046-ec64-4ce4-bea6-27845ec18600'); + + $this->assertInstanceOf('\ArrayObject', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\MetricsResponse', $result); + + foreach ($result as $record) { + $this->assertInstanceOf('\AcquiaCloudApi\Response\MetricResponse', $record); + foreach ($this->properties as $property) { + $this->assertObjectHasAttribute($property, $record); + } + } + } + public function testGetStackMetricsDataByMetric() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Metrics/getStackMetricsDataByMetric.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $account = new Metrics($client); + $result = $account->getStackMetricsDataByMetric('8ff6c046-ec64-4ce4-bea6-27845ec18600', 'web-cpu'); + + $this->assertNotInstanceOf('\AcquiaCloudApi\Response\MetricsResponse', $result); + + foreach ($this->properties as $property) { + $this->assertObjectHasAttribute($property, $result); + } + } +} diff --git a/tests/Endpoints/NotificationTest.php b/tests/Endpoints/NotificationTest.php index 28f53bf5..2e51cd56 100644 --- a/tests/Endpoints/NotificationTest.php +++ b/tests/Endpoints/NotificationTest.php @@ -1,11 +1,14 @@ getPsr7JsonResponseForFixture('Endpoints/getNotification.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Notifications/getNotification.json'); $client = $this->getMockClient($response); /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->notification('f4b37e3c-1g96-4ed4-ad20-3081fe0f9545'); + $notifications = new Notifications($client); + $result = $notifications->get('f4b37e3c-1g96-4ed4-ad20-3081fe0f9545'); $this->assertInstanceOf('\AcquiaCloudApi\Response\NotificationResponse', $result); - foreach ($this->properties as $property) { $this->assertObjectHasAttribute($property, $result); } @@ -36,18 +39,17 @@ public function testGetNotification() public function testGetNotifications() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getNotifications.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Notifications/getAllNotifications.json'); $client = $this->getMockClient($response); /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->notifications('f027502b-ed6c-448e-97e8-4a0def7d25e1'); + $notifications = new Notifications($client); + $result = $notifications->getAll('f4b37e3c-1g96-4ed4-ad20-3081fe0f9545'); $this->assertInstanceOf('\AcquiaCloudApi\Response\NotificationsResponse', $result); $this->assertInstanceOf('\ArrayObject', $result); - foreach ($result as $record) { $this->assertInstanceOf('\AcquiaCloudApi\Response\NotificationResponse', $record); - foreach ($this->properties as $property) { $this->assertObjectHasAttribute($property, $record); } diff --git a/tests/Endpoints/OrganizationsTest.php b/tests/Endpoints/OrganizationsTest.php index 31a30123..08ef5aed 100644 --- a/tests/Endpoints/OrganizationsTest.php +++ b/tests/Endpoints/OrganizationsTest.php @@ -3,31 +3,68 @@ namespace AcquiaCloudApi\Tests\Endpoints; use AcquiaCloudApi\Tests\CloudApiTestCase; +use AcquiaCloudApi\Endpoints\Organizations; class OrganizationsTest extends CloudApiTestCase { - public $properties = [ - 'id', - 'uuid', - 'name', - 'owner', - 'subscriptions_total', - 'admins_total', - 'users_total', - 'teams_total', - 'roles_total', - 'links' + public $organizationProperties = [ + 'id', + 'uuid', + 'name', + 'owner', + 'subscriptions_total', + 'admins_total', + 'users_total', + 'teams_total', + 'roles_total', + 'links' + ]; + + public $invitationProperties = [ + 'uuid', + 'email', + 'author', + 'applications', + 'organization', + 'roles', + 'team', + 'created_at', + 'token', + 'flags', + 'links' + ]; + + protected $applicationProperties = [ + 'uuid', + 'name', + 'hosting', + 'subscription', + 'organization', + 'type', + 'flags', + 'status', + 'links' + ]; + + protected $teamProperties = [ + 'uuid', + 'name', + 'created_at', + 'updated_at', + 'organization', + 'links' ]; public function testGetOrganizations() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getOrganizations.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Organizations/getAllOrganizations.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->organizations(); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $organization = new Organizations($client); + $result = $organization->getAll(); $this->assertInstanceOf('\ArrayObject', $result); $this->assertInstanceOf('\AcquiaCloudApi\Response\OrganizationsResponse', $result); @@ -35,7 +72,7 @@ public function testGetOrganizations() foreach ($result as $record) { $this->assertInstanceOf('\AcquiaCloudApi\Response\OrganizationResponse', $record); - foreach ($this->properties as $property) { + foreach ($this->organizationProperties as $property) { $this->assertObjectHasAttribute($property, $record); } } @@ -43,14 +80,79 @@ public function testGetOrganizations() public function testCreateOrganizationAdminInvite() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/createOrganizationAdminInvite.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Organizations/inviteAdmin.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->createOrganizationAdminInvite('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', 'user@example.com'); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $organization = new Organizations($client); + $result = $organization->inviteAdmin('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', 'user@example.com'); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); $this->assertEquals('Invited organization administrator.', $result->message); } + + public function testGetOrganizationApplications() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Organizations/getApplications.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $organization = new Organizations($client); + $result = $organization->getApplications('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + + $this->assertInstanceOf('\ArrayObject', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\ApplicationsResponse', $result); + + foreach ($result as $record) { + $this->assertInstanceOf('\AcquiaCloudApi\Response\ApplicationResponse', $record); + + foreach ($this->applicationProperties as $property) { + $this->assertObjectHasAttribute($property, $record); + } + } + } + + public function testGetOrganizationTeams() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Organizations/getTeams.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $organization = new Organizations($client); + $result = $organization->getTeams('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + + $this->assertInstanceOf('\ArrayObject', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\TeamsResponse', $result); + + foreach ($result as $record) { + $this->assertInstanceOf('\AcquiaCloudApi\Response\TeamResponse', $record); + + foreach ($this->teamProperties as $property) { + $this->assertObjectHasAttribute($property, $record); + } + } + } + + public function testGetOrganizationInvitees() + { + + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Organizations/getMemberInvites.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $organization = new Organizations($client); + $result = $organization->getMemberInvitations('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + + $this->assertInstanceOf('\ArrayObject', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\InvitationsResponse', $result); + + foreach ($result as $record) { + $this->assertInstanceOf('\AcquiaCloudApi\Response\InvitationResponse', $record); + + foreach ($this->invitationProperties as $property) { + $this->assertObjectHasAttribute($property, $record); + } + } + } } diff --git a/tests/Endpoints/PermissionsTest.php b/tests/Endpoints/PermissionsTest.php index 718fd160..5c619f19 100644 --- a/tests/Endpoints/PermissionsTest.php +++ b/tests/Endpoints/PermissionsTest.php @@ -3,6 +3,7 @@ namespace AcquiaCloudApi\Tests\Endpoints; use AcquiaCloudApi\Tests\CloudApiTestCase; +use AcquiaCloudApi\Endpoints\Permissions; class PermissionsTest extends CloudApiTestCase { @@ -17,11 +18,12 @@ class PermissionsTest extends CloudApiTestCase public function testGetAllPermissions() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getPermissions.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Permissions/getPermissions.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->permissions(); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $permissions = new Permissions($client); + $result = $permissions->get(); $this->assertInstanceOf('\ArrayObject', $result); $this->assertInstanceOf('\AcquiaCloudApi\Response\PermissionsResponse', $result); diff --git a/tests/Endpoints/ProductionModeTest.php b/tests/Endpoints/ProductionModeTest.php index 7d0718f5..74bb1d3c 100644 --- a/tests/Endpoints/ProductionModeTest.php +++ b/tests/Endpoints/ProductionModeTest.php @@ -3,17 +3,19 @@ namespace AcquiaCloudApi\Tests\Endpoints; use AcquiaCloudApi\Tests\CloudApiTestCase; +use AcquiaCloudApi\Endpoints\Environments; class ProductionModeTest extends CloudApiTestCase { public function testProductionModeEnable() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/enableProductionMode.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Environments/enableProductionMode.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->enableProductionMode('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $environment = new Environments($client); + $result = $environment->enableProductionMode('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); @@ -22,11 +24,12 @@ public function testProductionModeEnable() public function testProductionModeDisable() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/disableProductionMode.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Environments/disableProductionMode.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->disableProductionMode('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $environment = new Environments($client); + $result = $environment->disableProductionMode('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); diff --git a/tests/Endpoints/RolesTest.php b/tests/Endpoints/RolesTest.php index 6b0bbd69..a1c0ec5c 100644 --- a/tests/Endpoints/RolesTest.php +++ b/tests/Endpoints/RolesTest.php @@ -3,6 +3,8 @@ namespace AcquiaCloudApi\Tests\Endpoints; use AcquiaCloudApi\Tests\CloudApiTestCase; +use AcquiaCloudApi\Endpoints\Organizations; +use AcquiaCloudApi\Endpoints\Roles; class RolesTest extends CloudApiTestCase { @@ -15,14 +17,31 @@ class RolesTest extends CloudApiTestCase 'permissions', ]; - public function testGetRoles() + public function testGetRole() { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Roles/getRole.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $roles = new Roles($client); + $result = $roles->get('8ff6c046-ec64-4ce4-bea6-27845ec18600'); + + $this->assertNotInstanceOf('\AcquiaCloudApi\Response\RolesResponse', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\RoleResponse', $result); - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getOrganizationRoles.json'); + foreach ($this->properties as $property) { + $this->assertObjectHasAttribute($property, $result); + } + } + + public function testGetRoles() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Roles/getAllRoles.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->organizationRoles('8ff6c046-ec64-4ce4-bea6-27845ec18600'); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $roles = new Roles($client); + $result = $roles->getAll('8ff6c046-ec64-4ce4-bea6-27845ec18600'); $this->assertInstanceOf('\ArrayObject', $result); $this->assertInstanceOf('\AcquiaCloudApi\Response\RolesResponse', $result); @@ -38,12 +57,12 @@ public function testGetRoles() public function testCreateRole() { - - $response = $this->getPsr7JsonResponseForFixture('Endpoints/addRole.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Roles/createRole.json'); $client = $this->getMockClient($response); /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->createRole( + $roles = new Roles($client); + $result = $roles->create( '8ff6c046-ec64-4ce4-bea6-27845ec18600', 'My new role', ['access cloud api', 'pull from prod'], @@ -56,12 +75,12 @@ public function testCreateRole() public function testDeleteRole() { - - $response = $this->getPsr7JsonResponseForFixture('Endpoints/deleteRole.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Roles/deleteRole.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->deleteRole('r47ac10b-58cc-4372-a567-0e02b2c3d470'); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $role = new Roles($client); + $result = $role->delete('r47ac10b-58cc-4372-a567-0e02b2c3d470'); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); $this->assertEquals('Deleted role.', $result->message); @@ -69,12 +88,12 @@ public function testDeleteRole() public function testUpdateRole() { - - $response = $this->getPsr7JsonResponseForFixture('Endpoints/updateRole.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Roles/updateRole.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->updateRole('r47ac10b-58cc-4372-a567-0e02b2c3d470', ['pull from prod']); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $role = new Roles($client); + $result = $role->update('r47ac10b-58cc-4372-a567-0e02b2c3d470', ['pull from prod']); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); $this->assertEquals('Updating role.', $result->message); diff --git a/tests/Endpoints/ServersTest.php b/tests/Endpoints/ServersTest.php index 5657e61f..ffcd129d 100644 --- a/tests/Endpoints/ServersTest.php +++ b/tests/Endpoints/ServersTest.php @@ -3,6 +3,7 @@ namespace AcquiaCloudApi\Tests\Endpoints; use AcquiaCloudApi\Tests\CloudApiTestCase; +use AcquiaCloudApi\Endpoints\Servers; class ServersTest extends CloudApiTestCase { @@ -23,11 +24,12 @@ class ServersTest extends CloudApiTestCase public function testGetServers() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getServers.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Servers/getAllServers.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->servers('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $servers = new Servers($client); + $result = $servers->getAll('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); $this->assertInstanceOf('\ArrayObject', $result); $this->assertInstanceOf('\AcquiaCloudApi\Response\ServersResponse', $result); @@ -40,4 +42,39 @@ public function testGetServers() } } } + + public function testGetServer() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Servers/getServer.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $server = new Servers($client); + $result = $server->get('8ff6c046-ec64-4ce4-bea6-27845ec18600', '3'); + + $this->assertNotInstanceOf('\AcquiaCloudApi\Response\ServersResponse', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\ServerResponse', $result); + + foreach ($this->properties as $property) { + $this->assertObjectHasAttribute($property, $result); + } + } + + public function testUpdateServer() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Servers/updateServer.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $server = new Servers($client); + $result = $server->update( + '8ff6c046-ec64-4ce4-bea6-27845ec18600', + '3', + ['memcache' => 128] + ); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + + $this->assertEquals('The server configuration is being updated.', $result->message); + } } diff --git a/tests/Endpoints/SslCertificatesTest.php b/tests/Endpoints/SslCertificatesTest.php new file mode 100644 index 00000000..2f433411 --- /dev/null +++ b/tests/Endpoints/SslCertificatesTest.php @@ -0,0 +1,126 @@ +getPsr7JsonResponseForFixture('Endpoints/SslCertificates/getAllSslCertificates.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $certificate = new SslCertificates($client); + $result = $certificate->getAll('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + + $this->assertInstanceOf('\ArrayObject', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\SslCertificatesResponse', $result); + + foreach ($result as $record) { + $this->assertInstanceOf('\AcquiaCloudApi\Response\SslCertificateResponse', $record); + + foreach ($this->properties as $property) { + $this->assertObjectHasAttribute($property, $record); + } + } + } + + public function testGetCertificate() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/SslCertificates/getSslCertificate.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $certificate = new SslCertificates($client); + $result = $certificate->get('8ff6c046-ec64-4ce4-bea6-27845ec18600', 3); + + $this->assertNotInstanceOf('\AcquiaCloudApi\Response\SslCertificatesResponse', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\SslCertificateResponse', $result); + + foreach ($this->properties as $property) { + $this->assertObjectHasAttribute($property, $result); + } + } + + public function testCreateSslCertificate() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/SslCertificates/createSslCertificate.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $certificate = new SslCertificates($client); + $result = $certificate->create( + '14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', + 'My New Cert', + '-----BEGIN CERTIFICATE-----abc123....-----END CERTIFICATE-----', + '-----BEGIN RSA PRIVATE KEY-----secret....-----END RSA PRIVATE KEY-----', + '-----BEGIN CERTIFICATE-----123abc....-----END CERTIFICATE-----', + 123, + false + ); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + + $this->assertEquals('Installing the certificate.', $result->message); + } + + public function testDeleteSslCertificate() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/SslCertificates/deleteSslCertificate.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $certificate = new SslCertificates($client); + $result = $certificate->delete('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', 14); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + + $this->assertEquals('Deleting the certificate.', $result->message); + } + + public function testActivateSslCertificate() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/SslCertificates/activateSslCertificate.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $certificate = new SslCertificates($client); + $result = $certificate->enable('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', 2); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + + $this->assertEquals('Activating the certificate.', $result->message); + } + + public function testDeactivateSslCertificate() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/SslCertificates/deactivateSslCertificate.json'); + $client = $this->getMockClient($response); + + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $certificate = new SslCertificates($client); + $result = $certificate->disable('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', 2); + + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + + $this->assertEquals('Deactivating the certificate.', $result->message); + } +} diff --git a/tests/Endpoints/TasksTest.php b/tests/Endpoints/TasksTest.php deleted file mode 100644 index a2d38a7e..00000000 --- a/tests/Endpoints/TasksTest.php +++ /dev/null @@ -1,68 +0,0 @@ -getPsr7JsonResponseForFixture('Endpoints/getTasks.json'); - $client = $this->getMockClient($response); - - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->tasks('8ff6c046-ec64-4ce4-bea6-27845ec18600'); - - $this->assertInstanceOf('\ArrayObject', $result); - $this->assertInstanceOf('\AcquiaCloudApi\Response\TasksResponse', $result); - - foreach ($result as $record) { - $this->assertInstanceOf('\AcquiaCloudApi\Response\TaskResponse', $record); - - foreach ($this->properties as $property) { - $this->assertObjectHasAttribute($property, $record); - } - } - } - - public function testGetFilteredTasks() - { - - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getFilteredTasks.json'); - $client = $this->getMockClient($response); - - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $client->addQuery('filter', 'name=@DatabaseBackupCreated'); - $result = $client->tasks('8ff6c046-ec64-4ce4-bea6-27845ec18600'); - $client->clearQuery(); - - $this->assertInstanceOf('\ArrayObject', $result); - $this->assertInstanceOf('\AcquiaCloudApi\Response\TasksResponse', $result); - - foreach ($result as $record) { - $this->assertInstanceOf('\AcquiaCloudApi\Response\TaskResponse', $record); - - foreach ($this->properties as $property) { - $this->assertObjectHasAttribute($property, $record); - } - } - } -} diff --git a/tests/Endpoints/TeamsTest.php b/tests/Endpoints/TeamsTest.php index c5086025..d8625e8c 100644 --- a/tests/Endpoints/TeamsTest.php +++ b/tests/Endpoints/TeamsTest.php @@ -3,11 +3,13 @@ namespace AcquiaCloudApi\Tests\Endpoints; use AcquiaCloudApi\Tests\CloudApiTestCase; +use AcquiaCloudApi\Endpoints\Organizations; +use AcquiaCloudApi\Endpoints\Teams; class TeamsTest extends CloudApiTestCase { - protected $properties = [ + protected $teamProperties = [ 'uuid', 'name', 'created_at', @@ -16,14 +18,27 @@ class TeamsTest extends CloudApiTestCase 'links' ]; + protected $applicationProperties = [ + 'uuid', + 'name', + 'hosting', + 'subscription', + 'organization', + 'type', + 'flags', + 'status', + 'links' + ]; + public function testGetTeams() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getTeams.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Teams/getAllTeams.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->teams(); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $team = new Teams($client); + $result = $team->getAll(); $this->assertInstanceOf('\ArrayObject', $result); $this->assertInstanceOf('\AcquiaCloudApi\Response\TeamsResponse', $result); @@ -31,7 +46,7 @@ public function testGetTeams() foreach ($result as $record) { $this->assertInstanceOf('\AcquiaCloudApi\Response\TeamResponse', $record); - foreach ($this->properties as $property) { + foreach ($this->teamProperties as $property) { $this->assertObjectHasAttribute($property, $record); } } @@ -39,11 +54,12 @@ public function testGetTeams() public function testCreateTeamInvite() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/createTeamInvite.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Teams/invite.json'); $client = $this->getMockClient($response); /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->createTeamInvite( + $team = new Teams($client); + $result = $team->invite( '14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', 'hello@example.com', ['access permissions', 'access servers'] @@ -56,11 +72,12 @@ public function testCreateTeamInvite() public function testCreateTeam() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/createTeam.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Teams/createTeam.json'); $client = $this->getMockClient($response); /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->createTeam('8ff6c046-ec64-4ce4-bea6-27845ec18600', 'Mega Team'); + $organization = new Teams($client); + $result = $organization->create('8ff6c046-ec64-4ce4-bea6-27845ec18600', 'Mega Team'); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); @@ -69,11 +86,12 @@ public function testCreateTeam() public function testRenameTeam() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/RenameTeam.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Teams/rename.json'); $client = $this->getMockClient($response); /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->renameTeam('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', 'My Cool Application'); + $team = new Teams($client); + $result = $team->rename('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', 'My Cool Application'); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); @@ -82,48 +100,53 @@ public function testRenameTeam() public function testDeleteTeam() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/DeleteTeam.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Teams/deleteTeam.json'); $client = $this->getMockClient($response); /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->deleteTeam('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + $team = new Teams($client); + $result = $team->delete('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); $this->assertEquals("Removed team.", $result->message); } - public function testGetOrganizationTeams() + public function testAddApplicationToTeam() { - - $response = $this->getPsr7JsonResponseForFixture('Endpoints/getOrganizationTeams.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Teams/addApplication.json'); $client = $this->getMockClient($response); /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->organizationTeams('8ff6c046-ec64-4ce4-bea6-27845ec18600'); - - $this->assertInstanceOf('\ArrayObject', $result); - $this->assertInstanceOf('\AcquiaCloudApi\Response\TeamsResponse', $result); + $team = new Teams($client); + $result = $team->addApplication( + '8ff6c046-ec64-4ce4-bea6-27845ec18600', + '14-0c7e79ab-1c4a-424e-8446-76ae8be7e851' + ); - foreach ($result as $record) { - $this->assertInstanceOf('\AcquiaCloudApi\Response\TeamResponse', $record); + $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); - foreach ($this->properties as $property) { - $this->assertObjectHasAttribute($property, $record); - } - } + $this->assertEquals('Added application to team.', $result->message); } - public function testAddApplicationToTeam() + public function testGetTeamApplications() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/addApplicationToTeam.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Teams/getApplications.json'); $client = $this->getMockClient($response); /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->addApplicationToTeam('8ff6c046-ec64-4ce4-bea6-27845ec18600', '14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); + $team = new Teams($client); + $result = $team->getApplications('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851'); - $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); + $this->assertInstanceOf('\ArrayObject', $result); + $this->assertInstanceOf('\AcquiaCloudApi\Response\ApplicationsResponse', $result); - $this->assertEquals('Added application to team.', $result->message); + foreach ($result as $record) { + $this->assertInstanceOf('\AcquiaCloudApi\Response\ApplicationResponse', $record); + + foreach ($this->applicationProperties as $property) { + $this->assertObjectHasAttribute($property, $record); + } + } } } diff --git a/tests/Endpoints/VarnishTest.php b/tests/Endpoints/VarnishTest.php index 8e04f295..b5585110 100644 --- a/tests/Endpoints/VarnishTest.php +++ b/tests/Endpoints/VarnishTest.php @@ -3,17 +3,22 @@ namespace AcquiaCloudApi\Tests\Endpoints; use AcquiaCloudApi\Tests\CloudApiTestCase; +use AcquiaCloudApi\Endpoints\Domains; class VarnishTest extends CloudApiTestCase { public function testPurgeVarnish() { - $response = $this->getPsr7JsonResponseForFixture('Endpoints/purgeVarnish.json'); + $response = $this->getPsr7JsonResponseForFixture('Endpoints/Domains/purgeVarnish.json'); $client = $this->getMockClient($response); - /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ - $result = $client->purgeVarnishCache('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', ['example.com', 'www.example.com']); + /** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */ + $domain = new Domains($client); + $result = $domain->purge( + '14-0c7e79ab-1c4a-424e-8446-76ae8be7e851', + ['example.com', 'www.example.com'] + ); $this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result); diff --git a/tests/Fixtures/Endpoints/getAccount.json b/tests/Fixtures/Endpoints/Account/getAccount.json similarity index 100% rename from tests/Fixtures/Endpoints/getAccount.json rename to tests/Fixtures/Endpoints/Account/getAccount.json diff --git a/tests/Fixtures/Endpoints/getDrushAliases.json b/tests/Fixtures/Endpoints/Account/getDrushAliases.json similarity index 100% rename from tests/Fixtures/Endpoints/getDrushAliases.json rename to tests/Fixtures/Endpoints/Account/getDrushAliases.json diff --git a/tests/Fixtures/Endpoints/Applications/createTag.json b/tests/Fixtures/Endpoints/Applications/createTag.json new file mode 100644 index 00000000..2488d1c6 --- /dev/null +++ b/tests/Fixtures/Endpoints/Applications/createTag.json @@ -0,0 +1,14 @@ +{ + "message": "The tag has been added to the application.", + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/applications/0d9fc48f-9871-41d9-8b41-0f815e6039eb/tags" + }, + "parent": { + "href": "https://cloud.acquia.com/api/applications/0d9fc48f-9871-41d9-8b41-0f815e6039eb" + }, + "notification": { + "href": "https://cloud.acquia.com/api/notifications/773fca86-9d87-45dc-9220-9ba38306bbb1" + } + } +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/Applications/deleteTag.json b/tests/Fixtures/Endpoints/Applications/deleteTag.json new file mode 100644 index 00000000..2f8d1276 --- /dev/null +++ b/tests/Fixtures/Endpoints/Applications/deleteTag.json @@ -0,0 +1,14 @@ +{ + "message": "The tag has been removed from the application.", + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/applications/0d9fc48f-9871-41d9-8b41-0f815e6039eb/tags/test_tag" + }, + "parent": { + "href": "https://cloud.acquia.com/api/applications/0d9fc48f-9871-41d9-8b41-0f815e6039eb/tags" + }, + "notification": { + "href": "https://cloud.acquia.com/api/notifications/37cdf705-9774-4526-9bf0-9feb279630ee" + } + } +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/getApplications.json b/tests/Fixtures/Endpoints/Applications/getAllApplications.json similarity index 100% rename from tests/Fixtures/Endpoints/getApplications.json rename to tests/Fixtures/Endpoints/Applications/getAllApplications.json diff --git a/tests/Fixtures/Endpoints/Applications/getAllTags.json b/tests/Fixtures/Endpoints/Applications/getAllTags.json new file mode 100644 index 00000000..5e626be9 --- /dev/null +++ b/tests/Fixtures/Endpoints/Applications/getAllTags.json @@ -0,0 +1,60 @@ +{ + "total": 1, + "pagination": { + "total": 1, + "limit": 1, + "offset": 0 + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/applications/185f07c7-9c4f-407b-8968-67892ebcb38a/tags" + }, + "parent": { + "href": "https://cloud.acquia.com/api/applications/185f07c7-9c4f-407b-8968-67892ebcb38a" + }, + "limit": { + "href": "https://cloud.acquia.com/api/applications/185f07c7-9c4f-407b-8968-67892ebcb38a/tags{?limit}", + "templated": true + }, + "offset": { + "href": "https://cloud.acquia.com/api/applications/185f07c7-9c4f-407b-8968-67892ebcb38a/tags{?offset}", + "templated": true + }, + "sort": { + "href": "https://cloud.acquia.com/api/applications/185f07c7-9c4f-407b-8968-67892ebcb38a/tags{?sort}", + "templated": true + }, + "filter": { + "href": "https://cloud.acquia.com/api/applications/185f07c7-9c4f-407b-8968-67892ebcb38a/tags{?filter}", + "templated": true + } + }, + "_embedded": { + "items": [ + { + "name": "Dev", + "color": "orange", + "context": { + "organization": { + "uuids": [ + "2375e327-3fff-11e3-9170-12313920a02c" + ] + }, + "application": { + "uuids": [ + "185f07c7-9c4f-407b-8968-67892ebcb38a" + ] + } + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/applications/2375e327-3fff-11e3-9170-12313920a02c/tags/dev" + }, + "parent": { + "href": "https://cloud.acquia.com/api/applications/2375e327-3fff-11e3-9170-12313920a02c/tags" + } + } + } + ] + } +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/getApplication.json b/tests/Fixtures/Endpoints/Applications/getApplication.json similarity index 100% rename from tests/Fixtures/Endpoints/getApplication.json rename to tests/Fixtures/Endpoints/Applications/getApplication.json diff --git a/tests/Fixtures/Endpoints/renameApplication.json b/tests/Fixtures/Endpoints/Applications/renameApplication.json similarity index 100% rename from tests/Fixtures/Endpoints/renameApplication.json rename to tests/Fixtures/Endpoints/Applications/renameApplication.json diff --git a/tests/Fixtures/Endpoints/getFilteredCode.json b/tests/Fixtures/Endpoints/Client/getFilteredCode.json similarity index 100% rename from tests/Fixtures/Endpoints/getFilteredCode.json rename to tests/Fixtures/Endpoints/Client/getFilteredCode.json diff --git a/tests/Fixtures/Endpoints/getFilteredTasks.json b/tests/Fixtures/Endpoints/Client/getFilteredTasks.json similarity index 100% rename from tests/Fixtures/Endpoints/getFilteredTasks.json rename to tests/Fixtures/Endpoints/Client/getFilteredTasks.json diff --git a/tests/Fixtures/Endpoints/deployCode.json b/tests/Fixtures/Endpoints/Code/deployCode.json similarity index 100% rename from tests/Fixtures/Endpoints/deployCode.json rename to tests/Fixtures/Endpoints/Code/deployCode.json diff --git a/tests/Fixtures/Endpoints/getCode.json b/tests/Fixtures/Endpoints/Code/getAllCode.json similarity index 100% rename from tests/Fixtures/Endpoints/getCode.json rename to tests/Fixtures/Endpoints/Code/getAllCode.json diff --git a/tests/Fixtures/Endpoints/switchCode.json b/tests/Fixtures/Endpoints/Code/switchCode.json similarity index 100% rename from tests/Fixtures/Endpoints/switchCode.json rename to tests/Fixtures/Endpoints/Code/switchCode.json diff --git a/tests/Fixtures/Endpoints/addCron.json b/tests/Fixtures/Endpoints/Crons/createCron.json similarity index 100% rename from tests/Fixtures/Endpoints/addCron.json rename to tests/Fixtures/Endpoints/Crons/createCron.json diff --git a/tests/Fixtures/Endpoints/deleteCron.json b/tests/Fixtures/Endpoints/Crons/deleteCron.json similarity index 100% rename from tests/Fixtures/Endpoints/deleteCron.json rename to tests/Fixtures/Endpoints/Crons/deleteCron.json diff --git a/tests/Fixtures/Endpoints/disableCron.json b/tests/Fixtures/Endpoints/Crons/disableCron.json similarity index 100% rename from tests/Fixtures/Endpoints/disableCron.json rename to tests/Fixtures/Endpoints/Crons/disableCron.json diff --git a/tests/Fixtures/Endpoints/enableCron.json b/tests/Fixtures/Endpoints/Crons/enableCron.json similarity index 100% rename from tests/Fixtures/Endpoints/enableCron.json rename to tests/Fixtures/Endpoints/Crons/enableCron.json diff --git a/tests/Fixtures/Endpoints/getCrons.json b/tests/Fixtures/Endpoints/Crons/getAllCrons.json similarity index 100% rename from tests/Fixtures/Endpoints/getCrons.json rename to tests/Fixtures/Endpoints/Crons/getAllCrons.json diff --git a/tests/Fixtures/Endpoints/getCron.json b/tests/Fixtures/Endpoints/Crons/getCron.json similarity index 100% rename from tests/Fixtures/Endpoints/getCron.json rename to tests/Fixtures/Endpoints/Crons/getCron.json diff --git a/tests/Fixtures/Endpoints/Crons/updateCron.json b/tests/Fixtures/Endpoints/Crons/updateCron.json new file mode 100644 index 00000000..a5c80a5d --- /dev/null +++ b/tests/Fixtures/Endpoints/Crons/updateCron.json @@ -0,0 +1,14 @@ +{ + "message": "Updating cron.", + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/286-f027502b-ed6c-448e-97e8-4a0def7d25e1/crons/2582" + }, + "parent": { + "href": "https://cloud.acquia.com/api/environments/286-f027502b-ed6c-448e-97e8-4a0def7d25e1/crons" + }, + "notification": { + "href": "https://cloud.acquia.com/api/notifications/ba232d96-dfe7-4850-9ca7-02e01a04f58d" + } + } + } \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/backupDatabases.json b/tests/Fixtures/Endpoints/DatabaseBackups/createDatabaseBackup.json similarity index 100% rename from tests/Fixtures/Endpoints/backupDatabases.json rename to tests/Fixtures/Endpoints/DatabaseBackups/createDatabaseBackup.json diff --git a/tests/Fixtures/Endpoints/getDatabaseBackups.json b/tests/Fixtures/Endpoints/DatabaseBackups/getAllDatabaseBackups.json similarity index 100% rename from tests/Fixtures/Endpoints/getDatabaseBackups.json rename to tests/Fixtures/Endpoints/DatabaseBackups/getAllDatabaseBackups.json diff --git a/tests/Fixtures/Endpoints/getDatabaseBackup.json b/tests/Fixtures/Endpoints/DatabaseBackups/getDatabaseBackup.json similarity index 100% rename from tests/Fixtures/Endpoints/getDatabaseBackup.json rename to tests/Fixtures/Endpoints/DatabaseBackups/getDatabaseBackup.json diff --git a/tests/Fixtures/Endpoints/restoreDatabaseBackup.json b/tests/Fixtures/Endpoints/DatabaseBackups/restoreDatabaseBackup.json similarity index 100% rename from tests/Fixtures/Endpoints/restoreDatabaseBackup.json rename to tests/Fixtures/Endpoints/DatabaseBackups/restoreDatabaseBackup.json diff --git a/tests/Fixtures/Endpoints/copyDatabases.json b/tests/Fixtures/Endpoints/Databases/copyDatabases.json similarity index 100% rename from tests/Fixtures/Endpoints/copyDatabases.json rename to tests/Fixtures/Endpoints/Databases/copyDatabases.json diff --git a/tests/Fixtures/Endpoints/createDatabases.json b/tests/Fixtures/Endpoints/Databases/createDatabases.json similarity index 100% rename from tests/Fixtures/Endpoints/createDatabases.json rename to tests/Fixtures/Endpoints/Databases/createDatabases.json diff --git a/tests/Fixtures/Endpoints/deleteDatabases.json b/tests/Fixtures/Endpoints/Databases/deleteDatabases.json similarity index 100% rename from tests/Fixtures/Endpoints/deleteDatabases.json rename to tests/Fixtures/Endpoints/Databases/deleteDatabases.json diff --git a/tests/Fixtures/Endpoints/getDatabases.json b/tests/Fixtures/Endpoints/Databases/getAllDatabases.json similarity index 100% rename from tests/Fixtures/Endpoints/getDatabases.json rename to tests/Fixtures/Endpoints/Databases/getAllDatabases.json diff --git a/tests/Fixtures/Endpoints/addDomain.json b/tests/Fixtures/Endpoints/Domains/createDomain.json similarity index 100% rename from tests/Fixtures/Endpoints/addDomain.json rename to tests/Fixtures/Endpoints/Domains/createDomain.json diff --git a/tests/Fixtures/Endpoints/deleteDomain.json b/tests/Fixtures/Endpoints/Domains/deleteDomain.json similarity index 100% rename from tests/Fixtures/Endpoints/deleteDomain.json rename to tests/Fixtures/Endpoints/Domains/deleteDomain.json diff --git a/tests/Fixtures/Endpoints/getDomains.json b/tests/Fixtures/Endpoints/Domains/getAllDomains.json similarity index 100% rename from tests/Fixtures/Endpoints/getDomains.json rename to tests/Fixtures/Endpoints/Domains/getAllDomains.json diff --git a/tests/Fixtures/Endpoints/getDomain.json b/tests/Fixtures/Endpoints/Domains/getDomain.json similarity index 100% rename from tests/Fixtures/Endpoints/getDomain.json rename to tests/Fixtures/Endpoints/Domains/getDomain.json diff --git a/tests/Fixtures/Endpoints/Domains/getDomainMetrics.json b/tests/Fixtures/Endpoints/Domains/getDomainMetrics.json new file mode 100644 index 00000000..4c3857b9 --- /dev/null +++ b/tests/Fixtures/Endpoints/Domains/getDomainMetrics.json @@ -0,0 +1,49 @@ +{ + "total": 2, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/399-b48d4745-ee0c-102e-8305-1231390f2cc1/domains/example.com/metrics/uptime" + }, + "domain": { + "href": "https://cloud.acquia.com/api/environments/399-b48d4745-ee0c-102e-8305-1231390f2cc1/domains/example.com" + } + }, + "_embedded": { + "items": [ + { + "metric": "timeout_partial_scans", + "datapoints": [ + [ + 1, + 1449679507 + ], + [ + 1, + 1449686707 + ] + ], + "last_data_at": null, + "metadata": { + "host": "example.com" + } + }, + { + "metric": "ok_scans", + "datapoints": [ + [ + 123.1, + 1449678507 + ], + [ + 134.2, + 1449688707 + ] + ], + "last_data_at": null, + "metadata": { + "host": "example.com" + } + } + ] + } +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/Domains/getDomainStatus.json b/tests/Fixtures/Endpoints/Domains/getDomainStatus.json new file mode 100644 index 00000000..d62903ad --- /dev/null +++ b/tests/Fixtures/Endpoints/Domains/getDomainStatus.json @@ -0,0 +1,27 @@ +{ + "hostname": "example.com", + "flags": { + "default": false, + "active": true, + "dns_resolves": true, + "acquia_hosted": true + }, + "ip_addresses": [ + "12.23.34.45" + ], + "cnames": [ + "another.example.com" + ], + "environment": { + "id": "24-a47ac10b-58cc-4372-a567-0e02b2c3d470", + "name": "dev" + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/24-a47ac10b-58cc-4372-a567-0e02b2c3d470/domains/example.com/status" + }, + "parent": { + "href": "https://cloud.acquia.com/api/environments/24-a47ac10b-58cc-4372-a567-0e02b2c3d470/domains/example.com" + } + } +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/purgeVarnish.json b/tests/Fixtures/Endpoints/Domains/purgeVarnish.json similarity index 100% rename from tests/Fixtures/Endpoints/purgeVarnish.json rename to tests/Fixtures/Endpoints/Domains/purgeVarnish.json diff --git a/tests/Fixtures/Endpoints/copyFiles.json b/tests/Fixtures/Endpoints/Environments/copyFiles.json similarity index 100% rename from tests/Fixtures/Endpoints/copyFiles.json rename to tests/Fixtures/Endpoints/Environments/copyFiles.json diff --git a/tests/Fixtures/Endpoints/Environments/createCDEnvironment.json b/tests/Fixtures/Endpoints/Environments/createCDEnvironment.json new file mode 100644 index 00000000..68b9a2ff --- /dev/null +++ b/tests/Fixtures/Endpoints/Environments/createCDEnvironment.json @@ -0,0 +1,14 @@ +{ + "message": "Adding an environment.", + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/applications/896f142a-2c14-45ff-9b1f-41bcb2b5de8d/environments" + }, + "notification": { + "href": "https://cloud.acquia.com/api/notifications/23d9184d-40b8-4f21-a3d5-416aef9bcd39" + }, + "parent": { + "href": "https://cloud.acquia.com/api/applications/896f142a-2c14-45ff-9b1f-41bcb2b5de8d/environments" + } + } +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/Environments/deleteCDEnvironment.json b/tests/Fixtures/Endpoints/Environments/deleteCDEnvironment.json new file mode 100644 index 00000000..65e541b5 --- /dev/null +++ b/tests/Fixtures/Endpoints/Environments/deleteCDEnvironment.json @@ -0,0 +1,11 @@ +{ + "message": "The environment is being deleted.", + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/123-f027502b-ed6c-448e-97e8-4a0def7d25e1" + }, + "notification": { + "href": "https://cloud.acquia.com/api/notifications/6992a41d-a953-4ded-ae99-41d2f4d62f69" + } + } +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/disableLiveDev.json b/tests/Fixtures/Endpoints/Environments/disableLiveDev.json similarity index 100% rename from tests/Fixtures/Endpoints/disableLiveDev.json rename to tests/Fixtures/Endpoints/Environments/disableLiveDev.json diff --git a/tests/Fixtures/Endpoints/disableProductionMode.json b/tests/Fixtures/Endpoints/Environments/disableProductionMode.json similarity index 100% rename from tests/Fixtures/Endpoints/disableProductionMode.json rename to tests/Fixtures/Endpoints/Environments/disableProductionMode.json diff --git a/tests/Fixtures/Endpoints/enableLiveDev.json b/tests/Fixtures/Endpoints/Environments/enableLiveDev.json similarity index 100% rename from tests/Fixtures/Endpoints/enableLiveDev.json rename to tests/Fixtures/Endpoints/Environments/enableLiveDev.json diff --git a/tests/Fixtures/Endpoints/enableProductionMode.json b/tests/Fixtures/Endpoints/Environments/enableProductionMode.json similarity index 100% rename from tests/Fixtures/Endpoints/enableProductionMode.json rename to tests/Fixtures/Endpoints/Environments/enableProductionMode.json diff --git a/tests/Fixtures/Endpoints/getEnvironments.json b/tests/Fixtures/Endpoints/Environments/getAllEnvironments.json similarity index 100% rename from tests/Fixtures/Endpoints/getEnvironments.json rename to tests/Fixtures/Endpoints/Environments/getAllEnvironments.json diff --git a/tests/Fixtures/Endpoints/getEnvironment.json b/tests/Fixtures/Endpoints/Environments/getEnvironment.json similarity index 100% rename from tests/Fixtures/Endpoints/getEnvironment.json rename to tests/Fixtures/Endpoints/Environments/getEnvironment.json diff --git a/tests/Fixtures/Endpoints/renameEnvironment.json b/tests/Fixtures/Endpoints/Environments/renameEnvironment.json similarity index 100% rename from tests/Fixtures/Endpoints/renameEnvironment.json rename to tests/Fixtures/Endpoints/Environments/renameEnvironment.json diff --git a/tests/Fixtures/Endpoints/modifyEnvironment.json b/tests/Fixtures/Endpoints/Environments/updateEnvironment.json similarity index 100% rename from tests/Fixtures/Endpoints/modifyEnvironment.json rename to tests/Fixtures/Endpoints/Environments/updateEnvironment.json diff --git a/tests/Fixtures/Endpoints/error403.json b/tests/Fixtures/Endpoints/Error/error403.json similarity index 100% rename from tests/Fixtures/Endpoints/error403.json rename to tests/Fixtures/Endpoints/Error/error403.json diff --git a/tests/Fixtures/Endpoints/error404.json b/tests/Fixtures/Endpoints/Error/error404.json similarity index 100% rename from tests/Fixtures/Endpoints/error404.json rename to tests/Fixtures/Endpoints/Error/error404.json diff --git a/tests/Fixtures/Endpoints/Error/multipleErrors.json b/tests/Fixtures/Endpoints/Error/multipleErrors.json new file mode 100644 index 00000000..e0688be0 --- /dev/null +++ b/tests/Fixtures/Endpoints/Error/multipleErrors.json @@ -0,0 +1,7 @@ +{ + "error": "multiple_errors", + "message": [ + "The application you are trying to access does not exist, or you do not have permission to access it.", + "You do not have sufficient permissions to do this task." + ] +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/IdentityProviders/deleteIdentityProvider.json b/tests/Fixtures/Endpoints/IdentityProviders/deleteIdentityProvider.json new file mode 100644 index 00000000..2817cc18 --- /dev/null +++ b/tests/Fixtures/Endpoints/IdentityProviders/deleteIdentityProvider.json @@ -0,0 +1,3 @@ +{ + "message": "Identity provider has been deleted." +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/IdentityProviders/disableIdentityProvider.json b/tests/Fixtures/Endpoints/IdentityProviders/disableIdentityProvider.json new file mode 100644 index 00000000..531e3e79 --- /dev/null +++ b/tests/Fixtures/Endpoints/IdentityProviders/disableIdentityProvider.json @@ -0,0 +1,3 @@ +{ + "message": "Identity Provider has been disabled." +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/IdentityProviders/enableIdentityProvider.json b/tests/Fixtures/Endpoints/IdentityProviders/enableIdentityProvider.json new file mode 100644 index 00000000..47920340 --- /dev/null +++ b/tests/Fixtures/Endpoints/IdentityProviders/enableIdentityProvider.json @@ -0,0 +1,3 @@ +{ + "message": "Identity Provider has been enabled." +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/IdentityProviders/getAllIdentityProviders.json b/tests/Fixtures/Endpoints/IdentityProviders/getAllIdentityProviders.json new file mode 100644 index 00000000..7428c974 --- /dev/null +++ b/tests/Fixtures/Endpoints/IdentityProviders/getAllIdentityProviders.json @@ -0,0 +1,76 @@ +{ + "total": 2, + "pagination": { + "total": 2, + "limit": 2, + "offset": 0 + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/identity-providers" + }, + "parent": { + "href": "https://cloud.acquia.com/api/" + }, + "filter": { + "href": "https://cloud.acquia.com/api/identity-providers{?filter}", + "templated": true + }, + "sort": { + "href": "https://cloud.acquia.com/api/identity-providers{?sort}", + "templated": true + }, + "limit": { + "href": "https://cloud.acquia.com/api/identity-providers{?limit}", + "templated": true + }, + "offset": { + "href": "https://cloud.acquia.com/api/identity-providers{?offset}", + "templated": true + } + }, + "_embedded": { + "items": [ + { + "uuid": "5fa84b25-a269-44bd-a2ae-e76d08ac8245", + "label": "Identity provider label", + "idp_entity_id": "https://idp.example.com/saml", + "sp_entity_id": "https://sp.example.com/saml", + "sso_url": "https://example.com/sso", + "certificate": "-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----", + "status": "enabled", + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/identity-providers/5fa84b25-a269-44bd-a2ae-e76d08ac8245" + }, + "parent": { + "href": "https://cloud.acquia.com/api/identity-providers" + }, + "acs": { + "href": "https://accounts.acquia.com/api/auth/saml/acs/5fa84b25-a269-44bd-a2ae-e76d08ac8245" + } + } + }, + { + "uuid": "908914ec-2354-4fb1-9298-637247eccc3a", + "label": "Identity provider label 2", + "idp_entity_id": "https://idp2.example.com/saml", + "sp_entity_id": "https://sp2.example.com/saml", + "sso_url": "https://example.com/sso", + "certificate": "-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----", + "status": "enabled", + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/identity-providers/908914ec-2354-4fb1-9298-637247eccc3a" + }, + "parent": { + "href": "https://cloud.acquia.com/api/identity-providers" + }, + "acs": { + "href": "https://accounts.acquia.com/api/auth/saml/acs/908914ec-2354-4fb1-9298-637247eccc3a" + } + } + } + ] + } +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/IdentityProviders/getIdentityProvider.json b/tests/Fixtures/Endpoints/IdentityProviders/getIdentityProvider.json new file mode 100644 index 00000000..9a91e07a --- /dev/null +++ b/tests/Fixtures/Endpoints/IdentityProviders/getIdentityProvider.json @@ -0,0 +1,20 @@ +{ + "uuid": "1bc5dbb4-6d59-403b-afc7-777e520aaa40", + "label": "Test identity provider", + "idp_entity_id": "https://idp.example.com/saml", + "sp_entity_id": "https://sp.example.com/saml", + "sso_url": "https://example.com/sso", + "certificate": "-----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----", + "status": "enabled", + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/identity-providers/1bc5dbb4-6d59-403b-afc7-777e520aaa40" + }, + "parent": { + "href": "https://cloud.acquia.com/api/identity-providers" + }, + "acs": { + "href": "https://accounts.acquia.com/api/auth/saml/acs/1bc5dbb4-6d59-403b-afc7-777e520aaa40" + } + } +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/IdentityProviders/updateIdentityProvider.json b/tests/Fixtures/Endpoints/IdentityProviders/updateIdentityProvider.json new file mode 100644 index 00000000..5780acef --- /dev/null +++ b/tests/Fixtures/Endpoints/IdentityProviders/updateIdentityProvider.json @@ -0,0 +1,3 @@ +{ + "message": "Identity Provider has been updated." +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/Ides/createIde.json b/tests/Fixtures/Endpoints/Ides/createIde.json new file mode 100644 index 00000000..afe62434 --- /dev/null +++ b/tests/Fixtures/Endpoints/Ides/createIde.json @@ -0,0 +1,14 @@ +{ + "message": "The remote IDE is being created.", + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/ides/1792767d-1ee3-4b5f-83a8-334dfdc2b8a3" + }, + "parent": { + "href": "https://cloud.acquia.com/api/ides" + }, + "notification": { + "href": "https://cloud.acquia.com/api/notifications/e47da6d7-371e-4bb9-a7fe-d9ab8aa899c3" + } + } +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/Ides/deleteIde.json b/tests/Fixtures/Endpoints/Ides/deleteIde.json new file mode 100644 index 00000000..bd472d76 --- /dev/null +++ b/tests/Fixtures/Endpoints/Ides/deleteIde.json @@ -0,0 +1,14 @@ +{ + "message": "The remote IDE is being deleted.", + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/ides/215824ff-272a-4a8c-9027-df32ed1d68a9" + }, + "parent": { + "href": "https://cloud.acquia.com/api/ides" + }, + "notification": { + "href": "https://cloud.acquia.com/api/notifications/e98577df-840a-4fef-8775-66cf90b3530e" + } + } +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/Ides/getAllIdes.json b/tests/Fixtures/Endpoints/Ides/getAllIdes.json new file mode 100644 index 00000000..c044816e --- /dev/null +++ b/tests/Fixtures/Endpoints/Ides/getAllIdes.json @@ -0,0 +1,36 @@ +{ + "total": 1, + "_links": { + "self": { + "href": "{baseUri}/applications/24-a47ac10b-58cc-4372-a567-0e02b2c3d470/ides" + }, + "parent": { + "href": "{baseUri}/applications/24-a47ac10b-58cc-4372-a567-0e02b2c3d470" + } + }, + "_embedded": { + "items": [ + { + "uuid": "215824ff-272a-4a8c-9027-df32ed1d68a9", + "label": "Example IDE", + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/ides/215824ff-272a-4a8c-9027-df32ed1d68a9" + }, + "parent": { + "href": "https://cloud.acquia.com/api/ides" + }, + "application": { + "href": "https://cloud.acquia.com/api/applications/461fe350-7988-42b3-a73e-cffcdbb94199" + }, + "web": { + "href": "https://ide-215824ff-272a-4a8c-9027-df32ed1d68a9.prod.acquia-sites.com" + }, + "ide": { + "href": "https://215824ff-272a-4a8c-9027-df32ed1d68a9.ides.acquia.com" + } + } + } + ] + } +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/Ides/getIde.json b/tests/Fixtures/Endpoints/Ides/getIde.json new file mode 100644 index 00000000..0201fef6 --- /dev/null +++ b/tests/Fixtures/Endpoints/Ides/getIde.json @@ -0,0 +1,21 @@ +{ + "uuid": "215824ff-272a-4a8c-9027-df32ed1d68a9", + "label": "Example IDE", + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/ides/215824ff-272a-4a8c-9027-df32ed1d68a9" + }, + "parent": { + "href": "https://cloud.acquia.com/api/ides" + }, + "application": { + "href": "https://cloud.acquia.com/api/applications/461fe350-7988-42b3-a73e-cffcdbb94199" + }, + "web": { + "href": "https://ide-215824ff-272a-4a8c-9027-df32ed1d68a9.prod.acquia-sites.com" + }, + "ide": { + "href": "https://215824ff-272a-4a8c-9027-df32ed1d68a9.ides.acquia.com" + } + } +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/Insights/getAlert.json b/tests/Fixtures/Endpoints/Insights/getAlert.json new file mode 100644 index 00000000..4f89a2af --- /dev/null +++ b/tests/Fixtures/Endpoints/Insights/getAlert.json @@ -0,0 +1,30 @@ +{ + "alert_id": 40, + "uuid": "a47ac10b-58cc-4372-a567-0e02b2c3d470", + "name": "PHP errors visible", + "message": "

Your website is configured to display PHP error messages to users. These error messages can reveal sensitive information about your website and its server to site visitors.

", + "article_link": "https://docs.acquia.com/acquia-cloud/insight/alerts/", + "severity": 8, + "severity_label": "WARNING", + "failed_value": "display_errors", + "fix_details": "

To suppress the error messages, edit your settings.php file.

", + "categories": [ + "insight", + "security" + ], + "flags": { + "ignored": false, + "cleared": false, + "resolved": false, + "pass_hide": false, + "free_tier_hide": true + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/insight/d97bd970-3c0f-102f-a581-1231390f9c94/alerts/a47ac10b-58cc-4372-a567-0e02b2c3d470" + }, + "parent": { + "href": "https://cloud.acquia.com/api/insight/d97bd970-3c0f-102f-a581-1231390f9c94/alerts" + } + } +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/Insights/getAllAlerts.json b/tests/Fixtures/Endpoints/Insights/getAllAlerts.json new file mode 100644 index 00000000..d33dc726 --- /dev/null +++ b/tests/Fixtures/Endpoints/Insights/getAllAlerts.json @@ -0,0 +1,54 @@ +{ + "total": 0, + "_links": [ + { + "href": "string" + } + ], + "_embedded": { + "items": [ + { + "alert_id": 0, + "uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6", + "name": "string", + "message": "string", + "article_link": "string", + "severity": 0, + "severity_label": "string", + "failed_value": "string", + "fix_details": "string", + "categories": { + "value": "insight" + }, + "flags": { + "additionalProp1": { + "ignored": true, + "cleared": true, + "resolved": true, + "pass_hide": true, + "free_tier_hide": true + }, + "additionalProp2": { + "ignored": true, + "cleared": true, + "resolved": true, + "pass_hide": true, + "free_tier_hide": true + }, + "additionalProp3": { + "ignored": true, + "cleared": true, + "resolved": true, + "pass_hide": true, + "free_tier_hide": true + } + }, + "_links": [ + { + "href": "string" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/getInsights.json b/tests/Fixtures/Endpoints/Insights/getAllInsights.json similarity index 100% rename from tests/Fixtures/Endpoints/getInsights.json rename to tests/Fixtures/Endpoints/Insights/getAllInsights.json diff --git a/tests/Fixtures/Endpoints/Insights/getInsight.json b/tests/Fixtures/Endpoints/Insights/getInsight.json new file mode 100644 index 00000000..e453d9b6 --- /dev/null +++ b/tests/Fixtures/Endpoints/Insights/getInsight.json @@ -0,0 +1,56 @@ +{ + "uuid": "abcdefgh-1234-ijkl-5678-mnopqrstuvwx", + "label": "Test Site: prod", + "hostname": "test.example.com", + "status": "ok", + "updated_at": "2011-03-28T13:28:00-05:00", + "last_connected_at": "2011-03-28T13:11:00-05:00", + "scores": { + "insight": "62", + "seo": "15" + }, + "counts": { + "best_practices": { + "pass": 5, + "fail": 1, + "ignored": 0, + "total": 6, + "percent": 83 + }, + "performance": { + "pass": 9, + "fail": 10, + "ignored": 0, + "total": 19, + "percent": 47 + }, + "security": { + "pass": 10, + "fail": 10, + "ignored": 0, + "total": 20, + "percent": 50 + } + }, + "flags": { + "acquia_hosted": true, + "revoked": true + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/insight/site_id" + }, + "alerts": { + "href": "https://cloud.acquia.com/api/insight/site_id/alerts" + }, + "connection-history": { + "href": "https://cloud.acquia.com/api/insight/site_id/connection-history" + }, + "modules": { + "href": "https://cloud.acquia.com/api/insight/site_id/modules" + }, + "score-history": { + "href": "https://cloud.acquia.com/api/insight/site_id/score-history" + } + } + } \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/Insights/getModules.json b/tests/Fixtures/Endpoints/Insights/getModules.json new file mode 100644 index 00000000..0790636b --- /dev/null +++ b/tests/Fixtures/Endpoints/Insights/getModules.json @@ -0,0 +1,71 @@ +{ + "total": 3, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/insight/site_id/modules" + }, + "parent": { + "href": "https://cloud.acquia.com/api/insight/site_id" + } + }, + "_embedded": { + "items": [ + { + "module_id": 2, + "name": "Acquia agent", + "filename": "sites/all/modules/acquia_connector/acquia_agent/acquia_agent.module", + "version": "7.x-3.0-alpha1", + "supported_majors": "2,1", + "recommended_major": "2", + "package": "Acquia Connector", + "core": "7.x", + "project": "acquia_connector", + "release_date": "2015-11-17T14:08:59-0500", + "flags": { + "enabled": true + }, + "tags": [ + "contrib", + "upgradeable", + "bugfix" + ] + }, + { + "module_id": 7, + "name": "Aggregator", + "filename": "modules/aggregator/aggregator.module", + "version": "7.50", + "supported_majors": null, + "recommended_major": null, + "package": "Core", + "core": "7.x", + "project": "drupal", + "release_date": null, + "flags": { + "enabled": false + }, + "tags": [ + "core" + ] + }, + { + "module_id": 141, + "name": "A Custom Module", + "filename": "sites/all/modules/custom_module/custom_module.module", + "version": "", + "supported_majors": null, + "recommended_major": null, + "package": "Custom Module", + "core": "7.x", + "project": "", + "release_date": null, + "flags": { + "enabled": false + }, + "tags": [ + "custom" + ] + } + ] + } +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/Insights/ignoreAlert.json b/tests/Fixtures/Endpoints/Insights/ignoreAlert.json new file mode 100644 index 00000000..e10fb30f --- /dev/null +++ b/tests/Fixtures/Endpoints/Insights/ignoreAlert.json @@ -0,0 +1,3 @@ +{ + "message": "Alert ignored." +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/Insights/restoreAlert.json b/tests/Fixtures/Endpoints/Insights/restoreAlert.json new file mode 100644 index 00000000..8da39c61 --- /dev/null +++ b/tests/Fixtures/Endpoints/Insights/restoreAlert.json @@ -0,0 +1,3 @@ +{ + "message": "Alert restored." +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/Insights/revokeSite.json b/tests/Fixtures/Endpoints/Insights/revokeSite.json new file mode 100644 index 00000000..334ec530 --- /dev/null +++ b/tests/Fixtures/Endpoints/Insights/revokeSite.json @@ -0,0 +1,3 @@ +{ + "message": "Site revoked from submitting Insight score data." +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/Insights/unrevokeSite.json b/tests/Fixtures/Endpoints/Insights/unrevokeSite.json new file mode 100644 index 00000000..e99324d3 --- /dev/null +++ b/tests/Fixtures/Endpoints/Insights/unrevokeSite.json @@ -0,0 +1,3 @@ +{ + "message": "Site un-revoked." +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/LogForwarding/createLogForwarding.json b/tests/Fixtures/Endpoints/LogForwarding/createLogForwarding.json new file mode 100644 index 00000000..94e0d7f6 --- /dev/null +++ b/tests/Fixtures/Endpoints/LogForwarding/createLogForwarding.json @@ -0,0 +1,3 @@ +{ + "message": "Log forwarding destination for the environment has been created." +} diff --git a/tests/Fixtures/Endpoints/LogForwarding/deleteLogForwarding.json b/tests/Fixtures/Endpoints/LogForwarding/deleteLogForwarding.json new file mode 100644 index 00000000..9da53604 --- /dev/null +++ b/tests/Fixtures/Endpoints/LogForwarding/deleteLogForwarding.json @@ -0,0 +1,3 @@ +{ + "message": "Log forwarding destination has been deleted." +} diff --git a/tests/Fixtures/Endpoints/LogForwarding/disableLogForwarding.json b/tests/Fixtures/Endpoints/LogForwarding/disableLogForwarding.json new file mode 100644 index 00000000..e73bb103 --- /dev/null +++ b/tests/Fixtures/Endpoints/LogForwarding/disableLogForwarding.json @@ -0,0 +1,3 @@ +{ + "message": "Log forwarding destination has been disabled." +} diff --git a/tests/Fixtures/Endpoints/LogForwarding/enableLogForwarding.json b/tests/Fixtures/Endpoints/LogForwarding/enableLogForwarding.json new file mode 100644 index 00000000..e0302328 --- /dev/null +++ b/tests/Fixtures/Endpoints/LogForwarding/enableLogForwarding.json @@ -0,0 +1,3 @@ +{ + "message": "Log forwarding destination has been enabled." +} diff --git a/tests/Fixtures/Endpoints/LogForwarding/getAllLogForwarding.json b/tests/Fixtures/Endpoints/LogForwarding/getAllLogForwarding.json new file mode 100644 index 00000000..5b6669a4 --- /dev/null +++ b/tests/Fixtures/Endpoints/LogForwarding/getAllLogForwarding.json @@ -0,0 +1,79 @@ +{ + "total": 2, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/5-185f07c7-9c4f-407b-8968-67892ebcb38a/log-forwarding-destinations" + }, + "parent": { + "href": "https://cloud.acquia.com/api/environments/5-185f07c7-9c4f-407b-8968-67892ebcb38a" + } + }, + "_embedded": { + "items": [ + { + "uuid": "df4c5428-8d2e-453d-9edf-e412647449b1", + "label": "Test destination", + "consumer": "sumologic", + "address": "example.com:1234", + "credentials": { + "certificate": { + "certificate": "-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----", + "expires_at": "2018-07-16T16:15:33+00:00" + }, + "key": null, + "token": "204d892b449026f6e4ded264c8891c400df8fc8905f07beb5f70d706f6d4d5e5" + }, + "sources": [ + "apache-access", + "apache-error" + ], + "status": "active", + "flags": { + "enabled": true, + "certificate_expiring": false + }, + "health": { + "code": "200", + "details": "Destination OK", + "summary": "OK" + }, + "environment": { + "id": "123-ea9060c5-1ed8-46ec-87d5-2ce2a0861577", + "name": "Test" + } + }, + { + "uuid": "df4c5428-8d2e-453d-9edf-e412647449b5", + "label": "Another test destination", + "consumer": "syslog", + "address": "193.169.2.19:5678", + "credentials": { + "certificate": { + "certificate": "-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----", + "expires_at": "2018-07-16T16:15:33+00:00" + }, + "key": "1d0789d519c0b943cf38f401d30ffbdcd2e0c4cfb7c32ebc0c872bce62aadd4d", + "token": "204d892b449026f6e4ded264c8891c400df8fc8905f07beb5f70d706f6d4d5e5" + }, + "sources": [ + "drupal-request", + "drupal-watchdog" + ], + "status": "active", + "flags": { + "enabled": false, + "certificate_expiring": true + }, + "health": { + "code": "200", + "details": "Destination OK", + "summary": "OK" + }, + "environment": { + "id": "123-ea9060c5-1ed8-46ec-87d5-2ce2a0861577", + "name": "Test" + } + } + ] + } +} diff --git a/tests/Fixtures/Endpoints/LogForwarding/getLogForwarding.json b/tests/Fixtures/Endpoints/LogForwarding/getLogForwarding.json new file mode 100644 index 00000000..1b40bd64 --- /dev/null +++ b/tests/Fixtures/Endpoints/LogForwarding/getLogForwarding.json @@ -0,0 +1,32 @@ +{ + "uuid": "df4c5428-8d2e-453d-9edf-e412647449b1", + "label": "Test destination", + "address": "example.com:1234", + "consumer": "syslog", + "credentials": { + "certificate": { + "certificate": "-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----", + "expires_at": "2018-07-16T16:15:33+00:00" + }, + "key": "1d0789d519c0b943cf38f401d30ffbdcd2e0c4cfb7c32ebc0c872bce62aadd4d", + "token": "204d892b449026f6e4ded264c8891c400df8fc8905f07beb5f70d706f6d4d5e5" + }, + "sources": [ + "apache-access", + "apache-error" + ], + "status": "active", + "flags": { + "enabled": true, + "certificate_expiring": false + }, + "health": { + "code": "200", + "details": "Destination OK", + "summary": "OK" + }, + "environment": { + "id": "123-ea9060c5-1ed8-46ec-87d5-2ce2a0861577", + "name": "Test" + } +} diff --git a/tests/Fixtures/Endpoints/LogForwarding/updateLogForwarding.json b/tests/Fixtures/Endpoints/LogForwarding/updateLogForwarding.json new file mode 100644 index 00000000..3f29036e --- /dev/null +++ b/tests/Fixtures/Endpoints/LogForwarding/updateLogForwarding.json @@ -0,0 +1,3 @@ +{ + "message": "Log forwarding destination has been updated." +} diff --git a/tests/Fixtures/Endpoints/Logs/createLogSnapshot.json b/tests/Fixtures/Endpoints/Logs/createLogSnapshot.json new file mode 100644 index 00000000..fcbfe656 --- /dev/null +++ b/tests/Fixtures/Endpoints/Logs/createLogSnapshot.json @@ -0,0 +1,3 @@ +{ + "message": "The log file is being created." +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/Logs/downloadLog.json b/tests/Fixtures/Endpoints/Logs/downloadLog.json new file mode 100644 index 00000000..990e3e12 Binary files /dev/null and b/tests/Fixtures/Endpoints/Logs/downloadLog.json differ diff --git a/tests/Fixtures/Endpoints/Logs/getAllLogs.json b/tests/Fixtures/Endpoints/Logs/getAllLogs.json new file mode 100644 index 00000000..0a89dac3 --- /dev/null +++ b/tests/Fixtures/Endpoints/Logs/getAllLogs.json @@ -0,0 +1,87 @@ +{ + "total": 6, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/24-0c7e79ab-1c4a-424e-8446-76ae8be7e851/logs" + }, + "parent": { + "href": "https://cloud.acquia.com/api/environments/24-0c7e79ab-1c4a-424e-8446-76ae8be7e851" + } + }, + "_embedded": { + "items": [ + { + "type": "apache-access", + "label": "Apache access", + "flags": { + "available": false + }, + "_links": { + "download": { + "href": "https://cloud.acquia.com/api/environments/24-0c7e79ab-1c4a-424e-8446-76ae8be7e851/logs/apache-access" + } + } + }, + { + "type": "apache-error", + "label": "Apache error", + "flags": { + "available": false + }, + "_links": { + "download": { + "href": "https://cloud.acquia.com/api/environments/24-0c7e79ab-1c4a-424e-8446-76ae8be7e851/logs/apache-error" + } + } + }, + { + "type": "drupal-request", + "label": "Drupal request", + "flags": { + "available": false + }, + "_links": { + "download": { + "href": "https://cloud.acquia.com/api/environments/24-0c7e79ab-1c4a-424e-8446-76ae8be7e851/logs/drupal-request" + } + } + }, + { + "type": "drupal-watchdog", + "label": "Drupal watchdog", + "flags": { + "available": false + }, + "_links": { + "download": { + "href": "https://cloud.acquia.com/api/environments/24-0c7e79ab-1c4a-424e-8446-76ae8be7e851/logs/drupal-watchdog" + } + } + }, + { + "type": "php-error", + "label": "PHP error", + "flags": { + "available": false + }, + "_links": { + "download": { + "href": "https://cloud.acquia.com/api/environments/24-0c7e79ab-1c4a-424e-8446-76ae8be7e851/logs/php-error" + } + } + }, + { + "type": "mysql-slow-query", + "label": "MySQL slow query", + "flags": { + "available": true + }, + "_links": { + "download": { + "href": "https://cloud.acquia.com/api/environments/24-0c7e79ab-1c4a-424e-8446-76ae8be7e851/logs/mysql-slow-query" + } + } + } + ] + } +} diff --git a/tests/Fixtures/Endpoints/getLogstream.json b/tests/Fixtures/Endpoints/Logs/getLogstream.json similarity index 100% rename from tests/Fixtures/Endpoints/getLogstream.json rename to tests/Fixtures/Endpoints/Logs/getLogstream.json diff --git a/tests/Fixtures/Endpoints/Metrics/getAggregateData.json b/tests/Fixtures/Endpoints/Metrics/getAggregateData.json new file mode 100644 index 00000000..54e31e02 --- /dev/null +++ b/tests/Fixtures/Endpoints/Metrics/getAggregateData.json @@ -0,0 +1,101 @@ +{ + "total": 2, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/applications/1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/data" + }, + "parent": { + "href": "https://cloud.acquia.com/api/applications/1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage" + }, + "filter": { + "href": "https://cloud.acquia.com/api/applications/1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/data{?filter}", + "templated": true + } + }, + "_embedded": { + "items": [ + { + "metric": "views", + "datapoints": [ + [ + "2019-03-13T00:00:00+00:00", + "9" + ], + [ + "2019-03-14T00:00:00+00:00", + "1" + ] + ], + "last_data_at": "2019-03-14T00:00:00+00:00", + "metadata": { + "subscription": { + "uuids": [ + "9567a611-4cdd-4586-8b3f-f3980a87e471" + ] + }, + "application": { + "uuids": [ + "1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + }, + "environment": { + "ids": [ + "123-1df8bff7-ffda-4571-b64a-f90f60f4dbf8", + "124-1df8bff7-ffda-4571-b64a-f90f60f4dbf8", + "125-1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + } + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/applications/1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/views" + }, + "parent": { + "href": "https://cloud.acquia.com/api/applications/1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage" + } + } + }, + { + "metric": "visits", + "datapoints": [ + [ + "2019-03-13T00:00:00+00:00", + "3" + ], + [ + "2019-03-14T00:00:00+00:00", + "1" + ] + ], + "last_data_at": "2019-03-14T00:00:00+00:00", + "metadata": { + "subscription": { + "uuids": [ + "9567a611-4cdd-4586-8b3f-f3980a87e471" + ] + }, + "application": { + "uuids": [ + "1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + }, + "environment": { + "ids": [ + "123-1df8bff7-ffda-4571-b64a-f90f60f4dbf8", + "124-1df8bff7-ffda-4571-b64a-f90f60f4dbf8", + "125-1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + } + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/applications/1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/visits" + }, + "parent": { + "href": "https://cloud.acquia.com/api/applications/1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage" + } + } + } + ] + } +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/Metrics/getAggregateUsageMetrics.json b/tests/Fixtures/Endpoints/Metrics/getAggregateUsageMetrics.json new file mode 100644 index 00000000..87929673 --- /dev/null +++ b/tests/Fixtures/Endpoints/Metrics/getAggregateUsageMetrics.json @@ -0,0 +1,41 @@ +{ + "metric": "views", + "datapoints": [ + [ + "2019-03-13T00:00:00+00:00", + "9" + ], + [ + "2019-03-14T00:00:00+00:00", + "1" + ] + ], + "last_data_at": "2019-03-14T00:00:00+00:00", + "metadata": { + "subscription": { + "uuids": [ + "9567a611-4cdd-4586-8b3f-f3980a87e471" + ] + }, + "application": { + "uuids": [ + "1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + }, + "environment": { + "ids": [ + "123-1df8bff7-ffda-4571-b64a-f90f60f4dbf8", + "124-1df8bff7-ffda-4571-b64a-f90f60f4dbf8", + "125-1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + } + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/applications/1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/views" + }, + "parent": { + "href": "https://cloud.acquia.com/api/applications/1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage" + } + } +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/Metrics/getDataByEnvironment.json b/tests/Fixtures/Endpoints/Metrics/getDataByEnvironment.json new file mode 100644 index 00000000..5c9f011a --- /dev/null +++ b/tests/Fixtures/Endpoints/Metrics/getDataByEnvironment.json @@ -0,0 +1,230 @@ +{ + "total": 6, + "pagination": { + "total": 6, + "limit": 6, + "offset": 0 + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/applications/1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/data-by-environment" + }, + "parent": { + "href": "https://cloud.acquia.com/api/applications/1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage" + }, + "limit": { + "href": "https://cloud.acquia.com/api/applications/1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/data-by-environment{?limit}", + "templated": true + }, + "offset": { + "href": "https://cloud.acquia.com/api/applications/1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/data-by-environment{?offset}", + "templated": true + }, + "filter": { + "href": "https://cloud.acquia.com/api/applications/1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/data-by-environment{?filter}", + "templated": true + } + }, + "_embedded": { + "items": [ + { + "metric": "views", + "datapoints": [], + "last_data_at": null, + "metadata": { + "subscription": { + "uuids": [ + "9567a611-4cdd-4586-8b3f-f3980a87e471" + ] + }, + "application": { + "uuids": [ + "1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + }, + "environment": { + "ids": [ + "123-1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + } + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/123-1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/views" + }, + "parent": { + "href": "https://cloud.acquia.com/api/environments/123-1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage" + } + } + }, + { + "metric": "visits", + "datapoints": [], + "last_data_at": null, + "metadata": { + "subscription": { + "uuids": [ + "9567a611-4cdd-4586-8b3f-f3980a87e471" + ] + }, + "application": { + "uuids": [ + "1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + }, + "environment": { + "ids": [ + "123-1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + } + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/123-1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/visits" + }, + "parent": { + "href": "https://cloud.acquia.com/api/environments/123-1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage" + } + } + }, + { + "metric": "views", + "datapoints": [ + [ + "2019-03-13T00:00:00+00:00", + "9" + ], + [ + "2019-03-14T00:00:00+00:00", + "1" + ] + ], + "last_data_at": "2019-03-14T00:00:00+00:00", + "metadata": { + "subscription": { + "uuids": [ + "9567a611-4cdd-4586-8b3f-f3980a87e471" + ] + }, + "application": { + "uuids": [ + "1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + }, + "environment": { + "ids": [ + "124-1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + } + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/124-1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/views" + }, + "parent": { + "href": "https://cloud.acquia.com/api/environments/124-1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage" + } + } + }, + { + "metric": "visits", + "datapoints": [ + [ + "2019-03-13T00:00:00+00:00", + "3" + ], + [ + "2019-03-14T00:00:00+00:00", + "1" + ] + ], + "last_data_at": "2019-03-14T00:00:00+00:00", + "metadata": { + "subscription": { + "uuids": [ + "9567a611-4cdd-4586-8b3f-f3980a87e471" + ] + }, + "application": { + "uuids": [ + "1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + }, + "environment": { + "ids": [ + "124-1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + } + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/124-1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/visits" + }, + "parent": { + "href": "https://cloud.acquia.com/api/environments/124-1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage" + } + } + }, + { + "metric": "views", + "datapoints": [], + "last_data_at": null, + "metadata": { + "subscription": { + "uuids": [ + "9567a611-4cdd-4586-8b3f-f3980a87e471" + ] + }, + "application": { + "uuids": [ + "1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + }, + "environment": { + "ids": [ + "125-1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + } + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/125-1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/views" + }, + "parent": { + "href": "https://cloud.acquia.com/api/environments/125-1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage" + } + } + }, + { + "metric": "visits", + "datapoints": [], + "last_data_at": null, + "metadata": { + "subscription": { + "uuids": [ + "9567a611-4cdd-4586-8b3f-f3980a87e471" + ] + }, + "application": { + "uuids": [ + "1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + }, + "environment": { + "ids": [ + "125-1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + } + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/125-1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/visits" + }, + "parent": { + "href": "https://cloud.acquia.com/api/environments/125-1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage" + } + } + } + ] + } +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/Metrics/getStackMetricsData.json b/tests/Fixtures/Endpoints/Metrics/getStackMetricsData.json new file mode 100644 index 00000000..bda1348a --- /dev/null +++ b/tests/Fixtures/Endpoints/Metrics/getStackMetricsData.json @@ -0,0 +1,112 @@ +{ + "total": 4, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/24-a47ac10b-58cc-4372-a567-0e02b2c3d470/metrics/stackmetrics/data?filter=metric=db_cpu,metric=web_cpu&from=2019-06-20" + } + }, + "_embedded": { + "items": [ + { + "metric": "db-cpu", + "datapoints": [ + [ + 2.5395360194838, + 1447876380 + ], + [ + 3.3012513318685, + 1447876680 + ], + [ + 4.568567607842, + 1447876980 + ] + ], + "metadata": { + "host": "fsdb-1.prod.hosting.acquia.com" + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/18-185f07c7-9c4f-407b-8968-67892ebcb38a/metrics/stackmetrics/db-cpu" + } + } + }, + { + "metric": "db-cpu", + "datapoints": [ + [ + 22.1395360194838, + 1447876380 + ], + [ + 23.7012513318685, + 1447876680 + ], + [ + 24.168567607842, + 1447876980 + ] + ], + "metadata": { + "host": "fsdb-2.prod.hosting.acquia.com" + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/18-185f07c7-9c4f-407b-8968-67892ebcb38a/metrics/stackmetrics/db-cpu" + } + } + }, + { + "metric": "web-cpu", + "datapoints": [ + [ + 12.1395360194838, + 1447876380 + ], + [ + 12.7012513318685, + 1447876680 + ], + [ + 12.168567607842, + 1447876980 + ] + ], + "metadata": { + "host": "web-1.prod.hosting.acquia.com" + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/18-185f07c7-9c4f-407b-8968-67892ebcb38a/metrics/stackmetrics/web-cpu" + } + } + }, + { + "metric": "web-cpu", + "datapoints": [ + [ + 2.1395360194838, + 1447876380 + ], + [ + 2.7012513318685, + 1447876680 + ], + [ + 2.168567607842, + 1447876980 + ] + ], + "metadata": { + "host": "web-2.prod.hosting.acquia.com" + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/18-185f07c7-9c4f-407b-8968-67892ebcb38a/metrics/stackmetrics/web-cpu" + } + } + } + ] + } + } \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/Metrics/getStackMetricsDataByMetric.json b/tests/Fixtures/Endpoints/Metrics/getStackMetricsDataByMetric.json new file mode 100644 index 00000000..50374dc3 --- /dev/null +++ b/tests/Fixtures/Endpoints/Metrics/getStackMetricsDataByMetric.json @@ -0,0 +1,65 @@ +{ + "metric": "web-cpu", + "datapoints": [ + [ + 2.1395360194838, + 1447876380 + ], + [ + 2.7012513318685, + 1447876680 + ], + [ + 2.168567607842, + 1447876980 + ], + [ + 2.1622800487923, + 1447877280 + ], + [ + 2.3537085976764, + 1447877580 + ], + [ + 2.1784819708111, + 1447877880 + ], + [ + 2.1094592966954, + 1447878180 + ], + [ + 2.2565573988922, + 1447878480 + ], + [ + 2.1432396948143, + 1447878780 + ], + [ + 2.1021371063676, + 1447879080 + ], + [ + 2.1395397154601, + 1447879380 + ], + [ + 2.1010243649772, + 1447879680 + ] + ], + "last_data_at": null, + "metadata": { + "host": null + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/18-185f07c7-9c4f-407b-8968-67892ebcb38a/metrics/stackmetrics/web-cpu" + }, + "parent": { + "href": "https://cloud.acquia.com/api/environments/18-185f07c7-9c4f-407b-8968-67892ebcb38a/metrics/stackmetrics" + } + } + } \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/Metrics/getViewsByEnvironment.json b/tests/Fixtures/Endpoints/Metrics/getViewsByEnvironment.json new file mode 100644 index 00000000..dc68276f --- /dev/null +++ b/tests/Fixtures/Endpoints/Metrics/getViewsByEnvironment.json @@ -0,0 +1,131 @@ +{ + "total": 3, + "pagination": { + "total": 3, + "limit": 3, + "offset": 0 + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/applications/1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/views-by-environment" + }, + "parent": { + "href": "https://cloud.acquia.com/api/applications/1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage" + }, + "limit": { + "href": "https://cloud.acquia.com/api/applications/1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/views-by-environment{?limit}", + "templated": true + }, + "offset": { + "href": "https://cloud.acquia.com/api/applications/1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/views-by-environment{?offset}", + "templated": true + }, + "filter": { + "href": "https://cloud.acquia.com/api/applications/1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/views-by-environment{?filter}", + "templated": true + } + }, + "_embedded": { + "items": [ + { + "metric": "views", + "datapoints": [], + "last_data_at": null, + "metadata": { + "subscription": { + "uuids": [ + "9567a611-4cdd-4586-8b3f-f3980a87e471" + ] + }, + "application": { + "uuids": [ + "1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + }, + "environment": { + "ids": [ + "123-1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + } + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/123-1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/views" + }, + "parent": { + "href": "https://cloud.acquia.com/api/environments/123-1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage" + } + } + }, + { + "metric": "views", + "datapoints": [ + [ + "2019-03-13T00:00:00+00:00", + "9" + ], + [ + "2019-03-14T00:00:00+00:00", + "1" + ] + ], + "last_data_at": "2019-03-14T00:00:00+00:00", + "metadata": { + "subscription": { + "uuids": [ + "9567a611-4cdd-4586-8b3f-f3980a87e471" + ] + }, + "application": { + "uuids": [ + "1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + }, + "environment": { + "ids": [ + "124-1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + } + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/124-1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/views" + }, + "parent": { + "href": "https://cloud.acquia.com/api/environments/124-1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage" + } + } + }, + { + "metric": "views", + "datapoints": [], + "last_data_at": null, + "metadata": { + "subscription": { + "uuids": [ + "9567a611-4cdd-4586-8b3f-f3980a87e471" + ] + }, + "application": { + "uuids": [ + "1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + }, + "environment": { + "ids": [ + "125-1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + } + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/125-1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/views" + }, + "parent": { + "href": "https://cloud.acquia.com/api/environments/125-1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage" + } + } + } + ] + } +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/Metrics/getVisitsByEnvironment.json b/tests/Fixtures/Endpoints/Metrics/getVisitsByEnvironment.json new file mode 100644 index 00000000..d9785a5a --- /dev/null +++ b/tests/Fixtures/Endpoints/Metrics/getVisitsByEnvironment.json @@ -0,0 +1,131 @@ +{ + "total": 3, + "pagination": { + "total": 3, + "limit": 3, + "offset": 0 + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/applications/1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/visits-by-environment" + }, + "parent": { + "href": "https://cloud.acquia.com/api/applications/1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage" + }, + "limit": { + "href": "https://cloud.acquia.com/api/applications/1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/visits-by-environment{?limit}", + "templated": true + }, + "offset": { + "href": "https://cloud.acquia.com/api/applications/1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/visits-by-environment{?offset}", + "templated": true + }, + "filter": { + "href": "https://cloud.acquia.com/api/applications/1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/visits-by-environment{?filter}", + "templated": true + } + }, + "_embedded": { + "items": [ + { + "metric": "visits", + "datapoints": [], + "last_data_at": null, + "metadata": { + "subscription": { + "uuids": [ + "9567a611-4cdd-4586-8b3f-f3980a87e471" + ] + }, + "application": { + "uuids": [ + "1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + }, + "environment": { + "ids": [ + "123-1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + } + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/123-1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/visits" + }, + "parent": { + "href": "https://cloud.acquia.com/api/environments/123-1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage" + } + } + }, + { + "metric": "visits", + "datapoints": [ + [ + "2019-03-13T00:00:00+00:00", + "3" + ], + [ + "2019-03-14T00:00:00+00:00", + "1" + ] + ], + "last_data_at": "2019-03-14T00:00:00+00:00", + "metadata": { + "subscription": { + "uuids": [ + "9567a611-4cdd-4586-8b3f-f3980a87e471" + ] + }, + "application": { + "uuids": [ + "1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + }, + "environment": { + "ids": [ + "124-1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + } + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/124-1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/visits" + }, + "parent": { + "href": "https://cloud.acquia.com/api/environments/124-1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage" + } + } + }, + { + "metric": "visits", + "datapoints": [], + "last_data_at": null, + "metadata": { + "subscription": { + "uuids": [ + "9567a611-4cdd-4586-8b3f-f3980a87e471" + ] + }, + "application": { + "uuids": [ + "1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + }, + "environment": { + "ids": [ + "125-1df8bff7-ffda-4571-b64a-f90f60f4dbf8" + ] + } + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/125-1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage/visits" + }, + "parent": { + "href": "https://cloud.acquia.com/api/environments/125-1df8bff7-ffda-4571-b64a-f90f60f4dbf8/metrics/usage" + } + } + } + ] + } +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/getNotifications.json b/tests/Fixtures/Endpoints/Notifications/getAllNotifications.json similarity index 99% rename from tests/Fixtures/Endpoints/getNotifications.json rename to tests/Fixtures/Endpoints/Notifications/getAllNotifications.json index 024148d0..7c00dd05 100644 --- a/tests/Fixtures/Endpoints/getNotifications.json +++ b/tests/Fixtures/Endpoints/Notifications/getAllNotifications.json @@ -59,4 +59,4 @@ } ] } - } \ No newline at end of file + } diff --git a/tests/Fixtures/Endpoints/getNotification.json b/tests/Fixtures/Endpoints/Notifications/getNotification.json similarity index 99% rename from tests/Fixtures/Endpoints/getNotification.json rename to tests/Fixtures/Endpoints/Notifications/getNotification.json index 32138a59..73ffdade 100644 --- a/tests/Fixtures/Endpoints/getNotification.json +++ b/tests/Fixtures/Endpoints/Notifications/getNotification.json @@ -66,4 +66,4 @@ "username": "jane.doe" } } -} \ No newline at end of file +} diff --git a/tests/Fixtures/Endpoints/deleteMember.json b/tests/Fixtures/Endpoints/Organizations/deleteMember.json similarity index 100% rename from tests/Fixtures/Endpoints/deleteMember.json rename to tests/Fixtures/Endpoints/Organizations/deleteMember.json diff --git a/tests/Fixtures/Endpoints/getOrganizations.json b/tests/Fixtures/Endpoints/Organizations/getAllOrganizations.json similarity index 100% rename from tests/Fixtures/Endpoints/getOrganizations.json rename to tests/Fixtures/Endpoints/Organizations/getAllOrganizations.json diff --git a/tests/Fixtures/Endpoints/getOrganizationApplications.json b/tests/Fixtures/Endpoints/Organizations/getApplications.json similarity index 100% rename from tests/Fixtures/Endpoints/getOrganizationApplications.json rename to tests/Fixtures/Endpoints/Organizations/getApplications.json diff --git a/tests/Fixtures/Endpoints/getOrganizationInvitees.json b/tests/Fixtures/Endpoints/Organizations/getMemberInvites.json similarity index 100% rename from tests/Fixtures/Endpoints/getOrganizationInvitees.json rename to tests/Fixtures/Endpoints/Organizations/getMemberInvites.json diff --git a/tests/Fixtures/Endpoints/getOrganizationMembers.json b/tests/Fixtures/Endpoints/Organizations/getMembers.json similarity index 100% rename from tests/Fixtures/Endpoints/getOrganizationMembers.json rename to tests/Fixtures/Endpoints/Organizations/getMembers.json diff --git a/tests/Fixtures/Endpoints/getOrganizationTeams.json b/tests/Fixtures/Endpoints/Organizations/getTeams.json similarity index 100% rename from tests/Fixtures/Endpoints/getOrganizationTeams.json rename to tests/Fixtures/Endpoints/Organizations/getTeams.json diff --git a/tests/Fixtures/Endpoints/createOrganizationAdminInvite.json b/tests/Fixtures/Endpoints/Organizations/inviteAdmin.json similarity index 100% rename from tests/Fixtures/Endpoints/createOrganizationAdminInvite.json rename to tests/Fixtures/Endpoints/Organizations/inviteAdmin.json diff --git a/tests/Fixtures/Endpoints/getPermissions.json b/tests/Fixtures/Endpoints/Permissions/getPermissions.json similarity index 100% rename from tests/Fixtures/Endpoints/getPermissions.json rename to tests/Fixtures/Endpoints/Permissions/getPermissions.json diff --git a/tests/Fixtures/Endpoints/addRole.json b/tests/Fixtures/Endpoints/Roles/createRole.json similarity index 100% rename from tests/Fixtures/Endpoints/addRole.json rename to tests/Fixtures/Endpoints/Roles/createRole.json diff --git a/tests/Fixtures/Endpoints/deleteRole.json b/tests/Fixtures/Endpoints/Roles/deleteRole.json similarity index 100% rename from tests/Fixtures/Endpoints/deleteRole.json rename to tests/Fixtures/Endpoints/Roles/deleteRole.json diff --git a/tests/Fixtures/Endpoints/getOrganizationRoles.json b/tests/Fixtures/Endpoints/Roles/getAllRoles.json similarity index 100% rename from tests/Fixtures/Endpoints/getOrganizationRoles.json rename to tests/Fixtures/Endpoints/Roles/getAllRoles.json diff --git a/tests/Fixtures/Endpoints/Roles/getRole.json b/tests/Fixtures/Endpoints/Roles/getRole.json new file mode 100644 index 00000000..4173bd49 --- /dev/null +++ b/tests/Fixtures/Endpoints/Roles/getRole.json @@ -0,0 +1,49 @@ +{ + "uuid": "c885728d-cbbe-4e54-bf09-19b751b6d0c7", + "name": "My Custom Role", + "description": "Some details about my custom role.", + "permissions": [ + { + "name": "deploy to non-prod", + "label": "Pull and deploy code, files, or databases to non-production environments", + "description": "Grants the ability to enable or disable live development and non-production work.", + "group_label": "Workflow" + }, + { + "name": "configure non-prod env", + "label": "Configure non-production environments", + "description": null, + "group_label": "Workflow" + }, + { + "name": "download logs non-prod", + "label": "Download logs for non-production environments", + "description": null, + "group_label": "Logs" + }, + { + "name": "view database connection", + "label": "View database connection details (username, password, or hostname)", + "description": null, + "group_label": "Databases" + } + ], + "organization": { + "uuid": "d122cc06-35bd-41bf-9baa-5b770c8ca0f1", + "name": "My Organization" + }, + "last_edited": { + "edited_at": "2011-03-28T13:09:41-04:00", + "user": { + "uuid": "590909a0-e819-43e6-a8e3-212dc3e35852", + "first_name": "Jane", + "last_name": "Doe", + "mail": "jane.doe@example.com", + "picture_url": "https://accounts.acquia.com/sites/default/files/avatars/123abc?mail=jane.doe@example.com", + "username": "jane.doe" + } + }, + "flags": { + "default": false + } + } \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/updateRole.json b/tests/Fixtures/Endpoints/Roles/updateRole.json similarity index 100% rename from tests/Fixtures/Endpoints/updateRole.json rename to tests/Fixtures/Endpoints/Roles/updateRole.json diff --git a/tests/Fixtures/Endpoints/getServers.json b/tests/Fixtures/Endpoints/Servers/getAllServers.json similarity index 100% rename from tests/Fixtures/Endpoints/getServers.json rename to tests/Fixtures/Endpoints/Servers/getAllServers.json diff --git a/tests/Fixtures/Endpoints/Servers/getServer.json b/tests/Fixtures/Endpoints/Servers/getServer.json new file mode 100644 index 00000000..4efbee37 --- /dev/null +++ b/tests/Fixtures/Endpoints/Servers/getServer.json @@ -0,0 +1,45 @@ +{ + "id": "6", + "name": "ded-6", + "hostname": "ded-6.servers.acquia.com", + "ssh_user": "user.dev", + "ip": "10.0.0.1", + "status": "normal", + "region": "us-west-1", + "roles": [ + "web", + "db" + ], + "ami_type": "c1.medium", + "operating_system": "xenial", + "configuration": { + "memcache": 64, + "ecu": 5, + "memory": 1.7 + }, + "flags": { + "elastic_ip": false, + "active_web": true, + "active_bal": false, + "primary_db": true, + "web": true, + "database": true, + "balancer": false, + "fs": false, + "memcache": true, + "dedicated": false, + "self_service": false + }, + "environment": { + "id": "24-a47ac10b-58cc-4372-a567-0e02b2c3d470", + "name": "dev" + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/24-a47ac10b-58cc-4372-a567-0e02b2c3d470/servers/6" + }, + "parent": { + "href": "https://cloud.acquia.com/api/environments/24-a47ac10b-58cc-4372-a567-0e02b2c3d470" + } + } + } \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/Servers/updateServer.json b/tests/Fixtures/Endpoints/Servers/updateServer.json new file mode 100644 index 00000000..08e0c5cb --- /dev/null +++ b/tests/Fixtures/Endpoints/Servers/updateServer.json @@ -0,0 +1,3 @@ +{ + "message": "The server configuration is being updated." +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/SslCertificates/activateSslCertificate.json b/tests/Fixtures/Endpoints/SslCertificates/activateSslCertificate.json new file mode 100644 index 00000000..fcc94146 --- /dev/null +++ b/tests/Fixtures/Endpoints/SslCertificates/activateSslCertificate.json @@ -0,0 +1,3 @@ +{ + "message": "Activating the certificate." +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/SslCertificates/createSslCertificate.json b/tests/Fixtures/Endpoints/SslCertificates/createSslCertificate.json new file mode 100644 index 00000000..75692534 --- /dev/null +++ b/tests/Fixtures/Endpoints/SslCertificates/createSslCertificate.json @@ -0,0 +1,3 @@ +{ + "message": "Installing the certificate." +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/SslCertificates/deactivateSslCertificate.json b/tests/Fixtures/Endpoints/SslCertificates/deactivateSslCertificate.json new file mode 100644 index 00000000..63b9d7eb --- /dev/null +++ b/tests/Fixtures/Endpoints/SslCertificates/deactivateSslCertificate.json @@ -0,0 +1,3 @@ +{ + "message": "Deactivating the certificate." +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/SslCertificates/deleteSslCertificate.json b/tests/Fixtures/Endpoints/SslCertificates/deleteSslCertificate.json new file mode 100644 index 00000000..ecec66e2 --- /dev/null +++ b/tests/Fixtures/Endpoints/SslCertificates/deleteSslCertificate.json @@ -0,0 +1,3 @@ +{ + "message": "Deleting the certificate." +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/SslCertificates/getAllSslCertificates.json b/tests/Fixtures/Endpoints/SslCertificates/getAllSslCertificates.json new file mode 100644 index 00000000..d7ec3c37 --- /dev/null +++ b/tests/Fixtures/Endpoints/SslCertificates/getAllSslCertificates.json @@ -0,0 +1,96 @@ +{ + "total": 3, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/5-a1a10dab-62f4-418c-bc58-ab7742078ba8/ssl/certificates" + }, + "parent": { + "href": "https://cloud.acquia.com/api/environments/5-a1a10dab-62f4-418c-bc58-ab7742078ba8/ssl" + } + }, + "_embedded": { + "items": [ + { + "id": 7, + "label": null, + "certificate": "-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----", + "private_key": null, + "ca": "-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----", + "flags": { + "active": true, + "csr": true, + "legacy": true + }, + "expires_at": "2022-03-28T00:12:34-0400", + "domains": [ + "example.com", + "www.example.com" + ], + "environment": { + "id": "5-a1a10dab-62f4-418c-bc58-ab7742078ba8", + "name": "prod" + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/5-a1a10dab-62f4-418c-bc58-ab7742078ba8/ssl/certificates/7" + }, + "csr": { + "href": "https://cloud.acquia.com/api/environments/5-a1a10dab-62f4-418c-bc58-ab7742078ba8/ssl/csrs/7" + } + } + }, + { + "id": 3, + "label": "Test Certificate 1", + "certificate": "-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----", + "private_key": "-----BEGIN RSA PRIVATE KEY-----...-----END RSA PRIVATE KEY-----", + "ca": "-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----", + "flags": { + "active": true, + "csr": false, + "legacy": false + }, + "expires_at": "2022-03-28T00:12:34-0400", + "domains": [ + "example.com", + "www.example.com" + ], + "environment": { + "id": "5-a1a10dab-62f4-418c-bc58-ab7742078ba8", + "name": "prod" + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/5-a1a10dab-62f4-418c-bc58-ab7742078ba8/ssl/certificates/3" + } + } + }, + { + "id": 4, + "label": "Test Certificate 2", + "certificate": "-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----", + "private_key": "-----BEGIN RSA PRIVATE KEY-----...-----END RSA PRIVATE KEY-----", + "ca": "-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----", + "flags": { + "active": false, + "csr": true, + "legacy": false + }, + "expires_at": "2022-03-28T00:12:34-0400", + "domains": [ + "example.com", + "www.example.com" + ], + "environment": { + "id": "5-a1a10dab-62f4-418c-bc58-ab7742078ba8", + "name": "prod" + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/5-a1a10dab-62f4-418c-bc58-ab7742078ba8/ssl/certificates/4" + } + } + } + ] + } + } \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/SslCertificates/getSslCertificate.json b/tests/Fixtures/Endpoints/SslCertificates/getSslCertificate.json new file mode 100644 index 00000000..b5525195 --- /dev/null +++ b/tests/Fixtures/Endpoints/SslCertificates/getSslCertificate.json @@ -0,0 +1,29 @@ +{ + "id": 13, + "label": "Test Certificate", + "certificate": "-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----", + "private_key": "-----BEGIN RSA PRIVATE KEY-----...-----END RSA PRIVATE KEY-----", + "ca": "-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----", + "flags": { + "active": true, + "csr": true, + "legacy": false + }, + "expires_at": "2022-03-28T00:12:34-0400", + "domains": [ + "example.com", + "www.example.com" + ], + "environment": { + "id": "5-9d46fd9d-e58b-47a3-8e9e-e8e0c2a854b4", + "name": "prod" + }, + "_links": { + "self": { + "href": "https://cloud.acquia.com/api/environments/5-9d46fd9d-e58b-47a3-8e9e-e8e0c2a854b4/ssl/certificates/13" + }, + "parent": { + "href": "https://cloud.acquia.com/api/environments/5-9d46fd9d-e58b-47a3-8e9e-e8e0c2a854b4/ssl/certificates" + } + } +} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/addApplicationToTeam.json b/tests/Fixtures/Endpoints/Teams/addApplication.json similarity index 100% rename from tests/Fixtures/Endpoints/addApplicationToTeam.json rename to tests/Fixtures/Endpoints/Teams/addApplication.json diff --git a/tests/Fixtures/Endpoints/createTeam.json b/tests/Fixtures/Endpoints/Teams/createTeam.json similarity index 100% rename from tests/Fixtures/Endpoints/createTeam.json rename to tests/Fixtures/Endpoints/Teams/createTeam.json diff --git a/tests/Fixtures/Endpoints/DeleteTeam.json b/tests/Fixtures/Endpoints/Teams/deleteTeam.json similarity index 100% rename from tests/Fixtures/Endpoints/DeleteTeam.json rename to tests/Fixtures/Endpoints/Teams/deleteTeam.json diff --git a/tests/Fixtures/Endpoints/getTeams.json b/tests/Fixtures/Endpoints/Teams/getAllTeams.json similarity index 100% rename from tests/Fixtures/Endpoints/getTeams.json rename to tests/Fixtures/Endpoints/Teams/getAllTeams.json diff --git a/tests/Fixtures/Endpoints/getTeamApplications.json b/tests/Fixtures/Endpoints/Teams/getApplications.json similarity index 100% rename from tests/Fixtures/Endpoints/getTeamApplications.json rename to tests/Fixtures/Endpoints/Teams/getApplications.json diff --git a/tests/Fixtures/Endpoints/createTeamInvite.json b/tests/Fixtures/Endpoints/Teams/invite.json similarity index 100% rename from tests/Fixtures/Endpoints/createTeamInvite.json rename to tests/Fixtures/Endpoints/Teams/invite.json diff --git a/tests/Fixtures/Endpoints/RenameTeam.json b/tests/Fixtures/Endpoints/Teams/rename.json similarity index 94% rename from tests/Fixtures/Endpoints/RenameTeam.json rename to tests/Fixtures/Endpoints/Teams/rename.json index 0746d22c..517986ad 100644 --- a/tests/Fixtures/Endpoints/RenameTeam.json +++ b/tests/Fixtures/Endpoints/Teams/rename.json @@ -1,3 +1,3 @@ { "message": "Team renamed." -} \ No newline at end of file +} diff --git a/tests/Fixtures/Endpoints/deleteEnvironment.json b/tests/Fixtures/Endpoints/deleteEnvironment.json deleted file mode 100644 index 4ab03df0..00000000 --- a/tests/Fixtures/Endpoints/deleteEnvironment.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "message": "The environment is being deleted.", - "_links": { - "self": { - "href": "https://cloud.acquia.com/api/environments/123-f027502b-ed6c-448e-97e8-4a0def7d25e1" - }, - "notification": { - "href": "https://cloud.acquia.com/api/notifications/6992a41d-a953-4ded-ae99-41d2f4d62f69" - } - } -} diff --git a/tests/Fixtures/Endpoints/getEnvironmentDatabases.json b/tests/Fixtures/Endpoints/getEnvironmentDatabases.json deleted file mode 100644 index 34524293..00000000 --- a/tests/Fixtures/Endpoints/getEnvironmentDatabases.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "total": 2, - "_links": { - "self": { - "href": "{baseUri}/environments/24-a47ac10b-58cc-4372-a567-0e02b2c3d470/databases" - }, - "sort": { - "href": "{baseUri}/environments/24-a47ac10b-58cc-4372-a567-0e02b2c3d470/databases{?sort}", - "templated": true - }, - "filter": { - "href": "{baseUri}/environments/24-a47ac10b-58cc-4372-a567-0e02b2c3d470/databases{?filter}", - "templated": true - }, - "limit": { - "href": "{baseUri}/environments/24-a47ac10b-58cc-4372-a567-0e02b2c3d470/databases{?limit}", - "templated": true - }, - "parent": { - "href": "{baseUri}/environments/24-a47ac10b-58cc-4372-a567-0e02b2c3d470" - } - }, - "_embedded": { - "items": [ - { - "id": 14, - "name": "my_db", - "user_name": "my_db_user", - "password": "supersecretdbpassword1!", - "url": "mysql://my_db_user:supersecretdbpassword1!@dbhost.com/my_db", - "db_host": "dbhost.com", - "ssh_host": "sshhost.com", - "flags": { - "default": true - }, - "environment": { - "id": "24-a47ac10b-58cc-4372-a567-0e02b2c3d470", - "name": "dev" - }, - "_links": { - "self": { - "href": "{baseUri}/environments/24-a47ac10b-58cc-4372-a567-0e02b2c3d470/databases/14" - } - } - }, - { - "id": 15, - "name": "my_db_stage", - "user_name": "my_db_user", - "password": "supersecretdbpassword1!", - "url": "mysql://my_db_user:supersecretdbpassword1!@dbhost.com/my_db_stage", - "db_host": "dbhost.com", - "ssh_host": "sshhost.com", - "flags": { - "default": false - }, - "environment": { - "id": "25-a47ac10b-58cc-4372-a567-0e02b2c3d470", - "name": "dev" - }, - "_links": { - "self": { - "href": "{baseUri}/environments/25-a47ac10b-58cc-4372-a567-0e02b2c3d470/databases/15" - } - } - } - ] - } -} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/getEnvironmentInsights.json b/tests/Fixtures/Endpoints/getEnvironmentInsights.json deleted file mode 100644 index b01363e4..00000000 --- a/tests/Fixtures/Endpoints/getEnvironmentInsights.json +++ /dev/null @@ -1,127 +0,0 @@ -{ - "total": 2, - "_links": { - "self": { - "href": "{baseUri}/applications/12345678-abcd-9012-efgh-345678901223/insight" - }, - "parent": { - "href": "{baseUri}/applications/12345678-abcd-9012-efgh-345678901223" - } - }, - "_embedded": { - "items": [ - { - "uuid": "09876543-dcba-210e-fghi-123456789012", - "label": "Example local development", - "hostname": "local.example.com:8443", - "status": "ok", - "updated_at": "2011-03-28T13:28:00-05:00", - "last_connected_at": "2011-03-28T13:11:00-05:00", - "scores": { - "insight": "62", - "seo": "15" - }, - "counts": { - "best_practices": { - "pass": 5, - "fail": 1, - "ignored": 0, - "total": 6, - "percent": 83 - }, - "performance": { - "pass": 9, - "fail": 10, - "ignored": 0, - "total": 19, - "percent": 47 - }, - "security": { - "pass": 10, - "fail": 10, - "ignored": 0, - "total": 20, - "percent": 50 - } - }, - "flags": { - "acquia_hosted": false, - "revoked": true - }, - "_links": { - "self": { - "href": "{baseUri}/insight/09876543-dcba-210e-fghi-123456789012" - }, - "alerts": { - "href": "{baseUri}/insight/09876543-dcba-210e-fghi-123456789012/alerts" - }, - "connection-history": { - "href": "{baseUri}/insight/09876543-dcba-210e-fghi-123456789012/connection-history" - }, - "modules": { - "href": "{baseUri}/insight/09876543-dcba-210e-fghi-123456789012/modules" - }, - "score-history": { - "href": "{baseUri}/insight/09876543-dcba-210e-fghi-123456789012/score-history" - } - } - }, - { - "uuid": "19876543-dcba-210e-fghi-12345678903", - "label": "Test Site: prod", - "hostname": "test.example.com", - "status": "ok", - "updated_at": "2017-03-28T13:28:00-05:00", - "last_connected_at": "2017-03-28T13:11:00-05:00", - "scores": { - "insight": "62", - "seo": "15" - }, - "counts": { - "best_practices": { - "pass": 5, - "fail": 1, - "ignored": 0, - "total": 6, - "percent": 83 - }, - "performance": { - "pass": 10, - "fail": 9, - "ignored": 0, - "total": 19, - "percent": 53 - }, - "security": { - "pass": 11, - "fail": 9, - "ignored": 0, - "total": 20, - "percent": 55 - } - }, - "flags": { - "acquia_hosted": true, - "revoked": true - }, - "_links": { - "self": { - "href": "{baseUri}/insight/19876543-dcba-210e-fghi-12345678903" - }, - "alerts": { - "href": "{baseUri}/insight/19876543-dcba-210e-fghi-12345678903/alerts" - }, - "connection-history": { - "href": "{baseUri}/insight/19876543-dcba-210e-fghi-12345678903/connection-history" - }, - "modules": { - "href": "{baseUri}/insight/19876543-dcba-210e-fghi-12345678903/modules" - }, - "score-history": { - "href": "{baseUri}/insight/19876543-dcba-210e-fghi-12345678903/score-history" - } - } - } - ] - } -} \ No newline at end of file diff --git a/tests/Fixtures/Endpoints/getTasks.json b/tests/Fixtures/Endpoints/getTasks.json deleted file mode 100644 index 28d02585..00000000 --- a/tests/Fixtures/Endpoints/getTasks.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "total": 2, - "_links": { - "self": { - "href": "{baseUri}/applications/0c7e79ab-1c4a-424e-8446-76ae8be7e851/tasks" - }, - "parent": { - "href": "{baseUri}/applications/0c7e79ab-1c4a-424e-8446-76ae8be7e851" - } - }, - "_embedded": { - "items": [ - { - "progress": 0, - "user": { - "uuid": "a18a1d80-8896-11e1-9eb5-12313928d5b8", - "first_name": "James", - "last_name": "Kirk", - "mail": "james.kirk@example.com", - "picture_url": "https://accounts.acquia.com/path/to/imagepng", - "username": "james.kirk" - }, - "uuid": "53098518-0da8-4e41-943b-1198e3614f38", - "name": "OperationStarted", - "title": "Operation title", - "description": "Operation description.", - "created_at": "2017-04-04T17:21:53-04:00", - "started_at": "2017-04-04T17:21:53-04:00", - "completed_at": "2017-04-04T17:21:59-04:00", - "status": "started", - "type": "task", - "metadata": { - "environment": { - "ids": [ - "63-0c7e79ab-1c4a-424e-8446-76ae8be7e851" - ] - } - }, - "labels": [ - "database", - "hosting" - ], - "reference_uuid": "53098518-0da8-4e41-943b-1198e3614f38", - "_links": { - "self": { - "href": "{baseUri}/applications/0c7e79ab-1c4a-424e-8446-76ae8be7e851/tasks" - } - } - }, - { - "progress": 100, - "user": { - "uuid": "a18a1d80-8896-11e1-9eb5-12313928d5b8", - "first_name": "James", - "last_name": "Kirk", - "mail": "james.kirk@example.com", - "picture_url": "https://accounts.acquia.com/path/to/imagepng", - "username": "james.kirk" - }, - "uuid": "63098518-0da8-4e41-943b-1198e3614f38", - "name": "OperationStarted", - "title": "Operation title", - "description": "Operation description.", - "created_at": "2017-04-04T17:21:53-04:00", - "started_at": "2017-04-04T17:21:53-04:00", - "completed_at": "2017-04-04T17:21:59-04:00", - "status": "completed", - "type": "task", - "metadata": { - "environment": { - "ids": [ - "63-0c7e79ab-1c4a-424e-8446-76ae8be7e851" - ] - } - }, - "labels": [ - "database", - "hosting" - ], - "reference_uuid": "53098518-0da8-4e41-943b-1198e3614f38", - "_links": { - "self": { - "href": "{baseUri}/applications/0c7e79ab-1c4a-424e-8446-76ae8be7e851/tasks" - } - } - } - ] - } -} \ No newline at end of file