From d7d8af2e71ebd468d95aaecba2733e48f23bd579 Mon Sep 17 00:00:00 2001 From: Sara McCutcheon Date: Fri, 7 Oct 2016 16:26:17 -0700 Subject: [PATCH] Branched 0.x from master and removed 1.x WIP --- CHANGELOG.md | 4 + bin/terminus.php | 52 - composer.json | 6 +- composer.lock | 1100 ++++++----------- scripts/test.sh | 6 +- src/Authorizer.php | 40 - src/Collections/SavedTokens.php | 87 -- src/Commands/ArtCommand.php | 145 --- src/Commands/Auth/LoginCommand.php | 78 -- src/Commands/Auth/LogoutCommand.php | 24 - src/Commands/Auth/WhoamiCommand.php | 37 - src/Commands/Backup/GetCommand.php | 72 -- src/Commands/Backup/ListCommand.php | 75 -- src/Commands/CloneCommand.php | 191 --- src/Commands/Connection/InfoCommand.php | 70 -- src/Commands/Connection/SetCommand.php | 57 - src/Commands/Env/CloneContentCommand.php | 33 - src/Commands/Env/CodeLogCommand.php | 55 - src/Commands/Env/CommitCommand.php | 39 - src/Commands/Env/DeployCommand.php | 56 - src/Commands/MachineToken/DeleteCommand.php | 33 - src/Commands/MachineToken/ListCommand.php | 46 - src/Commands/Multidev/CreateCommand.php | 40 - src/Commands/Multidev/DeleteCommand.php | 41 - src/Commands/Multidev/ListCommand.php | 53 - src/Commands/Multidev/MergeFromDevCommand.php | 41 - src/Commands/Multidev/MergeToDevCommand.php | 43 - src/Commands/Remote/DrushCommand.php | 52 - src/Commands/Remote/SSHBaseCommand.php | 126 -- src/Commands/Remote/WpCommand.php | 51 - src/Commands/SSHKey/AddCommand.php | 32 - src/Commands/SSHKey/DeleteCommand.php | 40 - src/Commands/SSHKey/ListCommand.php | 51 - src/Commands/Site/DeleteCommand.php | 28 - src/Commands/Site/ImportCommand.php | 41 - src/Commands/Site/InfoCommand.php | 49 - src/Commands/Site/ListCommand.php | 91 -- src/Commands/Site/LookupCommand.php | 37 - src/Commands/Site/SiteCommand.php | 12 - src/Commands/Site/Team/AddCommand.php | 40 - src/Commands/Site/Team/ListCommand.php | 50 - src/Commands/Site/Team/RemoveCommand.php | 33 - src/Commands/Site/Team/RoleCommand.php | 37 - src/Commands/TerminusCommand.php | 42 - src/Commands/Upstream/UpdatesApplyCommand.php | 61 - src/Commands/Upstream/UpdatesListCommand.php | 53 - src/Commands/Upstream/UpstreamCommand.php | 48 - src/Commands/Workflow/ListCommand.php | 55 - src/Config.php | 285 ----- src/Models/SavedToken.php | 65 - src/Runner.php | 103 -- src/Session/Session.php | 99 -- src/Session/SessionAwareInterface.php | 28 - src/Session/SessionAwareTrait.php | 36 - src/Site/SiteAwareInterface.php | 42 - src/Site/SiteAwareTrait.php | 73 -- src/Terminus.php | 40 - tests/active_features/art.feature | 41 - tests/active_features/auth.feature | 91 -- tests/active_features/backup-get.feature | 32 - tests/active_features/backup-list.feature | 21 - .../bootstrap/FeatureContext.php | 1079 ---------------- tests/active_features/connection-info.feature | 107 -- tests/active_features/connection-set.feature | 37 - tests/active_features/drush.feature | 25 - tests/active_features/env-clone.feature | 36 - tests/active_features/env-code-log.feature | 13 - tests/active_features/env-commit.feature | 14 - tests/active_features/env-deploy.feature | 33 - tests/active_features/import.feature | 37 - tests/active_features/machine-token.feature | 23 - tests/active_features/multidev-create.feature | 17 - tests/active_features/multidev-delete.feature | 25 - tests/active_features/multidev-list.feature | 23 - .../multidev-merge-from-dev.feature | 18 - .../multidev-merge-to-dev.feature | 17 - tests/active_features/site-delete.feature | 13 - tests/active_features/site-info.feature | 21 - tests/active_features/site-list.feature | 44 - tests/active_features/site-lookup.feature | 18 - tests/active_features/site-team.feature | 38 - tests/active_features/ssh-key.feature | 23 - tests/active_features/workflow.feature | 35 - tests/active_features/wp-cli.feature | 24 - tests/config/behat_10.yml | 41 - tests/config/phpunit.xml.dist | 1 - tests/newfeatures/aliases.feature | 19 - tests/newfeatures/art.feature | 28 - tests/newfeatures/backup-create.feature | 38 - tests/newfeatures/backup-schedule-set.feature | 18 - .../backups-schedule-cancel.feature | 19 - .../newfeatures/backups-schedule-get.feature | 25 - tests/newfeatures/branch-delete.feature | 24 - tests/newfeatures/branch-list.feature | 13 - tests/newfeatures/dashboard.feature | 27 - tests/newfeatures/domain.feature | 56 - tests/newfeatures/env-clear-cache.feature | 17 - tests/newfeatures/env-clone.feature | 26 - tests/newfeatures/env-diff.feature | 19 - tests/newfeatures/env-info.feature | 34 - tests/newfeatures/env-wake.feature | 13 - tests/newfeatures/env-wipe.feature | 16 - tests/newfeatures/https.feature | 25 - tests/newfeatures/lock.feature | 40 - tests/newfeatures/machine-token.feature | 23 - tests/newfeatures/new-relic.feature | 23 - tests/newfeatures/org-site.feature | 32 - tests/newfeatures/org-team.feature | 39 - tests/newfeatures/org.feature | 15 - tests/newfeatures/owner.feature | 26 - tests/newfeatures/payment-methods.feature | 30 - tests/newfeatures/redis.feature | 25 - tests/newfeatures/self.feature | 12 - tests/newfeatures/service-level.feature | 24 - tests/newfeatures/site-create.feature | 16 - tests/newfeatures/site-org.feature | 29 - tests/newfeatures/tag.feature | 40 - tests/newfeatures/upstream-info.feature | 13 - tests/newfeatures/upstream-list.feature | 15 - tests/newfeatures/upstream-updates.feature | 15 - .../new/Commands/ArtCommandTest.php | 93 -- .../unit_tests/new/Commands/Auth/AuthTest.php | 26 - .../new/Commands/Auth/LoginCommandTest.php | 155 --- .../new/Commands/Auth/LogoutCommandTest.php | 37 - .../new/Commands/Auth/WhoamiCommandTest.php | 77 -- .../new/Commands/Backup/BackupCommandTest.php | 44 - .../new/Commands/Backup/GetCommandTest.php | 84 -- .../new/Commands/Backup/ListCommandTest.php | 54 - .../new/Commands/CommandTestCase.php | 304 ----- .../Connection/ConnectionCommandTest.php | 43 - .../Commands/Connection/InfoCommandTest.php | 48 - .../Commands/Connection/SetCommandTest.php | 116 -- .../new/Commands/Env/CloneCommandTest.php | 48 - .../new/Commands/Env/CodeLogCommandTest.php | 89 -- .../new/Commands/Env/CommitCommandTest.php | 44 - .../new/Commands/Env/DeployCommandTest.php | 118 -- .../new/Commands/Env/EnvCommandTest.php | 60 - .../new/Commands/Env/MockCloneCommand.php | 8 - .../MachineToken/MachineTokenCommandTest.php | 49 - .../MachineTokensDeleteCommandTest.php | 114 -- .../MachineTokensListCommandTest.php | 71 -- .../Commands/Multidev/CreateCommandTest.php | 63 - .../Commands/Multidev/DeleteCommandTest.php | 94 -- .../new/Commands/Multidev/ListCommandTest.php | 67 - .../Multidev/MergeFromDevCommandTest.php | 96 -- .../Multidev/MergeToDevCommandTest.php | 96 -- .../Commands/Multidev/MultidevCommandTest.php | 28 - .../new/Commands/Remote/DrushCommandTest.php | 37 - .../new/Commands/Remote/DummyCommand.php | 30 - .../Commands/Remote/SSHBaseCommandTest.php | 112 -- .../new/Commands/Remote/WpCommandTest.php | 37 - .../Commands/SSHKeys/SSHKeysCommandTest.php | 45 - .../SSHKeys/SSHKeysDeleteCommandTest.php | 115 -- .../SSHKeys/SSHKeysListCommandTest.php | 93 -- .../new/Commands/Site/DeleteCommandTest.php | 69 -- .../new/Commands/Site/ImportCommandTest.php | 53 - .../new/Commands/Site/InfoCommandTest.php | 40 - .../new/Commands/Site/ListCommandTest.php | 302 ----- .../new/Commands/Site/LookupCommandTest.php | 76 -- .../new/Commands/Site/Team/AddCommandTest.php | 35 - .../Commands/Site/Team/ListCommandTest.php | 52 - .../Commands/Site/Team/RemoveCommandTest.php | 33 - .../Commands/Site/Team/RoleCommandTest.php | 38 - .../Commands/Site/Team/TeamCommandTest.php | 38 - .../Commands/Upstream/UpstreamCommandTest.php | 33 - .../UpstreamUpdatesApplyCommandTest.php | 125 -- .../UpstreamUpdatesListCommandTest.php | 104 -- .../new/Commands/Workflow/ListCommandTest.php | 46 - .../Commands/Workflow/WorkflowCommandTest.php | 30 - tests/unit_tests/new/ConfigTest.php | 45 - tests/unit_tests/new/RunnerTest.php | 86 -- tests/unit_tests/new/Session/SessionTest.php | 91 -- tests/unit_tests/new/TerminusTest.php | 36 - 173 files changed, 375 insertions(+), 10657 deletions(-) delete mode 100755 bin/terminus.php delete mode 100644 src/Authorizer.php delete mode 100755 src/Collections/SavedTokens.php delete mode 100644 src/Commands/ArtCommand.php delete mode 100644 src/Commands/Auth/LoginCommand.php delete mode 100644 src/Commands/Auth/LogoutCommand.php delete mode 100644 src/Commands/Auth/WhoamiCommand.php delete mode 100644 src/Commands/Backup/GetCommand.php delete mode 100644 src/Commands/Backup/ListCommand.php delete mode 100644 src/Commands/CloneCommand.php delete mode 100644 src/Commands/Connection/InfoCommand.php delete mode 100644 src/Commands/Connection/SetCommand.php delete mode 100644 src/Commands/Env/CloneContentCommand.php delete mode 100644 src/Commands/Env/CodeLogCommand.php delete mode 100644 src/Commands/Env/CommitCommand.php delete mode 100644 src/Commands/Env/DeployCommand.php delete mode 100644 src/Commands/MachineToken/DeleteCommand.php delete mode 100644 src/Commands/MachineToken/ListCommand.php delete mode 100644 src/Commands/Multidev/CreateCommand.php delete mode 100644 src/Commands/Multidev/DeleteCommand.php delete mode 100644 src/Commands/Multidev/ListCommand.php delete mode 100644 src/Commands/Multidev/MergeFromDevCommand.php delete mode 100644 src/Commands/Multidev/MergeToDevCommand.php delete mode 100755 src/Commands/Remote/DrushCommand.php delete mode 100755 src/Commands/Remote/SSHBaseCommand.php delete mode 100755 src/Commands/Remote/WpCommand.php delete mode 100644 src/Commands/SSHKey/AddCommand.php delete mode 100644 src/Commands/SSHKey/DeleteCommand.php delete mode 100644 src/Commands/SSHKey/ListCommand.php delete mode 100644 src/Commands/Site/DeleteCommand.php delete mode 100644 src/Commands/Site/ImportCommand.php delete mode 100644 src/Commands/Site/InfoCommand.php delete mode 100644 src/Commands/Site/ListCommand.php delete mode 100644 src/Commands/Site/LookupCommand.php delete mode 100644 src/Commands/Site/SiteCommand.php delete mode 100644 src/Commands/Site/Team/AddCommand.php delete mode 100644 src/Commands/Site/Team/ListCommand.php delete mode 100644 src/Commands/Site/Team/RemoveCommand.php delete mode 100644 src/Commands/Site/Team/RoleCommand.php delete mode 100644 src/Commands/TerminusCommand.php delete mode 100644 src/Commands/Upstream/UpdatesApplyCommand.php delete mode 100644 src/Commands/Upstream/UpdatesListCommand.php delete mode 100644 src/Commands/Upstream/UpstreamCommand.php delete mode 100644 src/Commands/Workflow/ListCommand.php delete mode 100644 src/Config.php delete mode 100644 src/Models/SavedToken.php delete mode 100644 src/Runner.php delete mode 100644 src/Session/Session.php delete mode 100644 src/Session/SessionAwareInterface.php delete mode 100644 src/Session/SessionAwareTrait.php delete mode 100644 src/Site/SiteAwareInterface.php delete mode 100644 src/Site/SiteAwareTrait.php delete mode 100644 src/Terminus.php delete mode 100644 tests/active_features/art.feature delete mode 100644 tests/active_features/auth.feature delete mode 100644 tests/active_features/backup-get.feature delete mode 100644 tests/active_features/backup-list.feature delete mode 100644 tests/active_features/bootstrap/FeatureContext.php delete mode 100644 tests/active_features/connection-info.feature delete mode 100644 tests/active_features/connection-set.feature delete mode 100644 tests/active_features/drush.feature delete mode 100644 tests/active_features/env-clone.feature delete mode 100644 tests/active_features/env-code-log.feature delete mode 100644 tests/active_features/env-commit.feature delete mode 100644 tests/active_features/env-deploy.feature delete mode 100644 tests/active_features/import.feature delete mode 100644 tests/active_features/machine-token.feature delete mode 100644 tests/active_features/multidev-create.feature delete mode 100644 tests/active_features/multidev-delete.feature delete mode 100644 tests/active_features/multidev-list.feature delete mode 100644 tests/active_features/multidev-merge-from-dev.feature delete mode 100644 tests/active_features/multidev-merge-to-dev.feature delete mode 100644 tests/active_features/site-delete.feature delete mode 100644 tests/active_features/site-info.feature delete mode 100644 tests/active_features/site-list.feature delete mode 100644 tests/active_features/site-lookup.feature delete mode 100644 tests/active_features/site-team.feature delete mode 100644 tests/active_features/ssh-key.feature delete mode 100644 tests/active_features/workflow.feature delete mode 100644 tests/active_features/wp-cli.feature delete mode 100644 tests/config/behat_10.yml delete mode 100644 tests/newfeatures/aliases.feature delete mode 100644 tests/newfeatures/art.feature delete mode 100644 tests/newfeatures/backup-create.feature delete mode 100644 tests/newfeatures/backup-schedule-set.feature delete mode 100644 tests/newfeatures/backups-schedule-cancel.feature delete mode 100644 tests/newfeatures/backups-schedule-get.feature delete mode 100644 tests/newfeatures/branch-delete.feature delete mode 100644 tests/newfeatures/branch-list.feature delete mode 100644 tests/newfeatures/dashboard.feature delete mode 100644 tests/newfeatures/domain.feature delete mode 100644 tests/newfeatures/env-clear-cache.feature delete mode 100644 tests/newfeatures/env-clone.feature delete mode 100644 tests/newfeatures/env-diff.feature delete mode 100644 tests/newfeatures/env-info.feature delete mode 100644 tests/newfeatures/env-wake.feature delete mode 100644 tests/newfeatures/env-wipe.feature delete mode 100644 tests/newfeatures/https.feature delete mode 100644 tests/newfeatures/lock.feature delete mode 100644 tests/newfeatures/machine-token.feature delete mode 100644 tests/newfeatures/new-relic.feature delete mode 100644 tests/newfeatures/org-site.feature delete mode 100644 tests/newfeatures/org-team.feature delete mode 100644 tests/newfeatures/org.feature delete mode 100644 tests/newfeatures/owner.feature delete mode 100644 tests/newfeatures/payment-methods.feature delete mode 100644 tests/newfeatures/redis.feature delete mode 100644 tests/newfeatures/self.feature delete mode 100644 tests/newfeatures/service-level.feature delete mode 100644 tests/newfeatures/site-create.feature delete mode 100644 tests/newfeatures/site-org.feature delete mode 100644 tests/newfeatures/tag.feature delete mode 100644 tests/newfeatures/upstream-info.feature delete mode 100644 tests/newfeatures/upstream-list.feature delete mode 100644 tests/newfeatures/upstream-updates.feature delete mode 100644 tests/unit_tests/new/Commands/ArtCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Auth/AuthTest.php delete mode 100644 tests/unit_tests/new/Commands/Auth/LoginCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Auth/LogoutCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Auth/WhoamiCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Backup/BackupCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Backup/GetCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Backup/ListCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/CommandTestCase.php delete mode 100644 tests/unit_tests/new/Commands/Connection/ConnectionCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Connection/InfoCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Connection/SetCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Env/CloneCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Env/CodeLogCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Env/CommitCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Env/DeployCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Env/EnvCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Env/MockCloneCommand.php delete mode 100644 tests/unit_tests/new/Commands/MachineToken/MachineTokenCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/MachineToken/MachineTokensDeleteCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/MachineToken/MachineTokensListCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Multidev/CreateCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Multidev/DeleteCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Multidev/ListCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Multidev/MergeFromDevCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Multidev/MergeToDevCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Multidev/MultidevCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Remote/DrushCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Remote/DummyCommand.php delete mode 100644 tests/unit_tests/new/Commands/Remote/SSHBaseCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Remote/WpCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/SSHKeys/SSHKeysCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/SSHKeys/SSHKeysDeleteCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/SSHKeys/SSHKeysListCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Site/DeleteCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Site/ImportCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Site/InfoCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Site/ListCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Site/LookupCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Site/Team/AddCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Site/Team/ListCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Site/Team/RemoveCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Site/Team/RoleCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Site/Team/TeamCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Upstream/UpstreamCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Upstream/UpstreamUpdatesApplyCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Upstream/UpstreamUpdatesListCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Workflow/ListCommandTest.php delete mode 100644 tests/unit_tests/new/Commands/Workflow/WorkflowCommandTest.php delete mode 100644 tests/unit_tests/new/ConfigTest.php delete mode 100755 tests/unit_tests/new/RunnerTest.php delete mode 100644 tests/unit_tests/new/Session/SessionTest.php delete mode 100755 tests/unit_tests/new/TerminusTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 87a76c950..5303d6d5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ #Change Log All notable changes to this project starting with the 0.6.0 release will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org) +## 0.13.x +### Changed +- Branched 0.x from master, removed 1.x work. + ## [0.13.3] - 2016-10-07 ### Added - `Environment::serialize()` (#1251) diff --git a/bin/terminus.php b/bin/terminus.php deleted file mode 100755 index 06136db91..000000000 --- a/bin/terminus.php +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env php -get('version'), $config); - -// Configuring the dependency-injection container -$input = new ArgvInput($_SERVER['argv']); -$output = new ConsoleOutput(); -$container = Robo::createDefaultContainer($input, $output, $application, $config); - -$container->share('fileCache', FileCache::class); -$container->share('session', Session::class) - ->withArgument('fileCache'); -$container->inflector(SessionAwareInterface::class) - ->invokeMethod('setSession', ['session']); -$container->share('sites', Sites::class); -$container->inflector(SiteAwareInterface::class) - ->invokeMethod('setSites', ['sites']); - -$factory = $container->get('commandFactory'); -$factory->setIncludeAllPublicMethods(false); - -// Running Terminus -$runner = new Runner($container); -$status_code = $runner->run($input, $output); -exit($status_code); diff --git a/composer.json b/composer.json index 11cc14447..8672083a3 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,6 @@ "minimum-stability": "beta", "require": { "php": ">=5.5.9", - "consolidation/robo": "dev-master", "guzzlehttp/guzzle": "^6.2", "katzgrau/klogger": "^1.2", "psy/psysh": "^0.7", @@ -31,13 +30,10 @@ "autoload-dev": { "psr-4": { "Terminus\\UnitTests\\": "tests/unit_tests/old/", - "Terminus\\FeatureTests\\": "tests/features/bootstrap/", - "Pantheon\\Terminus\\UnitTests\\": "tests/unit_tests/new/", - "Pantheon\\Terminus\\FeatureTests\\": "tests/active_features/bootstrap/" + "Terminus\\FeatureTests\\": "tests/features/bootstrap/" } }, "scripts": { - "behat": "SHELL_INTERACTIVE=true behat --colors -c=tests/config/behat_10.yml --suite=default", "cbf": "phpcbf --standard=PSR2 -n tests/* bin/terminus.php src/* php/*", "cs": "phpcs --standard=PSR2 --severity=1 -n tests/* bin/terminus.php src/* php/*", "docs": "php utils/make-docs.php", diff --git a/composer.lock b/composer.lock index d7f8cd827..01ceca5e5 100644 --- a/composer.lock +++ b/composer.lock @@ -4,257 +4,9 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "8ef912f9b671a1736ad3e208a228b19a", - "content-hash": "950d846075d42de309f51895d852844d", + "hash": "d8b434a34f1dba4f4fb57b323a9adc94", + "content-hash": "5dae45fb75714115de302eb8e4b69379", "packages": [ - { - "name": "consolidation/annotated-command", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/consolidation/annotated-command.git", - "reference": "2a6ef0b39ed904dabefd796eeaf5f8feeaa881c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/consolidation/annotated-command/zipball/2a6ef0b39ed904dabefd796eeaf5f8feeaa881c4", - "reference": "2a6ef0b39ed904dabefd796eeaf5f8feeaa881c4", - "shasum": "" - }, - "require": { - "consolidation/output-formatters": "~2", - "php": ">=5.4.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", - "psr/log": "~1.0", - "symfony/console": "~2.5|~3.0", - "symfony/event-dispatcher": "~2.5|~3.0", - "symfony/finder": "~2.5|~3.0" - }, - "require-dev": { - "phpunit/phpunit": "4.*", - "satooshi/php-coveralls": "^1.0", - "squizlabs/php_codesniffer": "2.*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "Consolidation\\AnnotatedCommand\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Greg Anderson", - "email": "greg.1.anderson@greenknowe.org" - } - ], - "description": "Initialize Symfony Console commands from annotated command class methods.", - "time": "2016-10-05 04:09:14" - }, - { - "name": "consolidation/log", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/consolidation/log.git", - "reference": "74ba81b4edc585616747cc5c5309ce56fec41254" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/consolidation/log/zipball/74ba81b4edc585616747cc5c5309ce56fec41254", - "reference": "74ba81b4edc585616747cc5c5309ce56fec41254", - "shasum": "" - }, - "require": { - "php": ">=5.5.0", - "psr/log": "~1.0", - "symfony/console": "~2.5|~3.0" - }, - "require-dev": { - "phpunit/phpunit": "4.*", - "squizlabs/php_codesniffer": "2.*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Consolidation\\Log\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Greg Anderson", - "email": "greg.1.anderson@greenknowe.org" - } - ], - "description": "Improved Psr-3 / Psr\\Log logger based on Symfony Console components.", - "time": "2016-03-23 23:46:42" - }, - { - "name": "consolidation/output-formatters", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/consolidation/output-formatters.git", - "reference": "8bce15438a97afba5dcf036a71d961977b64fa3e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/consolidation/output-formatters/zipball/8bce15438a97afba5dcf036a71d961977b64fa3e", - "reference": "8bce15438a97afba5dcf036a71d961977b64fa3e", - "shasum": "" - }, - "require": { - "php": ">=5.4.0", - "symfony/console": "~2.5|~3.0", - "symfony/finder": "~2.5|~3.0" - }, - "require-dev": { - "phpunit/phpunit": "4.*", - "satooshi/php-coveralls": "^1.0", - "squizlabs/php_codesniffer": "2.*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "Consolidation\\OutputFormatters\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Greg Anderson", - "email": "greg.1.anderson@greenknowe.org" - } - ], - "description": "Format text by applying transformations provided by plug-in formatters.", - "time": "2016-10-05 04:05:17" - }, - { - "name": "consolidation/robo", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/consolidation/Robo.git", - "reference": "32f349ed83e53892935004e507878fbdd360e2f2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/consolidation/Robo/zipball/32f349ed83e53892935004e507878fbdd360e2f2", - "reference": "32f349ed83e53892935004e507878fbdd360e2f2", - "shasum": "" - }, - "require": { - "consolidation/annotated-command": "~2", - "consolidation/log": "~1", - "consolidation/output-formatters": "~2", - "league/container": "^2.2", - "php": ">=5.5.0", - "symfony/console": "~2.5|~3.0", - "symfony/event-dispatcher": "~2.5|~3.0", - "symfony/filesystem": "~2.5|~3.0", - "symfony/finder": "~2.5|~3.0", - "symfony/process": "~2.5|~3.0" - }, - "replace": { - "codegyre/robo": "< 1.0" - }, - "require-dev": { - "codeception/aspect-mock": "~1", - "codeception/base": "^2.1.5", - "codeception/verify": "^0.3.2", - "henrikbjorn/lurker": "~1", - "natxet/cssmin": "~3", - "patchwork/jsqueeze": "~2", - "pear/archive_tar": "~1", - "phpunit/php-code-coverage": "~4", - "satooshi/php-coveralls": "~1", - "squizlabs/php_codesniffer": "~2" - }, - "suggest": { - "henrikbjorn/lurker": "For monitoring filesystem changes in taskWatch", - "natxet/CssMin": "For minifying JS files in taskMinify", - "patchwork/jsqueeze": "For minifying JS files in taskMinify", - "pear/archive_tar": "Allows tar archives to be created and extracted in taskPack and taskExtract, respectively." - }, - "bin": [ - "robo" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Robo\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Davert", - "email": "davert.php@resend.cc" - } - ], - "description": "Modern task runner", - "time": "2016-10-05 16:47:33" - }, - { - "name": "container-interop/container-interop", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/container-interop/container-interop.git", - "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/container-interop/container-interop/zipball/fc08354828f8fd3245f77a66b9e23a6bca48297e", - "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e", - "shasum": "" - }, - "type": "library", - "autoload": { - "psr-4": { - "Interop\\Container\\": "src/Interop/Container/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", - "time": "2014-12-30 15:22:37" - }, { "name": "dnoegel/php-xdg-base-dir", "version": "0.1", @@ -596,70 +348,6 @@ ], "time": "2015-11-04 22:43:22" }, - { - "name": "league/container", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/container.git", - "reference": "c0e7d947b690891f700dc4967ead7bdb3d6708c1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/container/zipball/c0e7d947b690891f700dc4967ead7bdb3d6708c1", - "reference": "c0e7d947b690891f700dc4967ead7bdb3d6708c1", - "shasum": "" - }, - "require": { - "container-interop/container-interop": "^1.1", - "php": ">=5.4.0" - }, - "provide": { - "container-interop/container-interop-implementation": "^1.1" - }, - "replace": { - "orno/di": "~2.0" - }, - "require-dev": { - "phpunit/phpunit": "4.*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev", - "dev-1.x": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "League\\Container\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Phil Bennett", - "email": "philipobenito@gmail.com", - "homepage": "http://www.philipobenito.com", - "role": "Developer" - } - ], - "description": "A fast and intuitive dependency injection container.", - "homepage": "https://github.com/thephpleague/container", - "keywords": [ - "container", - "dependency", - "di", - "injection", - "league", - "provider", - "service" - ], - "time": "2016-03-17 11:07:59" - }, { "name": "nikic/php-parser", "version": "v2.1.1", @@ -711,152 +399,6 @@ ], "time": "2016-09-16 12:04:44" }, - { - "name": "phpdocumentor/reflection-common", - "version": "1.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "shasum": "" - }, - "require": { - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "^4.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "time": "2015-12-27 11:43:31" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "3.1.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", - "shasum": "" - }, - "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.2.0", - "webmozart/assert": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^4.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2016-09-30 07:12:33" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "0.2", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/b39c7a5b194f9ed7bd0dd345c751007a41862443", - "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443", - "shasum": "" - }, - "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "time": "2016-06-10 07:14:17" - }, { "name": "psr/http-message", "version": "1.0.1", @@ -1148,124 +690,7 @@ }, "autoload": { "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "time": "2016-09-28 00:10:16" - }, - { - "name": "symfony/debug", - "version": "v3.0.9", - "source": { - "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "697c527acd9ea1b2d3efac34d9806bf255278b0a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/697c527acd9ea1b2d3efac34d9806bf255278b0a", - "reference": "697c527acd9ea1b2d3efac34d9806bf255278b0a", - "shasum": "" - }, - "require": { - "php": ">=5.5.9", - "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/class-loader": "~2.8|~3.0", - "symfony/http-kernel": "~2.8|~3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Debug\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Debug Component", - "homepage": "https://symfony.com", - "time": "2016-07-30 07:22:48" - }, - { - "name": "symfony/event-dispatcher", - "version": "v3.1.5", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "c0c00c80b3a69132c4e55c3e7db32b4a387615e5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/c0c00c80b3a69132c4e55c3e7db32b4a387615e5", - "reference": "c0c00c80b3a69132c4e55c3e7db32b4a387615e5", - "shasum": "" - }, - "require": { - "php": ">=5.5.9" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/dependency-injection": "~2.8|~3.0", - "symfony/expression-language": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" + "Symfony\\Component\\Console\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -1285,36 +710,44 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony EventDispatcher Component", + "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2016-07-19 10:45:57" + "time": "2016-09-28 00:10:16" }, { - "name": "symfony/filesystem", - "version": "v3.1.5", + "name": "symfony/debug", + "version": "v3.0.9", "source": { "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "682fd8fdb3135fdf05fc496a01579ccf6c85c0e5" + "url": "https://github.com/symfony/debug.git", + "reference": "697c527acd9ea1b2d3efac34d9806bf255278b0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/682fd8fdb3135fdf05fc496a01579ccf6c85c0e5", - "reference": "682fd8fdb3135fdf05fc496a01579ccf6c85c0e5", + "url": "https://api.github.com/repos/symfony/debug/zipball/697c527acd9ea1b2d3efac34d9806bf255278b0a", + "reference": "697c527acd9ea1b2d3efac34d9806bf255278b0a", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": ">=5.5.9", + "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/class-loader": "~2.8|~3.0", + "symfony/http-kernel": "~2.8|~3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.0-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Filesystem\\": "" + "Symfony\\Component\\Debug\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -1334,9 +767,9 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Filesystem Component", + "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2016-09-14 00:18:46" + "time": "2016-07-30 07:22:48" }, { "name": "symfony/finder", @@ -1446,55 +879,6 @@ ], "time": "2016-05-18 14:26:46" }, - { - "name": "symfony/process", - "version": "v3.1.5", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "66de154ae86b1a07001da9fbffd620206e4faf94" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/66de154ae86b1a07001da9fbffd620206e4faf94", - "reference": "66de154ae86b1a07001da9fbffd620206e4faf94", - "shasum": "" - }, - "require": { - "php": ">=5.5.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Process Component", - "homepage": "https://symfony.com", - "time": "2016-09-29 14:13:09" - }, { "name": "symfony/var-dumper", "version": "v3.1.5", @@ -1718,56 +1102,6 @@ ], "time": "2016-09-01 10:05:43" }, - { - "name": "webmozart/assert", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "bb2d123231c095735130cc8f6d31385a44c7b308" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/bb2d123231c095735130cc8f6d31385a44c7b308", - "reference": "bb2d123231c095735130cc8f6d31385a44c7b308", - "shasum": "" - }, - "require": { - "php": "^5.3.3|^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "time": "2016-08-09 15:02:57" - }, { "name": "wp-cli/php-cli-tools", "version": "v0.11.1", @@ -2195,47 +1529,177 @@ "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients", "homepage": "http://guzzlephp.org/", "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "rest", - "web service" + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "abandoned": "guzzlehttp/guzzle", + "time": "2014-01-28 22:29:15" + }, + { + "name": "php-vcr/php-vcr", + "version": "1.2.8", + "source": { + "type": "git", + "url": "https://github.com/php-vcr/php-vcr.git", + "reference": "0f1cb3e5537897b88b774fa2918d6c32d7d69139" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-vcr/php-vcr/zipball/0f1cb3e5537897b88b774fa2918d6c32d7d69139", + "reference": "0f1cb3e5537897b88b774fa2918d6c32d7d69139", + "shasum": "" + }, + "require": { + "beberlei/assert": "2.*", + "ext-curl": "*", + "symfony/event-dispatcher": "~2.1|3.*", + "symfony/yaml": "2.*|3.*" + }, + "require-dev": { + "lapistano/proxy-object": "dev-master", + "mikey179/vfsstream": "1.2.*", + "phpunit/phpunit": "3.*" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Adrian Philipp", + "email": "mail@adrian-philipp.com" + } + ], + "description": "Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.", + "time": "2016-01-25 13:30:31" + }, + { + "name": "php-vcr/phpunit-testlistener-vcr", + "version": "1.1.7", + "source": { + "type": "git", + "url": "https://github.com/php-vcr/phpunit-testlistener-vcr.git", + "reference": "e29c11dcf2a215ff51f0ae5cdf56dfd3cdd30c11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-vcr/phpunit-testlistener-vcr/zipball/e29c11dcf2a215ff51f0ae5cdf56dfd3cdd30c11", + "reference": "e29c11dcf2a215ff51f0ae5cdf56dfd3cdd30c11", + "shasum": "" + }, + "require": { + "php-vcr/php-vcr": "*" + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Adrian Philipp", + "email": "mail@adrian-philipp.com" + } + ], + "description": "Integrates PHPUnit with PHP-VCR.", + "time": "2016-01-12 21:15:47" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" ], - "abandoned": "guzzlehttp/guzzle", - "time": "2014-01-28 22:29:15" + "time": "2015-12-27 11:43:31" }, { - "name": "php-vcr/php-vcr", - "version": "1.2.8", + "name": "phpdocumentor/reflection-docblock", + "version": "3.1.1", "source": { "type": "git", - "url": "https://github.com/php-vcr/php-vcr.git", - "reference": "0f1cb3e5537897b88b774fa2918d6c32d7d69139" + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-vcr/php-vcr/zipball/0f1cb3e5537897b88b774fa2918d6c32d7d69139", - "reference": "0f1cb3e5537897b88b774fa2918d6c32d7d69139", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", "shasum": "" }, "require": { - "beberlei/assert": "2.*", - "ext-curl": "*", - "symfony/event-dispatcher": "~2.1|3.*", - "symfony/yaml": "2.*|3.*" + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0@dev", + "phpdocumentor/type-resolver": "^0.2.0", + "webmozart/assert": "^1.0" }, "require-dev": { - "lapistano/proxy-object": "dev-master", - "mikey179/vfsstream": "1.2.*", - "phpunit/phpunit": "3.*" + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^4.4" }, "type": "library", "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2243,43 +1707,59 @@ ], "authors": [ { - "name": "Adrian Philipp", - "email": "mail@adrian-philipp.com" + "name": "Mike van Riel", + "email": "me@mikevanriel.com" } ], - "description": "Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.", - "time": "2016-01-25 13:30:31" + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2016-09-30 07:12:33" }, { - "name": "php-vcr/phpunit-testlistener-vcr", - "version": "1.1.7", + "name": "phpdocumentor/type-resolver", + "version": "0.2", "source": { "type": "git", - "url": "https://github.com/php-vcr/phpunit-testlistener-vcr.git", - "reference": "e29c11dcf2a215ff51f0ae5cdf56dfd3cdd30c11" + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-vcr/phpunit-testlistener-vcr/zipball/e29c11dcf2a215ff51f0ae5cdf56dfd3cdd30c11", - "reference": "e29c11dcf2a215ff51f0ae5cdf56dfd3cdd30c11", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/b39c7a5b194f9ed7bd0dd345c751007a41862443", + "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443", "shasum": "" }, "require": { - "php-vcr/php-vcr": "*" + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { - "name": "Adrian Philipp", - "email": "mail@adrian-philipp.com" + "name": "Mike van Riel", + "email": "me@mikevanriel.com" } ], - "description": "Integrates PHPUnit with PHP-VCR.", - "time": "2016-01-12 21:15:47" + "time": "2016-06-10 07:14:17" }, { "name": "phpspec/prophecy", @@ -3533,6 +3013,115 @@ "homepage": "https://symfony.com", "time": "2016-09-24 15:56:48" }, + { + "name": "symfony/event-dispatcher", + "version": "v3.1.5", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "c0c00c80b3a69132c4e55c3e7db32b4a387615e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/c0c00c80b3a69132c4e55c3e7db32b4a387615e5", + "reference": "c0c00c80b3a69132c4e55c3e7db32b4a387615e5", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0", + "symfony/dependency-injection": "~2.8|~3.0", + "symfony/expression-language": "~2.8|~3.0", + "symfony/stopwatch": "~2.8|~3.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com", + "time": "2016-07-19 10:45:57" + }, + { + "name": "symfony/filesystem", + "version": "v3.1.5", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "682fd8fdb3135fdf05fc496a01579ccf6c85c0e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/682fd8fdb3135fdf05fc496a01579ccf6c85c0e5", + "reference": "682fd8fdb3135fdf05fc496a01579ccf6c85c0e5", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Filesystem Component", + "homepage": "https://symfony.com", + "time": "2016-09-14 00:18:46" + }, { "name": "symfony/stopwatch", "version": "v3.1.5", @@ -3685,12 +3274,61 @@ "description": "The classes contained within this repository extend the standard DOM to use exceptions at all occasions of errors instead of PHP warnings or notices. They also add various custom methods and shortcuts for convenience and to simplify the usage of DOM.", "homepage": "https://github.com/theseer/fDOMDocument", "time": "2015-05-27 22:58:02" + }, + { + "name": "webmozart/assert", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "bb2d123231c095735130cc8f6d31385a44c7b308" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/bb2d123231c095735130cc8f6d31385a44c7b308", + "reference": "bb2d123231c095735130cc8f6d31385a44c7b308", + "shasum": "" + }, + "require": { + "php": "^5.3.3|^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2016-08-09 15:02:57" } ], "aliases": [], "minimum-stability": "beta", "stability-flags": { - "consolidation/robo": 20, "php-vcr/phpunit-testlistener-vcr": 0 }, "prefer-stable": false, diff --git a/scripts/test.sh b/scripts/test.sh index 9a2d7a809..863f328d2 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -8,19 +8,15 @@ fi for f in $( git diff-tree $TRAVIS_COMMIT --name-status -r | grep php | grep -v "^D" | awk '{print $2}') ; do php -l $f ; done -vendor/bin/phpcs --standard=PSR2 --extensions=php --severity=1 -n tests/* bin/terminus.php src/* php/* +vendor/bin/phpcs --standard=PSR2 --extensions=php --severity=1 -n tests/* php/* vendor/bin/phpunit --colors=always -c tests/config/phpunit.xml.dist --debug # Run the functional tests behat_cmd="vendor/bin/behat --colors -c=tests/config/behat.yml --suite=" -behat_cmd_10="vendor/bin/behat --colors -c=tests/config/behat_10.yml --suite=" if [ ! -z $1 ]; then behat_cmd+=$1 - behat_cmd_10+=$1 else behat_cmd+="default" - behat_cmd_10+="default" fi eval $behat_cmd -eval $behat_cmd_10 diff --git a/src/Authorizer.php b/src/Authorizer.php deleted file mode 100644 index aa85acc24..000000000 --- a/src/Authorizer.php +++ /dev/null @@ -1,40 +0,0 @@ -session()->isActive()) { - if (count($tokens = $this->session()->tokens->all()) == 1) { - $token = array_shift($tokens); - } elseif (!empty($email = $this->config->get('user'))) { - $token = $this->session()->tokens->get($email); - } else { - throw new \Exception( - 'You are not logged in. Run `auth:login` to authenticate or `help auth:login` for more info.' - ); - } - $token->logIn(); - } - } -} diff --git a/src/Collections/SavedTokens.php b/src/Collections/SavedTokens.php deleted file mode 100755 index fc57f9678..000000000 --- a/src/Collections/SavedTokens.php +++ /dev/null @@ -1,87 +0,0 @@ -session = $options['session']; - } - - /** - * Saves a machine token to the tokens directory and logs the user in - * - * @param string $token The machine token to be saved - */ - public function create($token_string) - { - $token = new SavedToken((object)['token' => $token_string,], ['collection' => $this,]); - $session = $token->logIn(); - $user = $session->getUser()->fetch(); - $token->id = $user->get('email'); - $token->set('email', $user->get('email')); - $token->saveToDir(); - $this->models[$token->id] = $token; - } - - /** - * Retrieves the model with site of the given email or machine token - * - * @param string $id Email or machine token to look up a saved token by - * @return SavedToken - */ - public function get($id) - { - $tokens = $this->getMembers(); - if (isset($tokens[$id])) { - return $tokens[$id]; - } else { - foreach ($tokens as $token) { - if ($id == $token->get('token')) { - return $token; - } - } - } - throw new TerminusException('Could not find a saved token identified by {id}.', compact('id')); - } - - /** - * @inheritdoc - */ - protected function getCollectionData($options = []) - { - $finder = new Finder(); - $config = new Config(); - $iterator = $finder->files()->in($config->get('tokens_dir')); - $tokens = []; - foreach ($iterator as $file) { - $tokens[] = json_decode(file_get_contents($file->getRealPath())); - } - return $tokens; - } -} diff --git a/src/Commands/ArtCommand.php b/src/Commands/ArtCommand.php deleted file mode 100644 index ebe9d7aed..000000000 --- a/src/Commands/ArtCommand.php +++ /dev/null @@ -1,145 +0,0 @@ -formatFilename($name); - // If a name wasn't provide we want to only print available items. - if ($name) { - $artwork_content = $this->retrieveArt($name); - $this->io()->text("{$artwork_content}"); - } - } - - /** - * If the user does not specify the $name parameter, then we will - * prompt for it here. - * - * @hook interact - * - * @param \Symfony\Component\Console\Input\InputInterface $input - * @param \Symfony\Component\Console\Output\OutputInterface $output - */ - public function interact(InputInterface $input, OutputInterface $output) - { - $available_art = $this->availableArt(); - $io = new SymfonyStyle($input, $output); - $art_name = $input->getArgument('name'); - if (!$art_name) { - $io->title('Available Art'); - $io->listing($available_art); - } - } - - /** - * Return available art - * @return array - */ - protected function availableArt() - { - // Find all of the art in the assets directory. - $finder = new Finder(); - $finder - ->files() - ->in($this->config->get('assets_dir')) - ->depth('== 0') - ->name('*.txt') - ->sortbyname(); - - return array_values( - array_map( - function ($file) { - return $file->getBasename('.txt'); - }, - (array)$finder->getIterator() - ) - ); - } - - /** - * Set the art filename. - * - * @param $name - * - * @return \Pantheon\Terminus\Commands\ArtCommand - * - */ - protected function formatFilename($name) - { - if ($name == 'random') { - $name = $this->randomArtName(); - } - $this->filename = $this->config->get('assets_dir') . "/{$name}.txt"; - - return $this; - } - - /** - * Retrieve the contents of an art file. - * - * @param $name - * @return string - * @throws \Exception - */ - protected function retrieveArt($name) - { - if (!file_exists($this->filename)) { - throw new \Exception("There is no source for the requested {$name} artwork.", 1); - } - return base64_decode(file_get_contents($this->filename)); - } - - /** - * Feeling lucky? Get a random artwork. - * @return string - */ - private function randomArtName() - { - $art = $this->availableArt(); - - return $art[array_rand($art)]; - } - - /** - * @return string - */ - protected function getFilename() - { - return $this->filename; - } - - /** - * @param string $filename - */ - protected function setFilename(string $filename) - { - $this->filename = $filename; - } -} diff --git a/src/Commands/Auth/LoginCommand.php b/src/Commands/Auth/LoginCommand.php deleted file mode 100644 index 753e8cb84..000000000 --- a/src/Commands/Auth/LoginCommand.php +++ /dev/null @@ -1,78 +0,0 @@ - - * Logs in your user with a previously saved machine token belonging to the account linked to the given email - */ - public function logIn(array $options = ['machine-token' => null, 'email' => null,]) - { - $tokens = $this->session()->tokens; - - if (isset($options['machine-token']) && !is_null($token_string = $options['machine-token'])) { - try { - $token = $tokens->get($token_string); - } catch (\Exception $e) { - $this->log()->notice('Logging in via machine token.'); - $tokens->create($token_string); - } - } elseif (isset($options['email']) && !is_null($email = $options['email'])) { - $token = $tokens->get($email); - } elseif (count($all_tokens = $tokens->all()) == 1) { - $token = array_shift($all_tokens); - $this->log()->notice('Found a machine token for {email}.', ['email' => $token->get('email'),]); - } else { - if (count($all_tokens) > 1) { - throw new TerminusException( - "Tokens were saved for the following email addresses:\n{tokens}\nYou may log in via `terminus" - . " auth:login --email=`, or you may visit the dashboard to generate a machine" - . " token:\n{url}", - ['tokens' => implode("\n", $tokens->ids()), 'url' => $this->getMachineTokenCreationURL(),] - ); - } else { - throw new TerminusException( - "Please visit the dashboard to generate a machine token:\n{url}", - ['url' => $this->getMachineTokenCreationURL(),] - ); - } - } - if (isset($token)) { - $this->log()->notice('Logging in via machine token.'); - $token->logIn(); - } - } - - /** - * Generates the URL string for where to create a machine token - * - * @return string - */ - private function getMachineTokenCreationURL() - { - return vsprintf( - '%s://%s/machine-token/create/%s', - [ - $this->config->get('dashboard_protocol'), - $this->config->get('dashboard_host'), - gethostname(), - ] - ); - } -} diff --git a/src/Commands/Auth/LogoutCommand.php b/src/Commands/Auth/LogoutCommand.php deleted file mode 100644 index c2e8cd51b..000000000 --- a/src/Commands/Auth/LogoutCommand.php +++ /dev/null @@ -1,24 +0,0 @@ -session()->destroy(); - $this->log()->notice('You have been logged out of Pantheon.'); - } -} diff --git a/src/Commands/Auth/WhoamiCommand.php b/src/Commands/Auth/WhoamiCommand.php deleted file mode 100644 index f9da12ef0..000000000 --- a/src/Commands/Auth/WhoamiCommand.php +++ /dev/null @@ -1,37 +0,0 @@ -session()->isActive()) { - $user = $this->session()->getUser(); - return new AssociativeList($user->fetch()->serialize()); - } else { - $this->log()->notice('You are not logged in.'); - } - } -} diff --git a/src/Commands/Backup/GetCommand.php b/src/Commands/Backup/GetCommand.php deleted file mode 100644 index c69d760cc..000000000 --- a/src/Commands/Backup/GetCommand.php +++ /dev/null @@ -1,72 +0,0 @@ -getSiteEnv($site_env, 'dev'); - - if (in_array($file_or_element, Backups::getValidElements())) { - if ($file_or_element == 'db') { - $backup_element = 'database'; - } else { - $backup_element = $file_or_element; - } - - $backups = $env->backups->getFinishedBackups($backup_element); - if (empty($backups)) { - throw new TerminusNotFoundException( - "No backups available. Create one with `terminus backup:create {site}.{env}`", - [ - 'site' => $site->get('name'), - 'env' => $env->id - ], - 1 - ); - } else { - $backup = array_shift($backups); - } - } else { - $file = $file_or_element; - $backup = $env->backups->getBackupByFileName($file); - } - - $url = $backup->getUrl(); - return $url; - } -} diff --git a/src/Commands/Backup/ListCommand.php b/src/Commands/Backup/ListCommand.php deleted file mode 100644 index 77108272b..000000000 --- a/src/Commands/Backup/ListCommand.php +++ /dev/null @@ -1,75 +0,0 @@ -] - * - * @return RowsOfFields - * - * @field-labels - * file: Filename - * size: Size - * date: Date - * initiator: Initiator - * - * @example terminus backup:list awesome-site.dev database --format=json - * - */ - public function listBackups( - $site_env, - $element = 'all', - $options = ['format' => 'table'] - ) { - list(, $env) = $this->getSiteEnv($site_env, 'dev'); - - switch ($element) { - case 'all': - $backup_element = null; - break; - case 'db': - $backup_element = 'database'; - break; - default: - $backup_element = $element; - } - - $backups = $env->backups->getFinishedBackups($backup_element); - $data = []; - foreach ($backups as $id => $backup) { - $data[] = [ - 'file' => $backup->get('filename'), - 'size' => $backup->getSizeInMb(), - 'date' => $backup->getDate(), - 'initiator' => $backup->getInitiator(), - ]; - } - - // Return the output data. - return new RowsOfFields($data); - } -} diff --git a/src/Commands/CloneCommand.php b/src/Commands/CloneCommand.php deleted file mode 100644 index cd12224b2..000000000 --- a/src/Commands/CloneCommand.php +++ /dev/null @@ -1,191 +0,0 @@ - %message% \n Progress: %bar% %percent:3s%% \n Elapsed: %elapsed:6s% \n Estimated Time Remaining: %estimated:-6s%"; - protected $operations = ['cloneFiles', 'cloneDatabase']; - protected $origin_env; - protected $site_name; - protected $target_env; - - /** - * Clone database and/or files from one environment to another. - * - * @authorized - * - * @param $origin - * @param $target - * - * @param array $options - * - * @return void - */ - public function invokeClone($origin, $target, array $options = []) - { - - $this->setSiteName(explode('.', $origin)[0]) - ->setOriginEnv(explode('.', $origin)[1]) - ->setTargetEnv($target) - ->setOperations($this->filterOperations($options)); - array_map( - [$this, 'doOperation'], - $this->getOperations() - ); - } - - /** - * Prepare operation and execute. - * - * @param $operation - * - * @return bool - */ - protected function doOperation($operation = '') - { - $site = $this->getSite($this->site_name); - - $progress = $this->startProgressBar($operation); - $workflow = $this->triggerWorkflow($site, $operation); - - while (!$workflow->isFinished()) { - $this->doWorkflow($workflow, $progress); - } - $progress->finish(); - return true; - } - - /** - * Configure and trigger the workflow operation. - * - * @param \Terminus\Models\Site $site - * - * @param string $operation - * - * @return \Terminus\Models\Workflow - * @throws \Terminus\Exceptions\TerminusException - */ - protected function triggerWorkflow(Site $site, $operation = '') - { - return $site->environments - ->get($this->target_env) - ->$operation($this->origin_env); - } - - /** - * Setup the progress bar. - * - * @param string $operation - * - * @return \Symfony\Component\Console\Helper\ProgressBar - */ - protected function startProgressBar($operation = '') - { - ProgressBar::setFormatDefinition('minimal', self::PROGRESS_FORMAT); - $progress = $this->io()->createProgressBar(100); - $progress->setFormat('minimal'); - $progress->setMessage("Running {$operation}..."); - $progress->start(); - return $progress; - } - - /** - * Refresh Workflow data, advance progress, and hangout. - * - * @param \Terminus\Models\Workflow $workflow - * @param \Symfony\Component\Console\Helper\ProgressBar $progress - * - * @return bool - */ - protected function doWorkflow(Workflow $workflow, ProgressBar $progress) - { - $workflow->fetch(); - $progress->advance(1); - sleep(1); - return true; - } - - private function setOperations(array $operations = []) - { - $this->operations = $operations; - return $this; - } - - /** - * @return array Operations to be performed. - */ - private function getOperations() - { - return $this->operations; - } - - /** - * Set the origin environment. - * - * @param string $env - * - * @return $this - */ - private function setOriginEnv($env = '') - { - $this->origin_env = $env; - return $this; - } - - /** - * Set the target environment. - * - * @param string $env - * - * @return $this - */ - private function setTargetEnv($env = '') - { - $this->target_env = $env; - return $this; - } - - /** - * Set the site name. - * - * @param string $name - * - * @return $this - */ - private function setSiteName($name = '') - { - $this->site_name = $name; - return $this; - } - - /** - * Filters out operations a user does not want to perform. - * - * @param array $options Options passed from command call. - * - * @return array - */ - private function filterOperations(array $options = []) - { - $remove = []; - if ($options['db-only']) { - $remove[] = 'cloneFiles'; - } elseif ($options['files-only']) { - $remove[] = 'cloneDatabase'; - } - return array_filter( - $this->getOperations(), - function ($operation) use ($remove) { - return !in_array($operation, $remove); - } - ); - } -} diff --git a/src/Commands/Connection/InfoCommand.php b/src/Commands/Connection/InfoCommand.php deleted file mode 100644 index 6cc0a493a..000000000 --- a/src/Commands/Connection/InfoCommand.php +++ /dev/null @@ -1,70 +0,0 @@ -getSiteEnv($site_env_id); - - return new AssociativeList($env->connectionInfo()); - } -} diff --git a/src/Commands/Connection/SetCommand.php b/src/Commands/Connection/SetCommand.php deleted file mode 100644 index d7a9bb665..000000000 --- a/src/Commands/Connection/SetCommand.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * @return bool - * - * @throws TerminusException - */ - public function connectionSet($site_env_id, $mode) - { - list(, $env) = $this->getSiteEnv($site_env_id); - - if (in_array($env->id, ['test', 'live',])) { - throw new TerminusException( - 'Connection mode cannot be set on the {env} environment', - ['env' => $env->id,] - ); - } - - $workflow = $env->changeConnectionMode($mode); - if (is_string($workflow)) { - $this->log()->notice($workflow); - - return false; - } else { - while (!$workflow->checkProgress()) { - // TODO: (ajbarry) Add workflow progress output - } - $this->log()->notice($workflow->getMessage()); - } - - return true; - } -} diff --git a/src/Commands/Env/CloneContentCommand.php b/src/Commands/Env/CloneContentCommand.php deleted file mode 100644 index d74d52323..000000000 --- a/src/Commands/Env/CloneContentCommand.php +++ /dev/null @@ -1,33 +0,0 @@ - false, - 'files-only' => false, - ]) - { - $this->invokeClone($originSite, $targetEnv, $options); - } -} diff --git a/src/Commands/Env/CodeLogCommand.php b/src/Commands/Env/CodeLogCommand.php deleted file mode 100644 index b44b3b377..000000000 --- a/src/Commands/Env/CodeLogCommand.php +++ /dev/null @@ -1,55 +0,0 @@ -getSiteEnv($site_env, 'dev'); - $logs = $env->commits->all(); - $data = []; - foreach ($logs as $log) { - $data[] = [ - 'time' => $log->get('datetime'), - 'author' => $log->get('author'), - 'labels' => implode(', ', $log->get('labels')), - 'hash' => $log->get('hash'), - 'message' => trim( - str_replace( - "\n", - '', - str_replace("\t", '', substr($log->get('message'), 0, 50)) - ) - ), - ]; - } - return new RowsOfFields($data); - } -} diff --git a/src/Commands/Env/CommitCommand.php b/src/Commands/Env/CommitCommand.php deleted file mode 100644 index ec47c2b12..000000000 --- a/src/Commands/Env/CommitCommand.php +++ /dev/null @@ -1,39 +0,0 @@ - 'Terminus commit.']) - { - list(, $env) = $this->getSiteEnv($site_env, 'dev'); - - $change_count = count((array)$env->diffstat()); - if ($change_count === 0) { - $this->log()->warning("There is no code to commit."); - return; - } - - $workflow = $env->commitChanges($options['message']); - $workflow->wait(); - return $workflow->getMessage(); - } -} diff --git a/src/Commands/Env/DeployCommand.php b/src/Commands/Env/DeployCommand.php deleted file mode 100644 index db68b0ef1..000000000 --- a/src/Commands/Env/DeployCommand.php +++ /dev/null @@ -1,56 +0,0 @@ - false, - 'note' => 'Deploy from Terminus', - 'cc' => false, - 'updatedb' => false,]) - { - list(, $env) = $this->getSiteEnv($site_env, 'dev'); - - if (!$env->hasDeployableCode()) { - $this->log()->info('There is nothing to deploy.'); - return; - } - - $params = [ - 'updatedb' => (integer)$options['updatedb'], - 'clear_cache' => (integer)$options['cc'], - 'annotation' => $options['note'], - ]; - if ($env->id == 'test' && isset($options['sync-content'])) { - $params['clone_database'] = ['from_environment' => 'live',]; - $params['clone_files'] = ['from_environment' => 'live',]; - } - - $workflow = $env->deploy($params); - $workflow->wait(); - return $workflow->getMessage(); - } -} diff --git a/src/Commands/MachineToken/DeleteCommand.php b/src/Commands/MachineToken/DeleteCommand.php deleted file mode 100644 index 13445bf5b..000000000 --- a/src/Commands/MachineToken/DeleteCommand.php +++ /dev/null @@ -1,33 +0,0 @@ - - * Removes the given machine token from the user's account - */ - public function delete($machine_token_id) - { - // Find the token. Will throw an exception if it doesn't exist. - $machine_token = $this->session()->getUser()->machine_tokens->get($machine_token_id); - $name = $machine_token->get('device_name'); - - $this->log()->notice('Deleting {token} ...', ['token' => $name]); - $machine_token->delete(); - $this->log()->notice('Deleted {token}!', ['token' => $name]); - } -} diff --git a/src/Commands/MachineToken/ListCommand.php b/src/Commands/MachineToken/ListCommand.php deleted file mode 100644 index 81ab5d69b..000000000 --- a/src/Commands/MachineToken/ListCommand.php +++ /dev/null @@ -1,46 +0,0 @@ -session()->getUser()->machine_tokens->all(); - $data = array(); - foreach ($machine_tokens as $id => $machine_token) { - $data[] = array( - 'id' => $machine_token->id, - 'device_name' => $machine_token->get('device_name'), - ); - } - - if (count($data) == 0) { - $this->log()->warning('You have no machine tokens.'); - } - - // Return the output data. - return new RowsOfFields($data); - } -} diff --git a/src/Commands/Multidev/CreateCommand.php b/src/Commands/Multidev/CreateCommand.php deleted file mode 100644 index f13013c81..000000000 --- a/src/Commands/Multidev/CreateCommand.php +++ /dev/null @@ -1,40 +0,0 @@ -getSiteEnv($site_env, 'dev'); - $workflow = $site->environments->create($multidev, $env); - $workflow->wait(); - $message = $workflow->getMessage(); - if ($workflow->isSuccessful()) { - $this->log()->notice($message); - } else { - throw new TerminusException($message); - } - } -} diff --git a/src/Commands/Multidev/DeleteCommand.php b/src/Commands/Multidev/DeleteCommand.php deleted file mode 100644 index 9c2a62311..000000000 --- a/src/Commands/Multidev/DeleteCommand.php +++ /dev/null @@ -1,41 +0,0 @@ - false,]) - { - list(, $env) = $this->getSiteEnv($site_env); - $workflow = $env->delete(['delete_branch' => $options['delete-branch'],]); - $workflow->wait(); - if ($workflow->isSuccessful()) { - $this->log()->notice('Deleted the multidev environment {env}.', ['env' => $env->id,]); - } else { - throw new TerminusException($workflow->getMessage()); - } - } -} diff --git a/src/Commands/Multidev/ListCommand.php b/src/Commands/Multidev/ListCommand.php deleted file mode 100644 index cd89d0824..000000000 --- a/src/Commands/Multidev/ListCommand.php +++ /dev/null @@ -1,53 +0,0 @@ -serialize(); - }, - $this->sites->get($site_name)->environments->multidev() - ); - - if (empty($envs)) { - $this->log()->warning('You have no multidev environments.'); - } - - // Return the output data. - return new RowsOfFields($envs); - } -} diff --git a/src/Commands/Multidev/MergeFromDevCommand.php b/src/Commands/Multidev/MergeFromDevCommand.php deleted file mode 100644 index 2ab85bdfe..000000000 --- a/src/Commands/Multidev/MergeFromDevCommand.php +++ /dev/null @@ -1,41 +0,0 @@ - false,]) - { - list($site, $env) = $this->getSiteEnv($site_env); - $workflow = $env->mergeFromDev(['updatedb' => $options['updatedb'],]); - $workflow->wait(); - if ($workflow->isSuccessful()) { - $this->log()->notice('Merged the dev environment into {env}.', ['env' => $env->id,]); - } else { - throw new TerminusException($workflow->getMessage()); - } - } -} diff --git a/src/Commands/Multidev/MergeToDevCommand.php b/src/Commands/Multidev/MergeToDevCommand.php deleted file mode 100644 index 6a3756502..000000000 --- a/src/Commands/Multidev/MergeToDevCommand.php +++ /dev/null @@ -1,43 +0,0 @@ - false,]) - { - list($site, $env) = $this->getSiteEnv($site_env); - $workflow = $site->environments->get('dev')->mergeToDev( - ['from_environment' => $env->id, 'updatedb' => $options['updatedb'],] - ); - $workflow->wait(); - if ($workflow->isSuccessful()) { - $this->log()->notice('Merged the {env} environment into dev.', ['env' => $env->id,]); - } else { - throw new TerminusException($workflow->getMessage()); - } - } -} diff --git a/src/Commands/Remote/DrushCommand.php b/src/Commands/Remote/DrushCommand.php deleted file mode 100755 index 88d48bf17..000000000 --- a/src/Commands/Remote/DrushCommand.php +++ /dev/null @@ -1,52 +0,0 @@ - 'connection:info --field=mysql_command', - 'sql-sync' => '', - ]; - - /** - * Run arbitrary drush commands on a site environment - * - * @command remote:drush - * @aliases drush - * - * @authenticated - * - * @param string $site_env_id Name of the environment to run the drush command on. - * @param array $drush_command Drush command to invoke on the environment - * - * @return string Output of the given drush command executed on the site environment - */ - public function drushCommand($site_env_id, array $drush_command) - { - $this->prepareEnvironment($site_env_id); - - return $this->executeCommand($drush_command); - } -} diff --git a/src/Commands/Remote/SSHBaseCommand.php b/src/Commands/Remote/SSHBaseCommand.php deleted file mode 100755 index 33df51029..000000000 --- a/src/Commands/Remote/SSHBaseCommand.php +++ /dev/null @@ -1,126 +0,0 @@ -site, $this->environment) = $this->getSiteEnv($site_env_id); - } - - protected function executeCommand(array $command_args) - { - $output = ''; - - $this->validateEnvironment($this->site, $this->environment); - - if ($this->validateCommand($command_args)) { - $command_line = $this->getCommandLine($command_args); - - $result = $this->environment->sendCommandViaSsh($command_line); - $output = $result['output']; - $exit = $result['exit_code']; - - $this->log()->info('Command: {site}.{env} -- {command} [Exit: {exit}]', [ - 'site' => $this->site->get('name'), - 'env' => $this->environment->id, - 'command' => escapeshellarg($command_line), - 'exit' => $exit, - ]); - - if ($exit != 0) { - throw new TerminusException($output); - } - } - - return rtrim($output); - } - - protected function validateCommand(array $command) - { - $is_valid = true; - foreach ($command as $element) { - if (isset($this->unavailable_commands[$element])) { - $is_valid = false; - $message = "That command is not available via Terminus. "; - $message .= "Please use the native {command} command."; - $interpolations = ['command' => $this->command]; - if (!empty($alternative = $this->unavailable_commands[$element])) { - $message .= " Hint: You may want to try `{suggestion}`."; - $interpolations['suggestion'] = "terminus $alternative"; - } - $this->log()->error($message, $interpolations); - } - } - - return $is_valid; - } - - protected function validateEnvironment($site, $environment) - { - $this->validateConnectionMode($environment->get('connection_mode')); - $this->validateFramework($site->get('framework')); - } - - protected function validateConnectionMode($mode) - { - if ($mode == 'git') { - $this->log()->notice( - "This environment is in read-only Git mode. " - . "If you want to make changes to the codebase of this site " - . "(e.g. updating modules or plugins), " - . "you will need to toggle into read/write SFTP mode first." - ); - } - } - - protected function validateFramework($framework) - { - // print_r([$framework,$this->valid_frameworks]); - if (!in_array($framework, $this->valid_frameworks)) { - throw new TerminusException( - "The {command} command is only available on sites running {frameworks}. " - ."The framework for this site is {framework}.", - [ - 'command' => $this->command, - 'frameworks' => implode(", ", $this->valid_frameworks), - 'framework' => $framework, - ] - ); - } - } - - private function getCommandLine($command_args) - { - array_unshift($command_args, $this->command); - - return implode(" ", $command_args); - } -} diff --git a/src/Commands/Remote/WpCommand.php b/src/Commands/Remote/WpCommand.php deleted file mode 100755 index 963017896..000000000 --- a/src/Commands/Remote/WpCommand.php +++ /dev/null @@ -1,51 +0,0 @@ - '', - ]; - - /** - * Run arbitrary WP-CLI commands on a site environment - * - * @command remote:wp - * @aliases wp - * - * @authenticated - * - * @param string $site_env_id Name of the environment to run the WP-CLI command on. - * @param array $wp_command WP-CLI command to invoke on the environment - * - * @return string Output of the given WP-CLI command executed on the site environment - */ - public function wpCommand($site_env_id, array $wp_command) - { - $this->prepareEnvironment($site_env_id); - - return $this->executeCommand($wp_command); - } -} diff --git a/src/Commands/SSHKey/AddCommand.php b/src/Commands/SSHKey/AddCommand.php deleted file mode 100644 index 4c44c206c..000000000 --- a/src/Commands/SSHKey/AddCommand.php +++ /dev/null @@ -1,32 +0,0 @@ -session()->getUser()->ssh_keys->addKey($file); - $this->log()->notice('Added SSH key from file {file}.', compact('file')); - } -} diff --git a/src/Commands/SSHKey/DeleteCommand.php b/src/Commands/SSHKey/DeleteCommand.php deleted file mode 100644 index 163ba0fa2..000000000 --- a/src/Commands/SSHKey/DeleteCommand.php +++ /dev/null @@ -1,40 +0,0 @@ - - * Removes the SSH key with the specified id from the user's account - */ - public function delete($ssh_key_id) - { - - // Remove ':' to allow the id to be specified in ssh thumbnail format. - $ssh_key_id = str_replace(':', '', $ssh_key_id); - // Find the key. Will throw an exception if it doesn't exist. - $key = $this->session()->getUser()->ssh_keys->get($ssh_key_id); - $name = $key->get('id'); - - $this->log()->notice('Deleting SSH key {key} ...', ['key' => $name]); - $key->delete(); - $this->log()->notice('Deleted SSH key {key}!', ['key' => $name]); - } -} diff --git a/src/Commands/SSHKey/ListCommand.php b/src/Commands/SSHKey/ListCommand.php deleted file mode 100644 index 3566af028..000000000 --- a/src/Commands/SSHKey/ListCommand.php +++ /dev/null @@ -1,51 +0,0 @@ - 'table', 'fields' => '']) - { - $ssh_keys = $this->session()->getUser()->ssh_keys->all(); - - $data = []; - foreach ($ssh_keys as $id => $ssh_key) { - $data[] = array( - 'id' => $ssh_key->get('id'), - 'hex' => $ssh_key->getHex(), - 'comment' => $ssh_key->getComment(), - ); - } - if (count($data) == 0) { - $this->log()->warning('You have no ssh keys.'); - } - return new RowsOfFields($data); - } -} diff --git a/src/Commands/Site/DeleteCommand.php b/src/Commands/Site/DeleteCommand.php deleted file mode 100644 index 4659b362f..000000000 --- a/src/Commands/Site/DeleteCommand.php +++ /dev/null @@ -1,28 +0,0 @@ - - * Deletes the named site from Pantheon - */ - public function delete($site_name) - { - $site = $this->getSite($site_name); - $site->delete(); - $this->log()->notice('Deleted {site} from Pantheon', ['site' => $site_name,]); - } -} diff --git a/src/Commands/Site/ImportCommand.php b/src/Commands/Site/ImportCommand.php deleted file mode 100644 index 79aea7de6..000000000 --- a/src/Commands/Site/ImportCommand.php +++ /dev/null @@ -1,41 +0,0 @@ - - * Imports the file at the archive URL to the site named. - */ - public function import($sitename, $url) - { - $site = $sitename; - list(, $env) = $this->getSiteEnv($site, 'dev'); - $workflow = $env->import($url); - try { - $workflow->wait(); - } catch (\Exception $e) { - if ($e->getMessage() == 'Successfully queued import_site') { - throw new TerminusException('Site import failed'); - } - throw $e; - } - $this->log()->notice('Imported site onto Pantheon'); - } -} diff --git a/src/Commands/Site/InfoCommand.php b/src/Commands/Site/InfoCommand.php deleted file mode 100644 index a9caefbed..000000000 --- a/src/Commands/Site/InfoCommand.php +++ /dev/null @@ -1,49 +0,0 @@ - - * * Responds with the table view of site information - * * Responds that you are forbidden if you access a site that exists - * but you do not have access to it - * * Responds that a site does not exist - * @usage terminus site:info --field= - * * Responds with the single field of site information requested - * * Responds that you are forbidden if you access a site that exists - * but you do not have access to it - * * Responds that a site does not exist - * @return AssociativeList - */ - public function info($site) - { - return new AssociativeList($this->sites->get($site)->serialize()); - } -} diff --git a/src/Commands/Site/ListCommand.php b/src/Commands/Site/ListCommand.php deleted file mode 100644 index e7df1078c..000000000 --- a/src/Commands/Site/ListCommand.php +++ /dev/null @@ -1,91 +0,0 @@ - - * * Responds with a list of sites owned by the user with the given UUID - * * Responds with a notice stating no sites match criteria if none exist - * @usage terminus site:list --owner=me - * * Responds with a list of sites the logged-in user owns - * * Responds with a notice stating no sites match criteria if none exist - * @usage terminus site:list --org= - * * Responds with a list of sites inside the organization(s) indicated - * * Responds with a notice stating no sites match criteria if none exist - * @usage terminus site:list --org=all - * * Responds with a list of sites belonging to organization you are a member of - * * Responds with a notice stating no sites match criteria if none exist - * @usage terminus site:list --name= - * * Responds with a list of sites you have access to by name - * * Responds with a notice stating no sites match criteria if none exist - * @return RowsOfFields - */ - public function index($options = ['team' => false, 'owner' => null, 'org' => null, 'name' => null,]) - { - $this->sites->fetch( - [ - 'org_id' => $options['org'], - 'team_only' => $options['team'], - ] - ); - - if (!is_null($name = $options['name'])) { - $this->sites->filterByName($name); - } - if (!is_null($owner = $options['owner'])) { - if ($owner == 'me') { - $owner = $this->session()->getUser()->id; - } - $this->sites->filterByOwner($owner); - } - - $all_sites = array_map( - function ($site) { - $site_data = $site->serialize(); - return [ - 'name' => $site_data['name'], - 'id' => $site_data['id'], - 'service_level' => $site_data['service_level'], - 'framework' => $site_data['framework'], - 'owner' => $site_data['owner'], - 'created' => $site_data['created'], - 'memberships' => implode(',', $site->memberships), - ]; - }, - $this->sites->all() - ); - - if (empty($all_sites)) { - $this->log()->notice('You have no sites.'); - } - - return new RowsOfFields($all_sites); - } -} diff --git a/src/Commands/Site/LookupCommand.php b/src/Commands/Site/LookupCommand.php deleted file mode 100644 index 70515f3c8..000000000 --- a/src/Commands/Site/LookupCommand.php +++ /dev/null @@ -1,37 +0,0 @@ - - * * Responds with the UUID of a site if it exists and you have access to it - * * Responds that you are forbidden if you access a site that exists - * but you do not have access to it - * * Responds that a site does not exist - * @return AssociativeList - */ - public function lookup($site_name) - { - $response = (array)$this->sites()->findUuidByName($site_name); - return new AssociativeList($response); - } -} diff --git a/src/Commands/Site/SiteCommand.php b/src/Commands/Site/SiteCommand.php deleted file mode 100644 index f073b4944..000000000 --- a/src/Commands/Site/SiteCommand.php +++ /dev/null @@ -1,12 +0,0 @@ - 'team_member']) - { - $site = $this->getSite($site_id); - $team = $site->user_memberships; - - if ((boolean)$site->getFeature('change_management')) { - $role = $options['role']; - } else { - $role = 'team_member'; - $this->log()->warning("Site does not have change management enabled, defaulting to user role '$role'"); - } - $workflow = $team->create($member, $role); - return $workflow->getMessage(); - } -} diff --git a/src/Commands/Site/Team/ListCommand.php b/src/Commands/Site/Team/ListCommand.php deleted file mode 100644 index ed232e0df..000000000 --- a/src/Commands/Site/Team/ListCommand.php +++ /dev/null @@ -1,50 +0,0 @@ -getSite($site_id); - $user_memberships = $site->user_memberships->all(); - $data = []; - foreach ($user_memberships as $user_membership) { - $user = $user_membership->get('user'); - $data[] = array( - 'first' => $user->profile->firstname, - 'last' => $user->profile->lastname, - 'email' => $user->email, - 'role' => $user_membership->get('role'), - 'uuid' => $user->id, - ); - } - return new RowsOfFields($data); - } -} diff --git a/src/Commands/Site/Team/RemoveCommand.php b/src/Commands/Site/Team/RemoveCommand.php deleted file mode 100644 index c94ad207a..000000000 --- a/src/Commands/Site/Team/RemoveCommand.php +++ /dev/null @@ -1,33 +0,0 @@ -getSite($site_id); - $team = $site->user_memberships; - $user = $team->get($member); - $workflow = $user->delete(); - return $workflow->getMessage(); - } -} diff --git a/src/Commands/Site/Team/RoleCommand.php b/src/Commands/Site/Team/RoleCommand.php deleted file mode 100644 index 4acdaffe0..000000000 --- a/src/Commands/Site/Team/RoleCommand.php +++ /dev/null @@ -1,37 +0,0 @@ -getSite($site_id); - if (!(boolean)$site->getFeature('change_management')) { - throw new TerminusException('This site does not have its change-management option enabled.'); - } - $team = $site->user_memberships; - $user = $team->get($member); - $workflow = $user->setRole($role); - return $workflow->getMessage(); - } -} diff --git a/src/Commands/TerminusCommand.php b/src/Commands/TerminusCommand.php deleted file mode 100644 index ca479ca60..000000000 --- a/src/Commands/TerminusCommand.php +++ /dev/null @@ -1,42 +0,0 @@ -logger; - } -} diff --git a/src/Commands/Upstream/UpdatesApplyCommand.php b/src/Commands/Upstream/UpdatesApplyCommand.php deleted file mode 100644 index 19335f7b7..000000000 --- a/src/Commands/Upstream/UpdatesApplyCommand.php +++ /dev/null @@ -1,61 +0,0 @@ -. - * Lists the available updates for the site called and the environment - */ - public function applyUpstreamUpdates( - $site_env_id, - $options = ['updatedb' => true, 'accept-upstream' => true,] - ) { - - list($site, $env) = $this->getSiteEnv($site_env_id, 'dev'); - - if (in_array($env->id, ['test', 'live',])) { - throw new TerminusException( - 'Upstream updates cannot be applied to the {env} environment', - ['env' => $env->id,] - ); - } - - $updates = $this->getUpstreamUpdatesLog($site); - $count = count($updates); - if ($count) { - $this->log()->notice( - 'Applying {count} upstream update(s) to the {env} environment of {site_id}...', - ['count' => $count, 'env' => $env->id, 'site_id' => $site->get('name'),] - ); - - $workflow = $env->applyUpstreamUpdates( - $options['updatedb'], - $options['accept-upstream'] - ); - - while (!$workflow->checkProgress()) { - // @TODO: Add Symfony progress bar to indicate that something is happening. - } - $this->log()->notice($workflow->getMessage()); - } else { - $this->log()->warning("There are no available updates for this site."); - } - } -} diff --git a/src/Commands/Upstream/UpdatesListCommand.php b/src/Commands/Upstream/UpdatesListCommand.php deleted file mode 100644 index 08b12b07a..000000000 --- a/src/Commands/Upstream/UpdatesListCommand.php +++ /dev/null @@ -1,53 +0,0 @@ - - * Lists the available updates for the site called - */ - public function listUpstreamUpdates($site_id) - { - $site = $this->getSite($site_id); - $data = []; - foreach ($this->getUpstreamUpdatesLog($site) as $commit) { - $data[] = [ - 'hash' => $commit->hash, - 'datetime' => $commit->datetime, - 'message' => $commit->message, - 'author' => $commit->author, - ]; - } - - if (empty($data)) { - $this->log()->warning("There are no available updates for this site."); - } - - // Return the output data. - return new RowsOfFields($data); - } -} diff --git a/src/Commands/Upstream/UpstreamCommand.php b/src/Commands/Upstream/UpstreamCommand.php deleted file mode 100644 index 23d48b726..000000000 --- a/src/Commands/Upstream/UpstreamCommand.php +++ /dev/null @@ -1,48 +0,0 @@ -upstream->getUpdates(); - - if (empty($upstream)) { - $message = 'There was a problem checking your upstream status. Please try again.'; - throw new TerminusException($message); - } - return $upstream; - } - - /** - * Get the list of upstream updates for a site. - * - * @param $site - * @return array The list of updates - * @throws TerminusException - */ - protected function getUpstreamUpdatesLog($site) - { - $upstream = $this->getUpstreamUpdates($site); - if (!empty($upstream->update_log)) { - return (array)$upstream->update_log; - } - return []; - } -} diff --git a/src/Commands/Workflow/ListCommand.php b/src/Commands/Workflow/ListCommand.php deleted file mode 100644 index 87f863785..000000000 --- a/src/Commands/Workflow/ListCommand.php +++ /dev/null @@ -1,55 +0,0 @@ -getSite($site_id); - $site->workflows->fetch(['paged' => false]); - $workflows = $site->workflows->all(); - - $data = []; - foreach ($workflows as $workflow) { - $workflow_data = $workflow->serialize(); - unset($workflow_data['operations']); - $data[] = $workflow_data; - } - if (count($data) == 0) { - $this->log()->warning( - 'No workflows have been run on {site}.', - ['site' => $site->get('name')] - ); - } - return new RowsOfFields($data); - } -} diff --git a/src/Config.php b/src/Config.php deleted file mode 100644 index a79fe673c..000000000 --- a/src/Config.php +++ /dev/null @@ -1,285 +0,0 @@ - default value of the global options. - return []; - } - - /** - * @inheritdoc - * @throws TerminusException - */ - public function get($key, $defaultOverride = null) - { - if (!$this->configured) { - $this->configure(); - $this->configured = true; - } - if (!isset($this->config[$key])) { - throw new TerminusException('No configuration setting for {key} found.', compact('key')); - } - - return parent::get($key); - } - - /** - * Returns the appropriate home directory. - * - * Adapted from Terminus Package Manager by Ed Reel - * @author Ed Reel <@uberhacker> - * @url https://github.com/uberhacker/tpm - * - * @return string - */ - public function getHomeDir() - { - $home = getenv('HOME'); - if (!$home) { - $system = ''; - if (getenv('MSYSTEM') !== null) { - $system = strtoupper(substr(getenv('MSYSTEM'), 0, 4)); - } - if ($system != 'MING') { - $home = getenv('HOMEPATH'); - } - } - return $home; - } - - /** - * Sets constants necessary for the proper functioning of Terminus - * - * @return void - */ - private function configure() - { - $this->importEnvironmentVariables(); - $this->config['root'] = $this->getTerminusRoot(); - $this->config['php'] = $this->getPhpBinary(); - $this->config['script'] = $this->getTerminusScript(); - - $file_config = Yaml::parse( - file_get_contents($this->config['root'] . $this->config_path) - ); - foreach ($file_config as $name => $setting) { - $key = $this->getKeyFromConstant($name); - if (isset($this->config[$key])) { - continue; - } elseif (defined($name)) { - $setting = constant($name); - } elseif (isset($_SERVER[$name]) && ($_SERVER[$name] != '')) { - $setting = $_SERVER[$name]; - } elseif (getenv($name)) { - $setting = getenv($name); - } - $value = $this->replacePlaceholders($setting); - $this->ensureDirExists($name, $value); - $this->config[$key] = $value; - } - // TODO: revisit this: it seems that Terminus configuration - // should not override the timezone set in php.ini. - // date_default_timezone_set($this->get('time_zone')); - } - - /** - * Ensures a directory exists - * - * @param string $name The name of the config var - * @param string $value The value of the named config var - * @return bool - */ - private function ensureDirExists($name, $value) - { - if ((strpos($name, 'TERMINUS_') !== false) - && (strpos($name, '_DIR') !== false) - && ($value != '~') - ) { - try { - $dir_exists = (is_dir($value) - || (!file_exists($value) && @mkdir($value, 0777, true))); - } catch (\Exception $e) { - return false; - } - return $dir_exists; - } - return null; - } - - /** - * Returns location of PHP with which to run Terminus - * - * @return string - */ - private function getPhpBinary() - { - if (isset($this->config['php'])) { - return $this->config['php']; - } - if (getenv('TERMINUS_PHP')) { - $php_bin = getenv('TERMINUS_PHP'); - } elseif (defined('PHP_BINARY')) { - $php_bin = PHP_BINARY; - } else { - $php_bin = 'php'; - } - return $php_bin; - } - - /** - * Finds and returns the root directory of Terminus - * - * @param string $current_dir Directory to start searching at - * @return string - */ - private function getTerminusRoot($current_dir = null) - { - if (isset($this->config['root'])) { - return $this->config['root']; - } - if (defined('TERMINUS_ROOT')) { - return TERMINUS_ROOT; - } - - if (is_null($current_dir)) { - $current_dir = dirname(__DIR__); - } - if (file_exists("$current_dir/composer.json")) { - return $current_dir; - } - $dir = explode('/', $current_dir); - array_pop($dir); - if (empty($dir)) { - throw new TerminusError('Could not locate root to set TERMINUS_ROOT.'); - } - $dir = implode('/', $dir); - $root_dir = $this->getTerminusRoot($dir); - return $root_dir; - } - - /** - * Finds and returns the name of the script running Terminus functions - * - * @return string - */ - private function getTerminusScript() - { - if (isset($this->config['script'])) { - return $this->config['script']; - } - if (defined('TERMINUS_SCRIPT')) { - return TERMINUS_SCRIPT; - } - - $debug = debug_backtrace(); - $script_location = array_pop($debug); - $script_name = str_replace( - $this->config['root'] . '/', - '', - $script_location['file'] - ); - return $script_name; - } - - /** - * Ensures that directory paths work in any system - * - * @param string $path A path to set the directory separators for - * @return string - */ - private function fixDirectorySeparators($path) - { - $fixed_path = str_replace( - ['/', '\\',], - DIRECTORY_SEPARATOR, - $path - ); - return $fixed_path; - } - - /** - * Imports environment variables - * - * @return void - */ - private function importEnvironmentVariables() - { - //Load environment variables from __DIR__/.env - if (file_exists(getcwd() . '/.env')) { - $env = new Dotenv(getcwd()); - $env->load(); - } - } - - /** - * Exchanges values in [[ ]] in the given string with constants - * - * @param string $string The string to perform replacements on - * @return string $string The modified string - */ - private function replacePlaceholders($string) - { - $regex = '~\[\[(.*?)\]\]~'; - preg_match_all($regex, $string, $matches); - if (!empty($matches)) { - foreach ($matches[1] as $id => $value) { - $replacement_key = $this->getKeyFromConstant(trim($value)); - if (isset($this->config[$replacement_key])) { - $replacement = $this->config[$replacement_key]; - $string = str_replace($matches[0][$id], $replacement, $string); - } - } - } - $fixed_string = $this->fixDirectorySeparators( - str_replace('~', $this->getHomeDir(), $string) - ); - return $fixed_string; - } - - /** - * Reflects a key name given a Terminus constant name - * - * @param string $constant_name The name of a constant to get a key for - * @return string - */ - private function getKeyFromConstant($constant_name) - { - $key = strtolower(str_replace($this->constant_prefix, '', $constant_name)); - return $key; - } -} diff --git a/src/Models/SavedToken.php b/src/Models/SavedToken.php deleted file mode 100644 index 04a534c74..000000000 --- a/src/Models/SavedToken.php +++ /dev/null @@ -1,65 +0,0 @@ -session = $options['collection']->session; - } - - /** - * Starts a session with this saved token - * - * @return User An object representing the now-logged-in user - */ - public function logIn() - { - $options = [ - 'form_params' => ['machine_token' => $this->get('token'), 'client' => 'terminus',], - 'method' => 'post', - ]; - $response = $this->request->request('authorize/machine-token', $options); - $this->session->setData((array)$response['data']); - return $this->session->getUser(); - } - - /** - * Saves this token to a file in the tokens cache dir - */ - public function saveToDir() - { - $this->set('date', time()); - $config = new Config(); - $token_path = $config->get('tokens_dir') . "/{$this->id}"; - file_put_contents($token_path, json_encode($this->attributes)); - } - - /** - * @inheritdoc - */ - protected function parseAttributes($data) - { - if (property_exists($data, 'email')) { - $data->id = $data->email; - } - return $data; - } -} diff --git a/src/Runner.php b/src/Runner.php deleted file mode 100644 index 6a5945c0b..000000000 --- a/src/Runner.php +++ /dev/null @@ -1,103 +0,0 @@ -config = $container->get('config'); - $this->commands = $this->getCommands(['path' => $commands_directory, 'namespace' => $top_namespace,]); - $this->commands[] = 'Pantheon\\Terminus\\Authorizer'; - $this->runner = new RoboRunner(); - $this->runner->setContainer($container); - } - - /** - * Runs the instantiated Terminus application - * - * @param InputInterface $input An input object to run the application with - * @param OutputInterface $output An output object to run the application with - * @return integer $status_code The exiting status code of the application - */ - public function run(InputInterface $input, OutputInterface $output) - { - if (!empty($cassette = $this->config->get('vcr_cassette')) && !empty($mode = $this->config->get('vcr_mode'))) { - $this->startVCR(array_merge(compact('cassette'), compact('mode'))); - } - $status_code = $this->runner->run($input, $output, null, $this->commands); - if (!empty($cassette) && !empty($mode)) { - $this->stopVCR(); - } - return $status_code; - } - - /** - * Discovers command classes using CommandFileDiscovery - * - * @param string[] $options Elements as follow - * string path The full path to the directory to search for commands - * string namespace The full namespace associated with given the command directory - * @return TerminusCommand[] An array of TerminusCommand instances - */ - private function getCommands(array $options = ['path' => null, 'namespace' => null,]) - { - $discovery = new CommandFileDiscovery(); - $discovery->setSearchPattern('*Command.php')->setSearchLocations([]); - return $discovery->discover($options['path'], $options['namespace']); - } - - /** - * Starts and configures PHP-VCR - * - * @param string[] $options Elements as follow: - * string cassette The name of the fixture in tests/fixtures to record or run in this feature test run - * string mode Mode in which to run PHP-VCR (options are none, once, strict, and new_episodes) - * @return void - */ - private function startVCR(array $options = ['cassette' => 'tmp', 'mode' => 'none',]) - { - VCR::configure()->enableRequestMatchers(['method', 'url', 'body',]); - VCR::configure()->setMode($options['mode']); - VCR::turnOn(); - VCR::insertCassette($options['cassette']); - } - - /** - * Stops PHP-VCR's recording and playback - * - * @return void - */ - private function stopVCR() - { - VCR::eject(); - VCR::turnOff(); - } -} diff --git a/src/Session/Session.php b/src/Session/Session.php deleted file mode 100644 index f990f0581..000000000 --- a/src/Session/Session.php +++ /dev/null @@ -1,99 +0,0 @@ -cache = $file_cache; - $this->data = (object)$this->cache->getData('session'); - $this->tokens = new SavedTokens(['session' => $this,]); - } - - /** - * Removes the session from the cache - */ - public function destroy() - { - $this->cache->remove('session'); - $this->data = (object)[]; - } - - /** - * Returns given data property or default if DNE. - * - * @param string $key Name of property to return - * @return mixed - * @throws TerminusException If the given key is not located - */ - public function get($key) - { - if (isset($this->data->$key)) { - return $this->data->$key; - } - throw new TerminusException('The {key} property cannot be found in the cache data.', compact('key')); - } - - /** - * Returns a user with the current session user id - * - * @return User A User object reperesenting the logged-in user - */ - public function getUser() - { - // TODO: Remove this direct instantiation to make this more testable - return new User((object)['id' => $this->get('user_id'),]); - } - - /** - * Responds with the status of this session (i.e. whether the client is logged in) - * - * @return boolean - */ - public function isActive() - { - return ( - isset($this->data->session) - && ($this->data->expires_at >= time() || (boolean)$this->config->get('test_mode')) - ); - } - - /** - * Saves session data to cache - * - * @param array $data Session data to save - */ - public function setData($data) - { - $this->cache->putData('session', $data); - $this->data = (object)$data; - } -} diff --git a/src/Session/SessionAwareInterface.php b/src/Session/SessionAwareInterface.php deleted file mode 100644 index 0a7f5d022..000000000 --- a/src/Session/SessionAwareInterface.php +++ /dev/null @@ -1,28 +0,0 @@ -session = $session; - - return $this; - } - - /** - * @inheritdoc - */ - public function session() - { - return $this->session; - } -} diff --git a/src/Site/SiteAwareInterface.php b/src/Site/SiteAwareInterface.php deleted file mode 100644 index 7730cc46f..000000000 --- a/src/Site/SiteAwareInterface.php +++ /dev/null @@ -1,42 +0,0 @@ -[.] - * @param string $default_env The default environment to use if none is specified. - * @return array The site and environment in an array. - */ - public function getSiteEnv($site_env_id, $default_env); -} diff --git a/src/Site/SiteAwareTrait.php b/src/Site/SiteAwareTrait.php deleted file mode 100644 index d762e607f..000000000 --- a/src/Site/SiteAwareTrait.php +++ /dev/null @@ -1,73 +0,0 @@ -sites = $sites; - } - - /** - * @return Sites The sites collection for the authenticated user. - */ - public function sites() - { - return $this->sites; - } - - /** - * Look up a site by id. - * - * @param Site $site_id Either a site's UUID or its name - * @return mixed - */ - public function getSite($site_id) - { - return $this->sites()->get($site_id); - } - - /** - * Get the site and environment with the given ids. - * - * @TODO This should be moved to the input/validation stage when that is available. - * - * @param string $site_env_id The site/environment id in the form [.] - * @param string $default_env The default environment to use if none is specified. - * @return array The site and environment in an array. - * @throws \Terminus\Exceptions\TerminusException - */ - public function getSiteEnv($site_env_id, $default_env = null) - { - $parts = explode('.', $site_env_id); - $site_id = $parts[0]; - $env_id = !empty($parts[1]) ? $parts[1] : $default_env; - - if (empty($site_id) || empty($env_id)) { - throw new TerminusException('The environment argument must be given as .'); - } - - $site = $this->getSite($site_id); - $env = $site->environments->get($env_id); - return [$site, $env]; - } -} diff --git a/src/Terminus.php b/src/Terminus.php deleted file mode 100644 index 6f29bad9b..000000000 --- a/src/Terminus.php +++ /dev/null @@ -1,40 +0,0 @@ -config = $config; - parent::__construct($name, $version); - $this->getDefinition()->addOption( - new InputOption('--yes', '-y', InputOption::VALUE_NONE, 'Answer yes to all prompts') - ); - } - - /** - * @inheritdoc - */ - protected function getDefaultHelperSet() - { - $helper_set = parent::getDefaultHelperSet(); - //$helper_set->set(new Pantheon\Terminus\Helpers\FileHelper()); - return $helper_set; - } -} diff --git a/tests/active_features/art.feature b/tests/active_features/art.feature deleted file mode 100644 index 92f44f5b2..000000000 --- a/tests/active_features/art.feature +++ /dev/null @@ -1,41 +0,0 @@ -Feature: ASCII Art display - - Scenario: Display fist art - When I run "terminus art fist" - Then I should get: ".+." - - Scenario: Display Druplicon art - When I run "terminus art druplicon" - Then I should get: ".." - - Scenario: Display WordPress art - When I run "terminus art wordpress" - Then I should get: "............." - - Scenario: Display unicorn art - When I run "terminus art unicorn" - Then I should get: "\" - - Scenario: Display available art - When I run "terminus art" - Then I should get: "" - And I should get: "Available Art" - And I should get: "=============" - And I should get: "" - And I should get: "* druplicon" - And I should get: "* fist" - And I should get: "* hello" - And I should get: "* rocket" - And I should get: "* unicorn" - And I should get: "* wordpress" - - Scenario: Display random art - When I run "terminus art random" - Then I should get one of the following: ">\/7, +?????????=., .xWWXo;;;;;,'., ......''......, (( )), Hello World!" - - - - Scenario: Fail to display non-existent artwork - When I run "terminus art invalid" - Then I should get: "" - And I should get: "There is no source for the requested invalid artwork" diff --git a/tests/active_features/auth.feature b/tests/active_features/auth.feature deleted file mode 100644 index 329767b83..000000000 --- a/tests/active_features/auth.feature +++ /dev/null @@ -1,91 +0,0 @@ -Feature: Authorization command - In order to use Terminus - As a user - I need to be able to log in to the system. - - @vcr auth_login - Scenario: Logging in - Given I am not authenticated - When I run "terminus auth:login --machine-token=[[machine_token]]" - Then I should get: "Logging in via machine token." - - @vcr auth_login_machine-token_invalid - Scenario: Failing to log in via invalid machine token - Given I am not authenticated - When I run "terminus auth:login --machine-token=invalid" - Then I should get: "Logging in via machine token." - And I should get: "Server error: `POST https://onebox/api/authorize/machine-token` resulted in a `500 Internal Server Error` response:" - And I should get: "Authorization failed. Please check that your machine token is valid." - - Scenario: Failing to log in by saved token when no such user's was saved - Given I have no saved machine tokens - When I run "terminus auth:login --email=invalid" - Then I should get: - """ - Could not find a saved token identified by invalid. - """ - - Scenario: Failing to log in automatically when multiple machine tokens have been saved - Given I have at least "2" saved machine tokens - When I run "terminus auth:login" - Then I should get: - """ - Please visit the dashboard to generate a machine token: - """ - - Scenario: Failing to log in automatically when no machine tokens have been saved - Given I have no saved machine tokens - When I run "terminus auth:login" - Then I should get: - """ - Please visit the dashboard to generate a machine token: - """ - - @vcr auth_logout - Scenario: Logging out - Given I am authenticated - When I run "terminus auth:logout" - Then I should get: - """ - You have been logged out of Pantheon. - """ - - @vcr auth_whoami - Scenario: Check Which User I Am - Given I am authenticated - When I run "terminus auth:whoami" - Then I should get: - """ - [[username]] - """ - - @vcr auth_whoami - Scenario: Check which user I am by ID - Given I am authenticated - When I run "terminus auth:whoami --fields=id" - Then I should get: - """ - [[user_id]] - """ - And I should not get: - """ - [[username]] - """ - - @vcr auth_whoami - Scenario: Displaying fields in a session in a table - Given I am authenticated - When I run "terminus auth:whoami --format=table --fields=email,id" - Then I should get: "------- --------------------------------------" - And I should get: "eMail [[username]]" - And I should get: "ID [[user_id]]" - And I should get: "------- --------------------------------------" - - Scenario: Checking my user should not get any useful result when I am logged out. - When I am not authenticated - And I run "terminus auth:whoami" - Then I should get: "You are not logged in." - And I should not get: - """ - [[username]] - """ diff --git a/tests/active_features/backup-get.feature b/tests/active_features/backup-get.feature deleted file mode 100644 index 2d655129b..000000000 --- a/tests/active_features/backup-get.feature +++ /dev/null @@ -1,32 +0,0 @@ -Feature: Get a particular backup for a Site - In order to secure my site against failures - As a user - I need to be able to get download information for a backup - - Background: I am authenticated and have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_backups_get_file - Scenario: Get the URL of the latest code backup - When I run "terminus backup:get [[test_site_name]].dev code" - Then I should get: - """ - https://pantheon-backups.s3.amazonaws.com/11111111-1111-1111-1111-111111111111/dev/1471562180_backup/behat-tests_dev_2016-08-18T23-16-20_UTC_code.tar.gz?Signature=INoN9zDlMfWa8A%2B%2BtxqdLhRI1Rs%3D&Expires=1471565930&AWSAccessKeyId=AKIAJEYKXMCPBZQYJYXQ - """ - - @vcr site_backups_get_file - Scenario: Get the URL of a specific backup by filename - When I run "terminus backup:get [[test_site_name]].dev behat-tests_dev_2016-08-18T23-16-20_UTC_code.tar.gz" - Then I should get: - """ - https://pantheon-backups.s3.amazonaws.com/11111111-1111-1111-1111-111111111111/dev/1471562180_backup/behat-tests_dev_2016-08-18T23-16-20_UTC_code.tar.gz?Signature=INoN9zDlMfWa8A%2B%2BtxqdLhRI1Rs%3D&Expires=1471565930&AWSAccessKeyId=AKIAJEYKXMCPBZQYJYXQ - """ - - @vcr site_backups_get_none - Scenario: Fail to find a matching backup - When I run "terminus backup:get [[test_site_name]].test database" - Then I should get: - """ - No backups available. Create one with `terminus backup:create [[test_site_name]].test` - """ diff --git a/tests/active_features/backup-list.feature b/tests/active_features/backup-list.feature deleted file mode 100644 index acb635170..000000000 --- a/tests/active_features/backup-list.feature +++ /dev/null @@ -1,21 +0,0 @@ -Feature: List Backups for a Site - In order to ensure the security of my site content - As a user - I need to be able to list my backups. - - Background: I am authenticated and have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_backups_list - Scenario: Show all backups for an environment - When I run "terminus backup:list [[test_site_name]].dev --format=json" - Then I should have "7" records - And I should get: "code.tar.gz" - - @vcr site_backups_list - Scenario: Filter backups by element - When I run "terminus backup:list [[test_site_name]].dev db --format=json" - Then I should have "2" records - And I should get: "database.sql.gz" - And I should not get: "code.tar.gz" diff --git a/tests/active_features/bootstrap/FeatureContext.php b/tests/active_features/bootstrap/FeatureContext.php deleted file mode 100644 index dbb82b63d..000000000 --- a/tests/active_features/bootstrap/FeatureContext.php +++ /dev/null @@ -1,1079 +0,0 @@ -cliroot = dirname(dirname(__DIR__)) . '/..'; - $this->parameters = $parameters; - $this->start_time = time(); - $this->connection_info = ['host' => $parameters['host'], 'machine_token' => $parameters['machine_token'],]; - - $this->cache_dir = $parameters['cache_dir']; - $this->cache_token_dir = $this->cache_dir . "/tokens"; - } - - /** - * Ensures the user has access to the given payment instrument - * @Given /^a payment instrument with uuid "([^"]*)"$/ - * - * @param [string] $instrument_uuid UUID of a payment instrument - * @return [void] - */ - public function aPaymentInstrumentWithUuid($instrument_uuid) - { - $instruments = $this->iRun('terminus upstream:list'); - try { - $uuid = new PyStringNode($this->replacePlaceholders($instrument_uuid)); - $this->iShouldGet($uuid); - } catch (\Exception $e) { - throw new \Exception("Your user does not have access to instrument $instrument_uuid."); - } - } - - /** - * Ensures a site of the given name exists - * - * @Given /^a site named "([^"]*)"$/ - * @Given /^a site named: (.*)$/ - * - * @param string $site Name of site to ensure exists - * @return boolean Always true, else errs - * @throws \Exception - */ - public function aSiteNamed($site) - { - try { - $this->iRun("terminus site:lookup $site"); - } catch (TerminusException $e) { - throw new \Exception("Your user does not have a site named $site."); - } - return true; - } - - /** - * Ensures a site of the given name exists and belongs to given org - * @Given /^a site named "([^"]*)" belonging to "([^"]*)"$/ - * - * @param [string] $site Name of site to ensure exists - * @param [string] $org Name or UUID of organization to ensure ownership - * @return [boolean] Always true, else errs - */ - public function aSiteNamedBelongingTo($site, $org) - { - $output = $this->iGetInfoForTheSite($site); - if (!$this->checkResult($site, $output)) { - $this->iCreateSiteNamed('Drupal 7', $site, $org); - $recurse = $this->aSiteNamedBelongingTo($site, $org); - return $recurse; - } - return true; - } - - /** - * @BeforeScenario - * Runs before each scenario - * - * @param [ScenarioEvent] $event Feature information from Behat - * @return [void] - */ - public function before($event) - { - $this->setCassetteName($event); - } - - /** - * Changes or displays mode, given or not, of given site - * @Given /^the connection mode of "([^"]*)" is "([^"]*)"$/ - * @When /^I set the connection mode on "([^"]*)" to "([^"]*)"$/ - * @When /^I check the connection mode on "([^"]*)"$/ - * - * @param [string] $site Site to change or view connection mode of - * @param [string] $mode If set, changes mode to given. Else, displays mode - * @return [void] - */ - public function connectionMode($site, $mode = null) - { - if (is_null($mode)) { - $command = "terminus site env:info dev --site=$site --field=connection_mode"; - } else { - $command = "terminus connection:set $mode --site=$site --env=dev"; - } - $this->iRun($command); - } - - /** - * Adds given hostname to given site's given environment - * @When /^I add hostname "([^"]*)" to the "([^"]*)" environment of "([^"]*)"$/ - * - * @param [string] $hostname Hostname to add - * @param [string] $env Environment on which to add hostname - * @param [string] $site Site on which to add hostname - * @return [void] - */ - public function iAddHostnameToTheEnvironmentOf($hostname, $env, $site) - { - $this->iRun("terminus domain:add $hostname --site=$site --env=$env"); - } - - /** - * Adds $email user from $site - * @When /^I add "([^"]*)" to the team on "([^"]*)"$/ - * - * @param [string] $email Email address of user to add - * @param [string] $site Name of the site on which to operate - * @return [void] - */ - public function iAddToTheTeamOn($email, $site) - { - $this->iRun("terminus site:team:add $site $email"); - } - - /** - * @When /^I am prompted to "([^"]*)" on "([^"]*)" at "([^"]*)"$/ - * - * @param [string] $prompt To be output before entering any key - * @param [string] $site Site about which prompt is regarding - * @param [string] $url URL to open after prompt - * @return [void] - */ - public function iAmPrompted( - $prompt, - $site, - $url = "https://[[dashboard_host]]/" - ) { - echo $prompt . PHP_EOL; - echo 'Then press any key.'; - $site = $this->replacePlaceholders($site); - $site_info = $this->iGetInfoForTheSite($site, $return_hash = true); - $url = $this->replacePlaceholders($url, $site_info); - $this->openInBrowser($url); - $line = trim(fgets(STDIN)); - } - - /** - * Logs in user with username and password set in behat.yml - * And a blank slate cache - * @Given /^I am authenticated$/ - * - * @return [void] - */ - public function iAmAuthenticated() - { - $this->iLogIn(); - } - - /** - * Attaches a given organization as payee of given site - * @When /^I attach the instrument "([^"]*)" to site "([^"]*)"$/ - * - * @param [string] $uuid UUID of organization to attach as payee - * @param [string] $site Name of site on which to attach - * @return [void] - */ - public function iAttachTheInstrument($uuid, $site) - { - $this->iRun("terminus payment-method:set $uuid --site=$site"); - } - - /** - * @Given /^I check the list of environments on "([^"]*)"$/ - * - * @param [string] $site Site to check environments of - * @return [string] $environments Environment list - */ - public function iCheckTheListOfEnvironmentsOn($site) - { - $environments = $this->iRun("terminus env:list --site=$site"); - return $environments; - } - - /** - * Checks to see if a URL is valid - * @Then /^I check the URL "([^"]*)" for validity$/ - * - * @param [string] $url URL to check for validity - * @return [void] - */ - public function iCheckTheUrlForValidity($url) - { - $url = $this->replacePlaceholders($url); - if (filter_var($url, FILTER_VALIDATE_URL) === false) { - throw new \Exception("$url URL is not valid."); - } - } - - /** - * Checks which user Terminus is operating as - * @Given /^I check the user I am logged in as$/ - * - * @return [void] - */ - public function iCheckTheUserAmLoggedInAs() - { - $this->iRun('terminus auth:whoami'); - } - - /** - * Clears site caches - * @When /^I clear the caches on the "([^"]*)" environment of "([^"]*)"$/ - * - * @param [string] $env Environment on which to clear caches - * @param [string] $site Site on which to clear caches - * @return [void] - */ - public function iClearTheCaches($env, $site) - { - $this->iRun("terminus env:clear-cache $env --site=$site"); - } - - /** - * @When /^I clone the "([^"]*)" environment into the "([^"]*)" environment on "([^"]*)"$/ - * - * @param [string] $from_env Environment to clone from - * @param [string] $to_env Environment to clone into - * @param [string] $site Site on which to clone an environment - * @return [void] - */ - public function iCloneTheEnvironment($from_env, $to_env, $site) - { - $this->iRun("terminus env:clone --site=$site --from-env=$from_env --to-env=$to_env --yes"); - } - - /** - * Commits changes to given site's given env with given message - * @When /^I commit changes to the "([^"]*)" environment of "([^"]*)" with message "([^"]*)"$/ - * - * @param [string] $env Name of environment on which to commit - * @param [string] $site Name of site on which to commit - * @param [string] $message Message for commit - * @return [void] - */ - public function iCommitChanges($env, $site, $message) - { - $this->iRun("terminus env:commit $env --site=$site --message=" . '"' . $message . '" --yes'); - } - - /** - * Creates a site for the given name - * @When /^I create a "([^"]*)" site named "([^"]*)"$/ - * - * @param [string] $upstream Which upstream to use as new site's source - * @param [string] $name Name of site to create - * @param [string] $org Name or UUID of organization to own the new site - * @return [void] - */ - public function iCreateSiteNamed($upstream, $name, $org = false) - { - $append_org = ''; - if ($org !== false) { - $append_org = '--org=' . $org; - } - $this->iRun("terminus site:create $name --label=$name --upstream=\"$upstream\" $append_org"); - } - - /** - * Creates a multidev env of given name on given site cloning given env - * @When /^I create multidev environment "([^"]*)" from "([^"]*)" on "([^"]*)"$/ - * - * @param [string] $multidev Name of new multidev environment - * @param [string] $env Name of environment to copy - * @param [string] $site Name of site on which to create multidev env - * @return [void] - */ - public function iCreateMultidevEnv($multidev, $env, $site) - { - $this->iRun("terminus multidev:create --site=$site --to-env=$multidev --from-env=$env"); - } - - /** - * Deletes a site of the given name - * @When /^I delete the site named "([^"]*)"$/ - * - * @param [string] $site Name of site to delete - * @return [void] - */ - public function iDeleteTheSiteNamed($site) - { - $this->iRun("terminus site:delete $site --yes"); - } - - /** - * @Given /^I deploy the "([^"]*)" environment from "([^"]*)" of "([^"]*)" with the message "([^"]*)"$/ - * - * @param [string] $env Name of environment to deploy - * @param [string] $from Name of environment to deploy from - * @param [string] $site Name of site on which to deploy environment - * @param [string] $message Commit message for the log - * @return [void] - */ - public function iDeployTheEnvironmentOf($env, $from, $site, $message) - { - $this->iRun("terminus env:deploy --site=$site --to-env=$env --from-env=$from --note=$note"); - } - - /** - * Intentionally expires the user's session - * @When /^I expire my session$/ - * - * @return [void] - */ - public function iExpireMySession() - { - $session = json_decode(file_get_contents($this->cache_file_name)); - $session->session_expire_time = -386299860; - file_put_contents($this->cache_file_name, $session); - } - - /** - * Queries for info for a given site - * @Given /^I get info for the "([^"]*)" environment of "([^"]*)"$/ - * - * @param [string] $env Environment to get info on - * @param [string] $site Site to get info on - * @return [string] Output from command run - */ - public function iGetInfoForTheEnvironmentOf($env, $site) - { - $return = json_decode($this->iRun("terminus env:info $env --site=$site --env=$env --format=json")); - return $return; - } - - /** - * Queries for info for a given site - * @Given /^I get info for the site "([^"]*)"$/ - * - * @param [string] $site Site to get info on - * @return [string] Output from command run - */ - public function iGetInfoForTheSite($site) - { - $return = $this->iRun("terminus site:info $site"); - return $return; - } - - /** - * Checks which user Terminus is operating as - * @Given /^I have at least "([^"]*)" site$/ - * @Given /^I have at least "([^"]*)" sites$/ - * - * @param [integer] $min The minimum number of sites to have - * @return [boolean] $has_the_min - */ - public function iHaveAtLeastSite($min) - { - $sites = json_decode($this->iRun('terminus site:list --format=json')); - $has_the_min = ($min <= count($sites)); - if (!$has_the_min) { - throw new \Exception(count($sites) . ' sites found.'); - } - return $has_the_min; - } - - /** - * Removes all machine tokens from the running machine - * @Given I have no saved machine tokens - * - * @return boolean - */ - public function iHaveNoSavedMachineTokens() - { - $this->iRun("rm {$this->cache_token_dir}/*"); - return true; - } - - /** - * Ensures at least X machine tokens exist in the tokens directory - * @Given I have at least :num_tokens saved machine tokens - * - * @param integer $num_tokens Number of tokens to ensure exist - * @return boolean - */ - public function iHaveSavedMachineTokens($num_tokens) - { - switch ($num_tokens) { - case 0: - break; - case 1: - $this->iLogIn(); - break; - default: - $this->iLogIn(); - for ($i = 1; $i <= $num_tokens; $i++) { - $this->iRun("cp {$this->cache_token_dir}/[[username]]$i"); - } - break; - } - return true; - } - - /** - * Checks which user Terminus is operating as - * @Given /^I have "([^"]*)" site$/ - * @Given /^I have "([^"]*)" sites$/ - * @Given /^I have no sites$/ - * - * @param [integer] $num The number of sites to have - * @return [boolean] $has_amount - */ - public function iHaveSites($num = 0) - { - $sites = json_decode($this->iRun('terminus site:list --format=json')); - $has_amount = ($num === count($sites)); - if (!$has_amount) { - throw new \Exception(count($sites) . ' sites found.'); - } - return $has_amount; - } - - /** - * @When /^I initialize the "([^"]*)" environment on "([^"]*)"$/ - * - * @param [string] $env Name of environment to initialize - * @param [string] $site Name of site on which to initialize environment - * @return [void] - */ - public function iInitializeTheEnvironmentOn($env, $site) - { - $this->iRun("terminus env:deploy $env --site=$site"); - } - - /** - * Installs given module to given Drupal site - * @When /^I install the module "([^"]*)" to "([^"]*)"$/ - * - * @param [string] $module Name of Drupal module to install - * @param [string] $site Name of the site to which to install - * @return [void] - */ - public function iInstallTheModuleTo($module, $site) - { - $this->iRun("terminus drush --command='dl $module -y' --site=$site --env=dev"); - } - - /** - * Lists all hostnames of the given site's given environment - * @Given /^I list the hostnames on the "([^"]*)" environment of "([^"]*)"$/ - * - * @param [string] $env Environment to list hostnames of - * @param [string] $site Name of the site to list the hostnames of - * @return [void] - */ - public function iListTheHostnamesOn($env, $site) - { - $this->iRun("terminus domain:list --site=$site --env=$env"); - } - - /** - * Checks the - * @Given /^I check the payment instrument of "([^"]*)"$/ - * - * @param [string] $site Name of site to check payment instrument of - * @return [void] - */ - public function iCheckThePaymentInstrumentOfSite($site) - { - $this->iRun("terminus payment-method:info --site=$site"); - } - - /** - * Lists all sites user is on the team of - * @When /^I list the sites$/ - * - * @return [void] - */ - public function iListTheSites() - { - $this->iRun('terminus site:list'); - } - - /** - * Lists team members - * @Given /^I list the team members on "([^"]*)"$/ - * - * @param [string] $site Name of site of which to retrieve team members - * @return [void] - */ - public function iListTheTeamMembersOn($site) - { - $this->iRun("terminus site:team:list $site"); - } - - /** - * List the backups of the given environment of the given site - * @When /^I list the backups of the "([^"]*)" environment of "([^"]*)"$/ - * - * @param [string] $env Environment of which to list the backups - * @param [string] $site Site of which to list the backups - * @return [string] Output to the CL - */ - public function iListTheBackupsOf($env, $site) - { - $return = $this->iRun("terminus backup:list --site=$site --env=$env"); - return $return; - } - - /** - * Logs in user - * @When /^I log in via machine token "([^"]*)"$/ - * @When /^I log in via machine token$/ - * @When /^I log in$/ - * - * @param [string] $token A Pantheon machine token - * @return [void] - */ - public function iLogIn($token = '[[machine_token]]') - { - $this->iRun("terminus auth:login --machine-token=$token"); - } - - /** - * Logs in a user with a locally saved machine token - * @When /^I log in as "([^"]*)"$/ - * - * @param [string] $email An email address - * @return [void] - */ - public function iLogInAs($email = '[[username]]') - { - $this->iRun("terminus auth:login --email=$email"); - } - - /** - * Logs user out - * @When /^I log out$/ - * @Given /^I am not authenticated$/ - * - * @return [void] - */ - public function iLogOut() - { - $this->iRun("terminus auth:logout"); - } - - /** - * Makes a backup of given elements of given site's given environment - * @When /^I back up "([^"]*)" elements of the "([^"]*)" environment of "([^"]*)"/ - * @When /^I back up the "([^"]*)" element of the "([^"]*)" environment of "([^"]*)"/ - * - * @param [string] $elements Elements to back up - * @param [string] $env Environment to back up - * @param [string] $site Name of the site to back up - * @return [void] - */ - public function iMakeBackupElementsOfTheEnvironment($elements, $env, $site) - { - $this->iRun("terminus backup:create --site=$site --env=$env --element=$elements"); - } - - /** - * @When /^I merge the "([^"]*)" environment into the "([^"]*)" environment on "([^"]*)"$/ - * - * @param [string] $from_env Environment to merge from - * @param [string] $to_env Environment to merge into - * @param [string] $site Name of site on which to merge environments - * @return [void] - */ - public function iMergeTheEnvironment($from_env, $to_env, $site) - { - $this->setTestStatus('pending'); - } - - /** - * Removes $email user from $site - * @When /^I remove "([^"]*)" from the team on "([^"]*)"$/ - * - * @param [string] $email Email address of user to add - * @param [string] $site Name of the site on which to operate - * @return [void] - */ - public function iRemoveFromTheTeamOn($email, $site) - { - $this->iRun("terminus site:team:remove $site $email"); - } - - /** - * @Given /^I restore the "([^"]*)" environment of "([^"]*)" from backup$/ - * - * @param [string] $env Environment to restore from backup - * @param [string] $site Site to restore from backup - * @return [void] - */ - public function iRestoreTheEnvironmentOfFromBackup($env, $site) - { - $this->setTestStatus('pending'); - } - - /** - * @When /^I run "([^"]*)"$/ - * @When /^I run: (.*)$/ - * Runs command and saves output - * - * @param [string] $command To be entered as CL stdin - * @return [string] Returns output of command run - */ - public function iRun($command) - { - $regex = '/(?cliroot); - - $command = $this->replacePlaceholders($command); - if (isset($this->connection_info['host'])) { - $command = "TERMINUS_HOST={$this->connection_info['host']} $command -vvv"; - } - if (isset($this->cassette_name)) { - $command = "TERMINUS_VCR_CASSETTE={$this->cassette_name} $command"; - } - if (!empty($mode = $this->parameters['vcr_mode'])) { - $command = "TERMINUS_VCR_MODE=$mode $command"; - } - - // Pass the cache directory to the command so that tests don't poison the user's cache. - $command = "TERMINUS_TEST_MODE=1 TERMINUS_CACHE_DIR=$this->cache_dir $command"; - - $command = preg_replace($regex, $terminus_cmd, $command); - - ob_start(); - passthru($command . ' 2>&1'); - $this->output = ob_get_clean(); - - return $this->output; - } - - /** - * @Then /^I should get:$/ - * @Then /^I should get "([^"]*)"$/ - * @Then /^I should get: "([^"]*)"$/ - * Checks the output for the given string - * - * @param [string] $string Content which ought not be in the output - * @return [boolean] $i_have_this True if $string exists in output - * @throws Exception - */ - public function iShouldGet($string) - { - $i_have_this = $this->iShouldGetOneOfTheFollowing($string); - return $i_have_this; - } - - /** - * Checks the output for a table with the given headers - * - * @Then /^I should see a table with the headers$/ - * @Then /^I should see a table with the headers: ([^"]*)$/ - * @Then /^I should see a table with the headers: "([^"]*)"$/ - * - * @param string $headers Comma separated row values to match - * @return boolean true if $headers exists in output - * - * @throws \Exception - */ - public function shouldSeeATableWithHeaders($headers) - { - $table_headers = explode(',', $headers); - foreach ($table_headers as $column) { - if (!$this->checkResult(trim((string)$column), $this->output)) { - throw new \Exception("Expected table headers to include: '{$column}' in table:\n{$this->output}\n"); - } - } - - return true; - } - - /** - * Checks the output for a table with the given row values - * - * @Then /^I should see a table with rows like:$/ - * @Then /^I should see a table with rows like"([^"]*)"$/ - * @Then /^I should see a table with rows like: "([^"]*)"$/ - * - * @param $rows string newline separated row values to match - * @return boolean true if all of the rows are present in the output - * @throws \Exception - */ - public function shouldSeeATableWithRows($rows) - { - $lines = explode("\n", $rows); - foreach ($lines as $line) { - if (!$this->checkResult(trim((string)$line), $this->output)) { - throw new \Exception("Expected the row '{$line}' in table:\n{$this->output}\n"); - } - } - - return true; - } - - /** - * Checks the output for a type of message. Message to match is optional. - * - * @Then /^I should see a[n]? (notice|warning|error) message$/ - * @Then /^I should see a[n]? (notice|warning|error) message: (.*)$/ - * - * @param $type string One of the standard logging levels - * @param $message string Optional message to match in the output - * @return bool True if message is the correct type and exists in output if given - * @throws \Exception - */ - public function shouldSeeATypeOfMessage($type, $message = null) - { - $expected_message = "[$type]"; - if (!empty($message)) { - $expected_message .= " {$message}"; - } - - $compressed_output = preg_replace('/\s+/', ' ', $this->output); - if (strpos($compressed_output, $expected_message) === false) { - throw new \Exception("Expected $expected_message in message: $this->output"); - } - - return true; - } - - /** - * @Then /^I should get a valid UUID/ - * Checks the output for a valid UUID - * - * @return bool - * @throws Exception - */ - public function iShouldGetValidUuid() - { - preg_match( - '/^([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})$/', - $this->output, - $matches - ); - if (empty($matches) - && ($this->output != '11111111-1111-1111-1111-111111111111') - ) { - throw new \Exception($this->output . ' is not a valid UUID.'); - } - return true; - } - - /** - * @Then /^I should get one of the following:$/ - * @Then /^I should get one of the following "([^"]*)"$/ - * @Then /^I should get one of the following: "([^"]*)"$/ - * Checks the output for the given substrings, comma-separated - * - * @param [array] $list_string Content which ought to be in the output - * @return [boolean] True if a $string exists in output - * @throws Exception - */ - public function iShouldGetOneOfTheFollowing($list_string) - { - $strings = explode(',', $list_string); - foreach ($strings as $string) { - if ($this->checkResult(trim((string)$string), $this->output)) { - return true; - } - } - throw new \Exception("Actual output:\n" . $this->output); - } - - /** - * @Then /^I should not get one of the following:$/ - * @Then /^I should not get one of the following "([^"]*)"$/ - * @Then /^I should not get one of the following: "([^"]*)"$/ - * Checks the output for the given substrings, comma-separated - * - * @param [array] $list_string Content which ought not be in the output - * @return [boolean] True if a $string does not exist in output - */ - public function iShouldNotGetOneOfTheFollowing($list_string) - { - try { - $this->iShouldGetOneOfTheFollowing($list_string); - } catch (\Exception $e) { - return true; - } - throw new \Exception("Actual output:\n" . $this->output); - } - - /** - * Checks for backups made since the test started running - * @Then /^I should have a new backup$/ - * - * @return [boolean] True if new backup exists - */ - public function iShouldHaveNewBackup() - { - $regex = "/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/"; - preg_match_all($regex, $this->output, $matches); - foreach ($matches[0] as $date) { - if ($this->start_time < strtotime($date)) { - return true; - } - } - throw new \Exception('No new backups were created.' . PHP_EOL); - } - - /** - * Checks the number of records returned against a given quantity - * @Then /^I should have "([^"]*)" records$/ - * - * @param [integer] $number Number of records to check for - * @return [void] - */ - public function iShouldHaveRecords($number) - { - preg_match("/.*(\[.*\]).*/", str_replace("\n", '', $this->output), $matches); - $records = json_decode($matches[1]); - if ((integer)$number != count($records)) { - throw new \Exception("Wanted $number records, got " . count($records) . '.'); - } - return true; - } - - /** - * Ensures that you do not recieve param $string as result - * @Then /^I should not get:$/ - * @Then /^I should not get: "([^"]*)"$/ - * - * @param [string] $string Content which ought not be in the output - * @return [boolean] True if $string does not exist in output - */ - public function iShouldNotGet($string) - { - if ($this->checkResult((string)$string, $this->output)) { - throw new \Exception("Actual output:\n" . $this->output); - } - return true; - } - - /** - * Ensures that a user is not on a site's team - * @Given /^"([^"]*)" is a member of the team on "([^"]*)"$/ - * - * @param [string] $member Email address of the member on the team of - * @param [string] $site Site which the member should be on the team of - * @return [boolean] True if $member does exists in output - */ - public function isMemberOfTheTeamOn($member, $site) - { - $this->iRun("terminus site:team:list $site"); - $is_member = $this->iShouldGet($member); - return $is_member; - } - - /** - * Ensures that a user is not on a site's team - * @Given /^"([^"]*)" is not a member of the team on "([^"]*)"$/ - * - * @param [string] $member Email address of the member not on the team - * @param [string] $site Site which the member should not be on the team of - * @return [boolean] True if $member does not exist in output - */ - public function isNotMemberOfTheTeamOn($member, $site) - { - $this->iRun("terminus site:team:list $site"); - $is_not_member = $this->iShouldNotGet($member); - return $is_not_member; - } - - /** - * Ensures there is no site with the given name. Loops until this is so - * @Given /^no site named "([^"]*)"$/ - * - * @param [string] $site Name of site to ensure does not exist - * @return [boolean] Always returns true - */ - public function noSiteNamed($site) - { - try { - $this->aSiteNamed($site); - } catch (\Exception $e) { - return true; - } - throw new \Exception("A site named $site was found."); - } - - /** - * Gets or sets service level - * @When /^I set the service level of "([^"]*)" to "([^"]*)"$/ - * @Given /^I check the service level of "([^"]*)"$/ - * @Given /^the service level of "([^"]*)" is "([^"]*)"$/ - * - * @param [string] $site Name of site to work on - * @param [string] $service_level If not false, will set service level to this - * @return [void] - */ - public function serviceLevel($site, $service_level = null) - { - if (is_null($service_level)) { - $command = "terminus site:info $site --field=service_level"; - } else { - $command = "terminus service-level:set $service_level --site=$site"; - } - $this->iRun($command); - } - - /** - * Automatically assigns pass/fail/skip to the test result - * @Then /^I "([^"]*)" the test$/ - * - * @param [string] $status Status to assign to the test - * @return [boolean] Always true, else errs - */ - public function setTestStatus($status) - { - if ($status == 'pending') { - throw new \Exception("Implementation of this functionality is pending."); - } - throw new \Exception("Test explicitly set to $status"); - } - - /** - * Checks the the haystack for the needle - * - * @param [string] $needle That which is searched for - * @param [string] $haystack That which is searched inside - * @return [boolean] $result True if $nededle was found in $haystack - */ - private function checkResult($needle, $haystack) - { - $needle = $this->replacePlaceholders($needle); - $result = preg_match("#" . preg_quote($needle . "#s"), $haystack); - return $result; - } - - /** - * Returns tags in easy-to-use array format. - * - * @param [ScenarioEvent] $event Feature information from Behat - * @return $tags [array] An array of strings corresponding to tags - */ - private function getTags($event) - { - $unformatted_tags = $event->getScenario()->getTags(); - $tags = array(); - - foreach ($unformatted_tags as $tag) { - $tag_elements = explode(' ', $tag); - $index = null; - if (count($tag_elements < 1)) { - $index = array_shift($tag_elements); - } - if (count($tag_elements == 1)) { - $tag_elements = array_shift($tag_elements); - } - $tags[$index] = $tag_elements; - } - - return $tags; - } - - /** - * Opens param $url in the default browser - * - * @param [string] $url URL to open in browser - * @return [void] - */ - private function openInBrowser($url) - { - $url = $this->replacePlaceholders($url); - switch (php_uname('s')) { - case "Darwin": - $cmd = "open"; - break; - case "Windows NT": - $cmd = "start"; - break; - case "Linux": - default: - $cmd = "xdg-open"; - break; - } - exec("$cmd $url"); - } - - /** - * @When /^This step is implemented I will test: (.*)$/ - */ - public function thisStepIsImplementedIWillTestInvalidConnectionModes($pending) - { - throw new PendingException("Testing $pending is pending."); - } - - /** - * Reads one line from STDIN - * - * @return [string] $line - */ - private function read() - { - $line = trim(fgets(STDIN)); - return $line; - } - - /** - * Exchanges values in given string with square brackets for values - * in $this->parameters - * - * @param [string] $string The string to perform replacements on - * @param [array] $replacements Used to replace with non-parameters - * @return [string] $string The modified param string - */ - private function replacePlaceholders($string, $replacements = array()) - { - $regex = '~\[\[(.*?)\]\]~'; - preg_match_all($regex, $string, $matches); - if (empty($replacements)) { - $replacements = $this->parameters; - } - - foreach ($matches[1] as $id => $replacement_key) { - if (isset($replacements[$replacement_key])) { - $replacement = $replacements[$replacement_key]; - if (is_array($replacement)) { - $replacement = array_shift($replacement); - } - $string = str_replace($matches[0][$id], $replacement, $string); - } - } - - return $string; - } - - /** - * Sets $this->cassette_name and returns name of the cassette to be used. - * - * @param [array] $event Feature information from Behat - * @return [string] Of scneario name, lowercase, with underscores and suffix - */ - private function setCassetteName($event) - { - $tags = $this->getTags($event); - $this->cassette_name = false; - if (isset($tags['vcr'])) { - $this->cassette_name = $tags['vcr']; - } - return $this->cassette_name; - } -} diff --git a/tests/active_features/connection-info.feature b/tests/active_features/connection-info.feature deleted file mode 100644 index a6810b3b8..000000000 --- a/tests/active_features/connection-info.feature +++ /dev/null @@ -1,107 +0,0 @@ -@environment @connection -Feature: Environment Connection Info Command - In order to see connection parameters for remotely accessing the environment of a given site - As a Terminus user - I want a command to view the current connection parameters. - - Background: I am authenticated and have a site named [[test_site_name]] - Given I am authenticated - And a site named: [[test_site_name]] - - @vcr site_connection-info - Scenario: Show the default connection info for a site environment - When I run "terminus connection:info [[test_site_name]].dev" - Then I should see a table with rows like: - """ - SFTP Command - Git Command - MySQL Command - Redis Command - """ - And I should not get: - """ - Git URL - """ - - @vcr site_connection-info - Scenario: Show connection info for a site environment using a qualified field glob - When I run "terminus connection:info [[test_site_name]].dev --fields='*_url'" - Then I should see a table with rows like: - """ - SFTP URL - Git URL - MySQL URL - """ - And I should not get: - """ - Git Command - """ - - @vcr site_connection-info - Scenario: Show all connection info for a site environment using a field glob - When I run "terminus connection:info [[test_site_name]].dev --fields='*'" - Then I should see a table with rows like: - """ - SFTP Command - SFTP Username - SFTP Host - SFTP Password - SFTP URL - Git Command - Git Username - Git Host - Git Port - Git URL - MySQL Command - MySQL Username - MySQL Host - MySQL Password - MySQL URL - MySQL Port - MySQL Database - Redis Command - Redis Port - Redis URL - Redis Password - """ - - @vcr site_connection-info - Scenario: Show only a specific connection info parameter for a site environment - When I run "terminus connection:info [[test_site_name]].dev --fields=git_command" - Then I should see a table with rows like: - """ - Git Command - """ - And I should not get: - """ - SFTP Command - """ - - @vcr site_connection-info - Scenario: Show only a specific connection info parameter using a field label - When I run "terminus connection:info [[test_site_name]].dev --fields='Git Command'" - Then I should see a table with rows like: - """ - Git Command - """ - And I should not get: - """ - SFTP Command - """ - - @vcr site_connection-info - Scenario: Show only a specific connection info parameter using a single field key - When I run "terminus connection:info [[test_site_name]].dev --field=git_command" - Then I should see a table with rows like: - """ - git clone ssh://codeserver - """ - And I should not get: - """ - Git Command - """ - - @vcr site_connection-info - Scenario: Show an error if the environment is not correctly specified - When I run "terminus connection:info [[test_site_name]]" - Then I should see an error message: The environment argument must be given as . diff --git a/tests/active_features/connection-set.feature b/tests/active_features/connection-set.feature deleted file mode 100644 index 7c073411a..000000000 --- a/tests/active_features/connection-set.feature +++ /dev/null @@ -1,37 +0,0 @@ -Feature: Set a site's connection mode - In order to ensure the correct sort of connectivity for my site - As a user - I need to be able to change my site's connection mode. - - Background: I am authenticated and I have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_set-connection-mode_git - Scenario: Setting connection mode to git - When I run "terminus connection:set [[test_site_name]].dev git" - Then I should see a notice message: Enabling git push mode for "dev" - - @vcr site_set-connection-mode_sftp - Scenario: Setting connection mode to sftp - When I run "terminus connection:set [[test_site_name]].dev sftp" - Then I should see a notice message: Enabling on-server development via SFTP for "dev" - - @vcr site_set-connection-mode_git - Scenario: Failing to set the connection mode to the current sftp mode - # Note: The VCR fixture has the environment in sftp mode to start. Want a given like: - # Given the [[test_site_name]].dev environment is in the sftp connection mode - When I run "terminus connection:set [[test_site_name]].dev sftp" - Then I should see a notice message: The connection mode is already set to sftp. - - @vcr site_set-connection-mode_sftp - Scenario: Failing to set the connection mode to the current git mode - # Note: The VCR fixture has the environment in git mode to start. Want a given like: - # Given the [[test_site_name]].dev environment is in the git connection mode - When I run "terminus connection:set [[test_site_name]].dev git" - Then I should see a notice message: The connection mode is already set to git. - - Scenario: Attempting to set connection mode to an invalid mode - When This step is implemented I will test: setting invalid connection modes - When I run "terminus connection:set [[test_site_name]].dev invalid" - Then I should see an error message: You must specify the mode as either sftp or git. diff --git a/tests/active_features/drush.feature b/tests/active_features/drush.feature deleted file mode 100644 index 48b9ee619..000000000 --- a/tests/active_features/drush.feature +++ /dev/null @@ -1,25 +0,0 @@ -Feature: Running Drush Commands on a Drupal Site - In order to interact with Drupal without configuring Pantheon site aliases - As a Terminus user - I want the ability to run arbitrary drush commands in terminus - - Background: I am authenticated and have a site named [[test_site_name]] - Given I am authenticated - And a site named: [[test_site_name]] - - @vcr remote-drush.yml - Scenario: Running a simple drush command - When I run: terminus drush [[test_site_name]].dev -- version - Then I should get: "Terminus is in test mode" - And I should get: "drush version" - - @vcr remote-drush.yml - Scenario: Running a drush command that is not permitted - When I run: terminus drush [[test_site_name]].dev -- sql-connect - Then I should see an error message: That command is not available via Terminus. Please use the native drush command. - Then I should get: "Hint: You may want to try `terminus connection:info --field=mysql_command`." - - @vcr remote-wp.yml - Scenario: Running a drush command on a Wordpress site is not possible - When I run: terminus drush [[test_site_name]].dev -- status - Then I should see an error message: The drush command is only available on sites running drupal, drupal8. The framework for this site is wordpress. diff --git a/tests/active_features/env-clone.feature b/tests/active_features/env-clone.feature deleted file mode 100644 index f4c6f5fd5..000000000 --- a/tests/active_features/env-clone.feature +++ /dev/null @@ -1,36 +0,0 @@ -Feature: Cloning site content - In order to duplicate a site - As a user - I need to be able to duplicate a site. - - Background: I am authenticated and have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_clone-content - Scenario: Site Clone Environment - When I run "terminus env:clone [[test_site_name]].test dev --yes" - Then I should get: - """ - Running cloneDatabase... - """ - Then I should get: - """ - Running cloneFiles... - """ - - @vcr site_clone-content - Scenario: Site Clone Files Only - When I run "terminus env:clone [[test_site_name]].test dev --files-only --yes" - Then I should get: - """ - Running cloneFiles... - """ - - @vcr site_clone-content - Scenario: Site Clone Files Only - When I run "terminus env:clone [[test_site_name]].test dev --db-only --yes" - Then I should get: - """ - Running cloneDatabase... - """ diff --git a/tests/active_features/env-code-log.feature b/tests/active_features/env-code-log.feature deleted file mode 100644 index 481b221a2..000000000 --- a/tests/active_features/env-code-log.feature +++ /dev/null @@ -1,13 +0,0 @@ -Feature: Listing commits on an environment - In order to maintain my site - As a user - In need to be able to list the commits on a branch - - Background: I am authenticated and have a site called [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_code_log - Scenario: Listing the commit log of a site - When I run "terminus env:code-log [[test_site_name]].dev" - Then I should get: "Initial Commit" diff --git a/tests/active_features/env-commit.feature b/tests/active_features/env-commit.feature deleted file mode 100644 index f49eb75e5..000000000 --- a/tests/active_features/env-commit.feature +++ /dev/null @@ -1,14 +0,0 @@ -Feature: Committing code to an environment's branch - In order to maintain my git repository for my site - As a user - In need to be able to commit changes made to the site on the server - - Background: I am authenticated and have a site called [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_code_commit - Scenario: Committing a change - When I run "terminus env:commit [[test_site_name]].dev --message='Behat test commit'" - And I run "terminus env:code-log [[test_site_name]].dev" - Then I should get: "Behat test commit" diff --git a/tests/active_features/env-deploy.feature b/tests/active_features/env-deploy.feature deleted file mode 100644 index 49efa089a..000000000 --- a/tests/active_features/env-deploy.feature +++ /dev/null @@ -1,33 +0,0 @@ -Feature: Site Deployment - In order to publish a site to the internet - As a user - I need to be able to deploy sites on Pantheon. - - Background: I am authenticated and have a site named [[test_site_name]] on which I deploy - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_deploy - Scenario: Deploy dev to test - When I run "terminus env:deploy [[test_site_name]].test --note='Deploy test' --sync-content" - Then I should get "." - And I should get "." - Then I should get: - """ - Deploying code to "test", and cloning files from "live", and cloning database from "live" - """ - - @vcr site_deploy_no_changes - Scenario: Failing to deploy dev to test because there are no changes to deploy - When I run "terminus env:deploy [[test_site_name]].test --note='Deploy test' --sync-content" - Then I should get: "There is nothing to deploy." - - @vcr env-deploy - Scenario: Initializing test when it has not been previously initialized - When I run "terminus env:deploy [[test_site_name]].test --note='First deploy to live' --sync-content" - Then I should get "." - And I should get "." - Then I should get: - """ - Deploying code to "test", and cloning files from "live", and cloning database from "live" - """ diff --git a/tests/active_features/import.feature b/tests/active_features/import.feature deleted file mode 100644 index 9045d6623..000000000 --- a/tests/active_features/import.feature +++ /dev/null @@ -1,37 +0,0 @@ -Feature: Import a a site and its content onto Pantheon - In order to move a site onto Pantheon - As a user - I need to be able to import its content. - - Background: I am authenticated and I have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_import - Scenario: Importing a site archive onto Pantheon - When I run "terminus site:import [[test_site_name]] https://s3.amazonaws.com/pantheondemofiles/archive.tar.gz" - Then I should get "." - Then I should get: - """ - Imported site onto Pantheon - """ - - @vcr site_import-content_files - Scenario: Import files into the site - When This step is implemented I will test: terminus import:files - When I run "terminus import:files [[test_site_name]] https://s3.amazonaws.com/pantheondemofiles/files.tar.gz" - Then I should get "." - Then I should get: - """ - Importing files to "dev" - """ - - @vcr site_import-content_database - Scenario: Import database into the site - When This step is implemented I will test: import:content - When I run "terminus import:database [[test_site_name]] https://s3.amazonaws.com/pantheondemofiles/database.tar.gz" - Then I should get "." - Then I should get: - """ - Importing database to "dev" - """ diff --git a/tests/active_features/machine-token.feature b/tests/active_features/machine-token.feature deleted file mode 100644 index 7ac4717ed..000000000 --- a/tests/active_features/machine-token.feature +++ /dev/null @@ -1,23 +0,0 @@ -Feature: Machine tokens command - In order to manage my devices - As a user - I need to be able to view and delete my machine tokens. - - Background: I am logged in - Given I am authenticated - - @vcr machine-tokens_list - Scenario: List the machine tokens - When I run "terminus machine-token:list" - Then I should get: - """ - [[machine_token_id]] - """ - - @vcr machine-tokens_delete - Scenario: Delete machine token - When I run "terminus machine-token:delete [[machine_token_id]]" - Then I should get: - """ - Deleted [[machine_token_device]]! - """ diff --git a/tests/active_features/multidev-create.feature b/tests/active_features/multidev-create.feature deleted file mode 100644 index e92a264e1..000000000 --- a/tests/active_features/multidev-create.feature +++ /dev/null @@ -1,17 +0,0 @@ -Feature: Working with multidev environments - In order to work collaboratively on Pantheon - As a user - I need to be able to create, remove, and alter multidev environments. - - Background: I am authenticated and have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_create-env - Scenario: Create a multidev environment - When I run "terminus multidev:create [[test_site_name]].dev multidev" - Then I should get: "." - And I should get: - """ - Creating Multidev environment "multidev" - """ diff --git a/tests/active_features/multidev-delete.feature b/tests/active_features/multidev-delete.feature deleted file mode 100644 index 800d3111f..000000000 --- a/tests/active_features/multidev-delete.feature +++ /dev/null @@ -1,25 +0,0 @@ -Feature: Deleting a site's multidev environments - In order to work collaboratively - As a user - I need to be able to remove multidev environments - - Background: I am authenticated and have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_delete-env - Scenario: Deleting a multidev environment - When I run "terminus multidev:delete [[test_site_name]].multidev" - Then I should get: - """ - Deleted the multidev environment multidev. - """ - - @vcr site_delete-env - Scenario: Failing to delete a multidev environment when the specified environment does not exist - When I run "terminus multidev:delete [[test_site_name]].invalid" - Then I should get: - """ - Could not find Terminus\Models\Environment "invalid" - """ - diff --git a/tests/active_features/multidev-list.feature b/tests/active_features/multidev-list.feature deleted file mode 100644 index fe047c155..000000000 --- a/tests/active_features/multidev-list.feature +++ /dev/null @@ -1,23 +0,0 @@ -Feature: Listing a site's environments - In order to administer my site - As a user - I need to be able to list all of its environments - - Background: I am authenticated and have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_environments - Scenario: Failing to list multidevs when there aren't any - When I run "terminus multidev:list [[test_site_name]] --format=json" - Then I should get: "You have no multidev environments" - And I should get: "[]" - - @vcr site_info - Scenario: Listing all multidev environments belonging to a site - When I run "terminus multidev:list [[test_site_name]]" - Then I should get: "---------- --------------------- -------------------------------------- --------------- --------- --------------" - And I should get: "ID/Name Created Domain OnServer Dev? Locked? Initialized?" - And I should get: "---------- --------------------- -------------------------------------- --------------- --------- --------------" - And I should get: "multidev 2016-08-16 22:09:01 multidev-behat-tests.pantheonsite.io true false true" - And I should get: "---------- --------------------- -------------------------------------- --------------- --------- --------------" diff --git a/tests/active_features/multidev-merge-from-dev.feature b/tests/active_features/multidev-merge-from-dev.feature deleted file mode 100644 index 77c149d06..000000000 --- a/tests/active_features/multidev-merge-from-dev.feature +++ /dev/null @@ -1,18 +0,0 @@ -Feature: Merging into an environment from dev - In order to work collaboratively - As a user - I need to be able to merge from the dev environment. - - Background: I am authenticated and I have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_merge-from-dev - Scenario: Merge the dev environment into a multidev environment - When I run "terminus multidev:merge-from-dev [[test_site_name]].multidev" - Then I should get: "." - Then I should get: "." - Then I should get: - """ - Merged the dev environment into multidev. - """ diff --git a/tests/active_features/multidev-merge-to-dev.feature b/tests/active_features/multidev-merge-to-dev.feature deleted file mode 100644 index 786b4ada4..000000000 --- a/tests/active_features/multidev-merge-to-dev.feature +++ /dev/null @@ -1,17 +0,0 @@ -Feature: Merging into dev from an environment - In order to work collaboratively - As a user - I need to be able to merge into the dev environment. - - Background: I am authenticated and I have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_merge-to-dev - Scenario: Merge a multidev to dev environment - When I run "terminus multidev:merge-to-dev [[test_site_name]].multidev" - Then I should get: "." - Then I should get: - """ - Merged the multidev environment into dev - """ diff --git a/tests/active_features/site-delete.feature b/tests/active_features/site-delete.feature deleted file mode 100644 index 6f17fa9ef..000000000 --- a/tests/active_features/site-delete.feature +++ /dev/null @@ -1,13 +0,0 @@ -Feature: Deleting a site - In order to keep my sites list maintained - As a user - I need to be able to delete sites. - - Background: I am authenticated and I have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_delete - Scenario: Delete Site - When I run "terminus site:delete [[test_site_name]]" - Then I should get: "Deleted [[test_site_name]] from Pantheon" diff --git a/tests/active_features/site-info.feature b/tests/active_features/site-info.feature deleted file mode 100644 index 25970ef5d..000000000 --- a/tests/active_features/site-info.feature +++ /dev/null @@ -1,21 +0,0 @@ -Feature: View site information - In order to view site information - As a user - I need to be able to list data related to it. - - Background: I am authenticated and I have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_info - Scenario: Site Info - When I run "terminus site:info [[test_site_name]]" - Then I should get: - """ - Service Level - """ - - @vcr site_owner - Scenario: Showing the site owner - When I run "terminus site:info [[test_site_name]] --field=id" - Then I should get: "11111111-1111-1111-1111-111111111111" diff --git a/tests/active_features/site-list.feature b/tests/active_features/site-list.feature deleted file mode 100644 index a5e027761..000000000 --- a/tests/active_features/site-list.feature +++ /dev/null @@ -1,44 +0,0 @@ -Feature: Listing sites - In order to administer my sites - As a user - I need to be able to list those sites. - - Background: I am authenticated - Given I am authenticated - - @vcr sites_list_empty - Scenario: Listing a user's sites when they haven't any - When I run "terminus site:list" - Then I should get: "You have no sites." - And I should get: "------ ---- --------------- ----------- ------- --------- -------------" - And I should get: "Name ID Service Level Framework Owner Created Memberships" - And I should get: "------ ---- --------------- ----------- ------- --------- -------------" - - @vcr sites_list - Scenario: Listing a user's sites - Given a site named "[[test_site_name]]" - When I run "terminus site:list --owner=me" - Then I should get: "------------- -------------------------------------- --------------- ----------- -------------------------------------- --------------------- --------------------------------------------" - And I should get: "Name ID Service Level Framework Owner Created Memberships" - And I should get: "------------- -------------------------------------- --------------- ----------- -------------------------------------- --------------------- --------------------------------------------" - And I should get: "[[test_site_name]] 11111111-1111-1111-1111-111111111111 free wordpress 11111111-1111-1111-1111-111111111111 2016-08-16 22:09:01 11111111-1111-1111-1111-111111111111: Team" - And I should get: "------------- -------------------------------------- --------------- ----------- -------------------------------------- --------------------- --------------------------------------------" - - @vcr sites_list - Scenario: Filter sites list by name - Given a site named "[[test_site_name]]" - When I run "terminus site:list --name=[[test_site_name]]" - Then I should get: "------------- -------------------------------------- --------------- ----------- -------------------------------------- --------------------- --------------------------------------------" - And I should get: "Name ID Service Level Framework Owner Created Memberships" - And I should get: "------------- -------------------------------------- --------------- ----------- -------------------------------------- --------------------- --------------------------------------------" - And I should get: "[[test_site_name]] 11111111-1111-1111-1111-111111111111 free wordpress 11111111-1111-1111-1111-111111111111 2016-08-16 22:09:01 11111111-1111-1111-1111-111111111111: Team" - And I should get: "------------- -------------------------------------- --------------- ----------- -------------------------------------- --------------------- --------------------------------------------" - - @vcr sites_list - Scenario: Filter sites list by name, excluding the test site - Given a site named "[[test_site_name]]" - When I run "terminus site:list --name=missing" - Then I should get: "You have no sites." - And I should get: "------ ---- --------------- ----------- ------- --------- -------------" - And I should get: "Name ID Service Level Framework Owner Created Memberships" - And I should get: "------ ---- --------------- ----------- ------- --------- -------------" diff --git a/tests/active_features/site-lookup.feature b/tests/active_features/site-lookup.feature deleted file mode 100644 index c70f3daa7..000000000 --- a/tests/active_features/site-lookup.feature +++ /dev/null @@ -1,18 +0,0 @@ -Feature: Looking up a site - In order to know whether a site exists - As a user - I need to be able to detect if a site of a given name already exists - - Background: I am authenticated and I have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_lookup - Scenario: Site look-up - When I run "terminus site:lookup [[test_site_name]]" - Then I should get: "11111111-1111-1111-1111-111111111111" - - @vcr site_lookup_dne - Scenario: Site look-up fails because site DNE - When I run "terminus site:lookup invalid" - Then I should get: "A site named invalid was not found." diff --git a/tests/active_features/site-team.feature b/tests/active_features/site-team.feature deleted file mode 100644 index e90d5824b..000000000 --- a/tests/active_features/site-team.feature +++ /dev/null @@ -1,38 +0,0 @@ -Feature: Managing a site's team - In order to work collaboratively - As a user - I need to be able to alter a site's team membership. - - Background: I am authenticated and have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_team_add-member - Scenario: Adding a team member - When I run "terminus site:team:add [[test_site_name]] [[other_user]] --role=team_member" - And I list the team members on "[[test_site_name]]" - Then I should get: - """ - [[other_user]] - """ - - @vcr site_team_change-role - Scenario: Changing a team member's role - When I run "terminus site:team:role [[test_site_name]] [[other_user]] admin" - Then I should get one of the following: "This site does not have its change-management option enabled., Changed a user role" - - @vcr site_team_list - Scenario: Listing team members - When I run "terminus site:team:list [[test_site_name]]" - Then I should get: - """ - team_member - """ - - @vcr site_team_remove-member - Scenario: Removing a team member - When I run "terminus site:team:remove [[test_site_name]] [[other_user]]" - Then I should get: - """ - Removed a user from site team - """ diff --git a/tests/active_features/ssh-key.feature b/tests/active_features/ssh-key.feature deleted file mode 100644 index 19e2c5677..000000000 --- a/tests/active_features/ssh-key.feature +++ /dev/null @@ -1,23 +0,0 @@ -Feature: SSH Keys - In order to work on my Pantheon site - As a user - I need to be able to manage my SSH keys. - - Background: I am logged in and have a site named [[test_site_name]] - Given I am authenticated - - @vcr ssh-keys_list - Scenario: List SSH keys - When I run "terminus ssh-key:list" - Then I should get one of the following: "Fingerprint, You do not have any SSH keys saved." - - @vcr ssh-keys_add - Scenario: Add an SSH key - When I run "terminus ssh-key:add tests/config/dummy_key.pub" - Then I should get: "Added SSH key from file tests/config/dummy_key.pub" - - @vcr ssh-keys_delete - Scenario: Delete an SSH key - When I run "terminus ssh-key:delete 11111111111111111111111111111" - Then I should get: "Deleted SSH key 11111111111111111111111111111!" - diff --git a/tests/active_features/workflow.feature b/tests/active_features/workflow.feature deleted file mode 100644 index 1b0bc4e8c..000000000 --- a/tests/active_features/workflow.feature +++ /dev/null @@ -1,35 +0,0 @@ -Feature: View site workflow information - In order to view workflow information - As a user - I need to be able to list data related to them. - - Background: I am authenticated and have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr workflows_list - Scenario: List workflows - When I run "terminus workflow:list [[test_site_name]]" - Then I should get: - """ - Sync code on "dev" - """ - - @vcr workflows_show - Scenario: Show a specific Workflow's Details and Operations - When This step is implemented I will test: showing a specific workflow's details - When I run "terminus workflow:info [[test_site_name]] 11111111-1111-1111-1111-111111111111" - Then I should get: - """ - Deploy a CMS (Drupal or Wordpress) - """ - And I should get: - """ - Take Screenshot - """ - - @vcr workflows_show - Scenario: Show the most recent set of logs for a workflow that has logs - When This step is implemented I will test: Show the most recent set of logs for a workflow that has logs - When I run "terminus workflow:info [[test_site_name]] --latest-with-logs" - Then I should see an error message: No recent workflow has logs diff --git a/tests/active_features/wp-cli.feature b/tests/active_features/wp-cli.feature deleted file mode 100644 index f8d530588..000000000 --- a/tests/active_features/wp-cli.feature +++ /dev/null @@ -1,24 +0,0 @@ -Feature: Running WP-CLI Commands on a Drupal Site - In order to interact with Drupal without configuring Pantheon site aliases - As a Terminus user - I want the ability to run arbitrary WP-CLI commands in terminus - - Background: I am authenticated and have a site named [[test_site_name]] - Given I am authenticated - And a site named: [[test_site_name]] - - @vcr remote-wp.yml - Scenario: Running a simple WP-CLI command - When I run: terminus wp [[test_site_name]].dev -- cli version - Then I should get: "Terminus is in test mode" - And I should get: "wp cli version" - - @vcr remote-wp.yml - Scenario: Running a WP-CLI command that is not permitted - When I run: terminus wp [[test_site_name]].dev -- db query 'CHECK TABLE $(wp db tables | paste -s -d',');' - Then I should see an error message: That command is not available via Terminus. Please use the native wp command. - - @vcr remote-drush.yml - Scenario: Running a WP-CLI command on a Drupal site is not possible - When I run: terminus wp [[test_site_name]].dev -- cli version - Then I should see an error message: The wp command is only available on sites running wordpress, wordpress_network. The framework for this site is drupal8. diff --git a/tests/config/behat_10.yml b/tests/config/behat_10.yml deleted file mode 100644 index 83e5a13d6..000000000 --- a/tests/config/behat_10.yml +++ /dev/null @@ -1,41 +0,0 @@ -default: - autoload: [ %paths.base%/../active_features/bootstrap ] - suites: - default: - paths: [ %paths.base%/../active_features ] - contexts: - - Pantheon\Terminus\FeatureTests\FeatureContext: - parameters: - user_id: '11111111-1111-1111-1111-111111111111' - username: 'devuser@pantheon.io' - host: 'onebox' - vcr_mode: 'none' - test_site_name: 'behat-tests' - other_user: 'otheruser@pantheon.io' - php_site_domain: 'pantheonsite.io' - instrument_label: 'Visa - 1111' - instrument_uuid: '11111111-1111-1111-1111-111111111111' - organization_name: '"Organization Name"' - machine_token: '111111111111111111111111111111111111111111111' - machine_token_device: 'Behat Testing Token' - machine_token_id: 'dcr_q4tFMiYiK9DfJO15' - cache_dir: '~/.terminus/behatcache' - qa: - paths: [ %paths.base%/../qa_features ] - contexts: - - Pantheon\Terminus\FeatureTests\FeatureContext: - parameters: - username: 'devuser@pantheon.io' - user_id: '25069e79-eae7-4d41-8925-1f728a114cb8' - password: 'password1' - host: 'onebox' - vcr_mode: null - test_site_name: 'saras-qa-test' - other_user: 'sara@getpantheon.com' - php_site_domain: 'onebox.pantheon.io' - payment_instrument_uuid: '8558e04f-3674-481e-b448-bccff73cb430' - enterprise_org_uuid: 'bf200cbe-8995-4891-b5d4-1a8bdc292905' - enterprise_org_name: 'EnterpriseOrg' - formatter: - name: HtmlFormatter - output_path: /tmp/terminus_qa_report.html diff --git a/tests/config/phpunit.xml.dist b/tests/config/phpunit.xml.dist index 52c9826e1..123a4a2bb 100755 --- a/tests/config/phpunit.xml.dist +++ b/tests/config/phpunit.xml.dist @@ -13,7 +13,6 @@ ../../php/ - ../../src/ ../../utils/ ../../vendor/ diff --git a/tests/newfeatures/aliases.feature b/tests/newfeatures/aliases.feature deleted file mode 100644 index dba14489e..000000000 --- a/tests/newfeatures/aliases.feature +++ /dev/null @@ -1,19 +0,0 @@ -Feature: Gathering sites' aliases - As a Pantheon user - I need to be able to generate a list of aliases - So that I may make use of Drush effectively. - - Background: I am authenticated - Given I am authenticated - - @vcr sites_aliases - Scenario: Generating aliases without printout - When I run "terminus aliases" - Then I should get one of the following: "Pantheon aliases updated, Pantheon aliases created" - And I should not get: "pantheon.io" - - @vcr sites_aliases - Scenario: Generating aliases with printout - When I run "terminus aliases --print" - Then I should get one of the following: "Pantheon aliases updated, Pantheon aliases created" - And I should get: "pantheon.io" diff --git a/tests/newfeatures/art.feature b/tests/newfeatures/art.feature deleted file mode 100644 index c11b2759c..000000000 --- a/tests/newfeatures/art.feature +++ /dev/null @@ -1,28 +0,0 @@ -Feature: ASCII Art display - - Scenario: Display fist art - When I run "terminus art fist" - Then I should get: ".+." - - Scenario: Display Druplicon art - When I run "terminus art druplicon" - Then I should get: ".." - - Scenario: Display WordPress art - When I run "terminus art wordpress" - Then I should get: "............." - - Scenario: Display unicorn art - When I run "terminus art unicorn" - Then I should get: "\" - - Scenario: Display random art - When I run "terminus art" - Then I should get one of the following: "\, .+., .., ............." - - Scenario: Fail to display non-existent artwork - When I run "terminus art invalid" - Then I should get: - """ - There is no source for the requested "invalid" artwork. - """ diff --git a/tests/newfeatures/backup-create.feature b/tests/newfeatures/backup-create.feature deleted file mode 100644 index 93c910dbd..000000000 --- a/tests/newfeatures/backup-create.feature +++ /dev/null @@ -1,38 +0,0 @@ -Feature: Create a new backup for a Site - In order to secure my site against failures - As a user - I need to be able to create a new backup of my site - - Background: I am authenticated and have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_backup_create - Scenario: Create a new backup of the entire environment - When I run "terminus backup:create [[test_site_name]].dev" - Then I should get "." - And I should get "." - Then I should get: - """ - Created a backup of the "dev" environment - """ - - @vcr site_backup_create - Scenario: Create a new backup of a specific element of the environment - When I run "terminus backup:create [[test_site_name]].dev database" - Then I should get "." - And I should get "." - Then I should get: - """ - Created a backup of the "dev" environment - """ - - @vcr site_backup_create - Scenario: Create a new backup of the environment with extended preservation - When I run "terminus backup:create [[test_site_name]].dev --keep-for-days=90" - Then I should get "." - And I should get "." - Then I should get: - """ - Created a backup of the "dev" environment - """ diff --git a/tests/newfeatures/backup-schedule-set.feature b/tests/newfeatures/backup-schedule-set.feature deleted file mode 100644 index fc8c743d9..000000000 --- a/tests/newfeatures/backup-schedule-set.feature +++ /dev/null @@ -1,18 +0,0 @@ -Feature: Set a Backup Schedule for a Site - In order to ensure the security of my site content - As a user - I need to be able to set my automated backup schedule. - - Background: I am authenticated and have a site named [[test_site_name]] - Given I am authenticated - And I list the sites - And a site named "[[test_site_name]]" - - @vcr site_backups_set-schedule - Scenario: Set the backup schedule for an environment - When I run "terminus backup:schedule:set --site=[[test_site_name]] --env=dev --day=Fri" - And I run "terminus backup:schedule:get --site=[[test_site_name]] --env=dev" - Then I should get: - """ - Friday - """ diff --git a/tests/newfeatures/backups-schedule-cancel.feature b/tests/newfeatures/backups-schedule-cancel.feature deleted file mode 100644 index c893e48d6..000000000 --- a/tests/newfeatures/backups-schedule-cancel.feature +++ /dev/null @@ -1,19 +0,0 @@ -Feature: Cancel a Backup Schedule for a Site - In order to manage the security of my site content - As a user - I need to be able to cancel my automated backup schedule. - - Background: I am authenticated and have a site named [[test_site_name]] - Given I am authenticated - And I list the sites - And a site named "[[test_site_name]]" - - @vcr site_backups_cancel-schedule - Scenario: Cancel the backup schedule for an environment - When I run "terminus backup:schedule:set --site=[[test_site_name]] --env=dev --day=Fri" - And I run "terminus backup:schedule:cancel --site=[[test_site_name]] --env=dev" - And I run "terminus backup:schedule:get --site=[[test_site_name]] --env=dev" - Then I should not get: - """ - Friday - """ diff --git a/tests/newfeatures/backups-schedule-get.feature b/tests/newfeatures/backups-schedule-get.feature deleted file mode 100644 index ebe74d83d..000000000 --- a/tests/newfeatures/backups-schedule-get.feature +++ /dev/null @@ -1,25 +0,0 @@ -Feature: List Backup Schedule for a Site - In order to ensure the security of my site content - As a user - I need to be able to show my automated backup schedule. - - Background: I am authenticated and have a site named [[test_site_name]] - Given I am authenticated - And I list the sites - And a site named "[[test_site_name]]" - - @vcr site_backups_get-schedule - Scenario: Show the backup schedule for an environment - When I run "terminus backup:schedule:get --site=[[test_site_name]] --env=dev" - Then I should get: - """ - Friday - """ - - @vcr site_backups_get-schedule_none - Scenario: Fail to show the backup schedule for an environment when none are scheduled - When I run "terminus backup:schedule:get --site=[[test_site_name]] --env=dev" - Then I should get: - """ - Backups are not currently scheduled to be run. - """ diff --git a/tests/newfeatures/branch-delete.feature b/tests/newfeatures/branch-delete.feature deleted file mode 100644 index d8cb4681f..000000000 --- a/tests/newfeatures/branch-delete.feature +++ /dev/null @@ -1,24 +0,0 @@ -Feature: Deleting a site's branches - In order to work collaboratively - As a user - I need to be able to delete a site's branches. - - Background: I am authenticated and I have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_delete-branch - Scenario: Deleting a branch - When I run "terminus branch:delete multidev new_branch --site=[[test_site_name]] --yes" - Then I should get: - """ - Deleted Multidev environment branch "new_branch" - """ - - @vcr site_delete-branch_none - Scenario: Failing to delete branches when the site hasn't any - When I run "terminus branch:delete some_branch --site=[[test_site_name]] --yes" - Then I should get: - """ - The site [[test_site_name]] has no branches which may be deleted. - """ diff --git a/tests/newfeatures/branch-list.feature b/tests/newfeatures/branch-list.feature deleted file mode 100644 index 4a0a8c5d4..000000000 --- a/tests/newfeatures/branch-list.feature +++ /dev/null @@ -1,13 +0,0 @@ -Feature: Listing site branches - In order to maintain my git repository for my site - As a user - In need to be able to list extant branches - - Background: I am authenticated and have a site called [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_code_branches - Scenario: Listing the branches of a site - When I run "terminus branch:list --site=[[test_site_name]]" - Then I should get: "master" diff --git a/tests/newfeatures/dashboard.feature b/tests/newfeatures/dashboard.feature deleted file mode 100644 index 96722fd25..000000000 --- a/tests/newfeatures/dashboard.feature +++ /dev/null @@ -1,27 +0,0 @@ -Feature: Accessing the Dashboard - In order script the opening of Dashboard pages - As a user - I need to be able to get the URL of my Dashboard from Terminus - - Background: I am authenticated and have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_dashboard - Scenario: Printing out the site Dashboard URL - When I run "terminus dashboard:view --site=[[test_site_name]] --print" - Then I should get: "https://[[host]]/sites/11111111-1111-1111-1111111111111111#dev/code" - - @vcr site_dashboard - Scenario: Printing out the main Dashboard URL - When I run "terminus dashboard:view --print" - Then I should get: "https://[[host]]/users/[[user_id]]#sites/list" - - @vcr site_dashboard - Scenario: Printing out the site Dashboard URL for a specific environment - When I run "terminus dashboard:view --site=[[test_site_name]] --env=multidev --print" - Then I should get: "https://[[host]]/sites/11111111-1111-1111-1111111111111111#multidev/code" - - Scenario: Opening a Dashboard window automatically - # We cannot test for it, but `terminus dashboard:view ...` without `--print` - # should open the Dashboard at the URL it generates. diff --git a/tests/newfeatures/domain.feature b/tests/newfeatures/domain.feature deleted file mode 100644 index a719e08d4..000000000 --- a/tests/newfeatures/domain.feature +++ /dev/null @@ -1,56 +0,0 @@ -Feature: Adding domains to an environment - In order to ensure that my site is accessible - As a user - I need to be able to manage domains attached to my site's environnments - - Background: I am authenticated and have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_hostnames_add - Scenario: Adding a hostname to an environment - When I run "terminus domain:add testdomain.com --site=[[test_site_name]] --env=live" - Then I should get: - """ - Added testdomain.com to [[test_site_name]]-live - """ - - @vcr site_hostnames_remove - Scenario: Removing a hostname from an environment - When I run "terminus domain:remove testdomain.com --site=[[test_site_name]] --env=live" - Then I should get: - """ - Deleted testdomain.com from [[test_site_name]]-live - """ - - @vcr site_hostnames_list - Scenario: Listing all hostnames belonging to an environment - When I run "terminus domain:list --site=[[test_site_name]] --env=live" - Then I should get: - """ - live-[[test_site_name]].[[php_site_domain]] - """ - - @vcr site_hostnames_lookup - Scenario: Looking up a hostname belonging to [[test_site_name]] - When I run "terminus domain:lookup dev-[[test_site_name]].[[php_site_domain]]" - Then I should get: - """ - [[test_site_name]] - """ - - @vcr site_hostnames_lookup_invalid - Scenario: Failing to look up an invalid hostname - When I run "terminus domain:lookup invalid" - Then I should get: - """ - Could not locate an environment with the hostname "invalid". - """ - - @vcr site_hostnames_get-recommendations - Scenario: Looking up the DNS recommendations for [[test_site_name]] - When I run "terminus domain:get-recommendations --site=[[test_site_name]] --env=dev" - Then I should get: - """ - dev-[[test_site_name]].[[php_site_domain]] - """ diff --git a/tests/newfeatures/env-clear-cache.feature b/tests/newfeatures/env-clear-cache.feature deleted file mode 100644 index d0faf46e4..000000000 --- a/tests/newfeatures/env-clear-cache.feature +++ /dev/null @@ -1,17 +0,0 @@ -Feature: Clearing a site's cache - In order to keep my site running smoothly and see new changes - As a user - I need to be able to clear my site's cache. - - Background: I am authenticated and I have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_clear-cache - Scenario: Clear the dev environment's cache - When I run "terminus env:clear-cache dev --site=[[test_site_name]]" - Then I should get "." - Then I should get: - """ - Clearing caches for "dev" - """ diff --git a/tests/newfeatures/env-clone.feature b/tests/newfeatures/env-clone.feature deleted file mode 100644 index b8754e34a..000000000 --- a/tests/newfeatures/env-clone.feature +++ /dev/null @@ -1,26 +0,0 @@ -Feature: Cloning site content - In order to duplicate a site - As a user - I need to be able to duplicate a site. - - Background: I am authenticated and have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_clone-content - Scenario: Site Clone Environment - When I run "terminus env:clone --site=[[test_site_name]] --from-env=test --to-env=dev --yes" - Then I should get: - """ - Cloning database - """ - Then I should get "." - Then I should get: - """ - Cloning files - """ - Then I should get "." - Then I should get: - """ - Cloning files from "test" to "dev" - """ diff --git a/tests/newfeatures/env-diff.feature b/tests/newfeatures/env-diff.feature deleted file mode 100644 index 30895052b..000000000 --- a/tests/newfeatures/env-diff.feature +++ /dev/null @@ -1,19 +0,0 @@ -Feature: Diffing environments - In order to maintain my git repository for my site - As a user - In need to be able to check for changes in the code on branches - - Background: I am authenticated and have a site called [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_code_diffstat - Scenario: Looking for changes on the server - When I run "terminus env:diff dev --site=[[test_site_name]]" - Then I should get: "Deletions" - And I should not get: "No changes on the server." - - @vcr site_code_diffstat_empty - Scenario: Looking for changes on the server when there are none - When I run "terminus env:diff dev --site=[[test_site_name]]" - Then I should get: "No changes on server." diff --git a/tests/newfeatures/env-info.feature b/tests/newfeatures/env-info.feature deleted file mode 100644 index ad3e5422a..000000000 --- a/tests/newfeatures/env-info.feature +++ /dev/null @@ -1,34 +0,0 @@ -Feature: Displaying environmental information - In order to access and work with the Pantheon platform - As a user - I need to be able to check information on my site's environments. - - Background: I am authenticated and I have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_environment-info - Scenario: Checking environmental information - When I run "terminus env:info dev --site=[[test_site_name]]" - Then I should get: - """ - dev - """ - - @vcr site_environment-info - Scenario: Checking an information field of an environment - When I run "terminus env:info dev --site=[[test_site_name]] --field=connection_mode" - Then I should get one of the following: "git, sftp" - - @vcr site_environment-info - Scenario: Failing to check an invalid field - When I run "terminus env:info dev --site=[[test_site_name]] --field=invalid" - Then I should get: - """ - There is no field invalid. - """ - - @vcr site_drush-version - Scenario: Retrieving the environment's Drush version - When I run "terminus env:info dev --site=[[test_site_name]] --field=drush_version" - Then I should get one of the following: "5, 6, 7, 8" diff --git a/tests/newfeatures/env-wake.feature b/tests/newfeatures/env-wake.feature deleted file mode 100644 index 71a89c362..000000000 --- a/tests/newfeatures/env-wake.feature +++ /dev/null @@ -1,13 +0,0 @@ -Feature: Waking a site - - Background: I am authenticated and have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_wake - Scenario: Waking a site - When I run "terminus env:wake dev --site=[[test_site_name]]" - Then I should get: - """ - OK >> dev-[[test_site_name]].[[php_site_domain]] responded in - """ diff --git a/tests/newfeatures/env-wipe.feature b/tests/newfeatures/env-wipe.feature deleted file mode 100644 index 23dcb6019..000000000 --- a/tests/newfeatures/env-wipe.feature +++ /dev/null @@ -1,16 +0,0 @@ -Feature: Wipe the content in a site's environment - In order to remove all site content - As a user - I need to be able to wipe a site container of its contents. - - Background: I am authenticated and I have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_wipe - Scenario: Wipe Environment - When I run "terminus env:wipe dev --site=[[test_site_name]] --yes" - Then I should get: - """ - Successfully wiped [[test_site_name]]-dev - """ diff --git a/tests/newfeatures/https.feature b/tests/newfeatures/https.feature deleted file mode 100644 index 39c4a8932..000000000 --- a/tests/newfeatures/https.feature +++ /dev/null @@ -1,25 +0,0 @@ -Feature: Set HTTPS Certificate - In order to enable HTTPS to secure my website - As a user - I need to be able to be able update my environment's HTTPS certificate - - Background: I am authenticated and I have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_set-https-certificate - Scenario: Set an HTTPS Certificate - When I run "terminus https:set --site=[[test_site_name]] --env=live --certificate=fake --private-key=fake" - Then I should get: - """ - Converged loadbalancer - """ - - @vcr site_remove-https-certificate - Scenario: Set an HTTPS Certificate - When I run "terminus https:delete --site=[[test_site_name]] --env=live" - Then I should get: - """ - Converged loadbalancer - """ - diff --git a/tests/newfeatures/lock.feature b/tests/newfeatures/lock.feature deleted file mode 100644 index ba64e8830..000000000 --- a/tests/newfeatures/lock.feature +++ /dev/null @@ -1,40 +0,0 @@ -Feature: Locking and unlocking a site - In order to quickly take down my site in an emergency - As a user - I need to be able to lock and unlock the site. - - Background: I am authenticated and I have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_lock - Scenario: Locking and Unlocking an environment - When I run "terminus lock:add --site=[[test_site_name]] --env=dev --username=pantheon --password=password" - Then I should get: - """ - Creating new lock on [[test_site_name]]-dev - """ - Then I should get: "." - Then I should get: - """ - Locking "dev" - """ - - When I run "terminus lock:rm --site=[[test_site_name]] --env=dev" - Then I should get: - """ - Removing lock from [[test_site_name]]-dev - """ - Then I should get: "." - Then I should get: - """ - Unlocking "dev" - """ - - @vcr site_lock_info - Scenario: Get lock info for an environment - When I run "terminus lock:info --site=[[test_site_name]] --env=dev" - Then I should get: - """ - Locked - """ diff --git a/tests/newfeatures/machine-token.feature b/tests/newfeatures/machine-token.feature deleted file mode 100644 index f2bc5e352..000000000 --- a/tests/newfeatures/machine-token.feature +++ /dev/null @@ -1,23 +0,0 @@ -Feature: Machine tokens command - In order to manage my devices - As a user - I need to be able to view and delete my machine tokens. - - Background: I am logged in - Given I am authenticated - - @vcr machine-tokens_list - Scenario: List the machine tokens - When I run "terminus machine-token:list" - Then I should get: - """ - [[machine_token_id]] - """ - - @vcr machine-tokens_delete - Scenario: Delete machine token - When I run "terminus machine-token:delete [[machine_token_id]] --yes" - Then I should get: - """ - Deleted [[machine_token_device]]! - """ diff --git a/tests/newfeatures/new-relic.feature b/tests/newfeatures/new-relic.feature deleted file mode 100644 index 3d7648b5c..000000000 --- a/tests/newfeatures/new-relic.feature +++ /dev/null @@ -1,23 +0,0 @@ -Feature: New Relic - In order to monitor my site's performance - As a user - I need to be able to view my New Relic data - - Background: I am authenticated and have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_new-relic_status - Scenario: Accessing New Relic data - When I run "terminus site new-relic:status --site=[[test_site_name]]" - Then I should get: "Subscribed" - - @vcr site_new-relic_enable - Scenario: Enabling New Relic data - When I run "terminus site new-relic:enable --site=[[test_site_name]]" - Then I should get one of the following: "New Relic enabled., This site already has a Pantheon-created NewRelic account." - - @vcr site_new-relic_disable - Scenario: Disabling New Relic data - When I run "terminus site new-relic:disable --site=[[test_site_name]]" - Then I should get: "New Relic disabled." diff --git a/tests/newfeatures/org-site.feature b/tests/newfeatures/org-site.feature deleted file mode 100644 index 8155b0180..000000000 --- a/tests/newfeatures/org-site.feature +++ /dev/null @@ -1,32 +0,0 @@ -Feature: Organization sites - In order to associate sites with organizations - As an organizational user - I need to be able to list and edit organizational site memberships. - - Background: I am authenticated - Given I am authenticated - - @vcr organizations_sites_list - Scenario: List an organization's sites - Given a site named "[[test_site_name]]" belonging to "[[organization_name]]" - When I run "terminus org:site:list [[organization_name]]" - Then I should get: "[[test_site_name]]" - And I should not get: "PHP Notice" - - @vcr organizations_sites_add - Scenario: Add a site to an organization - Given a site named "[[test_site_name]]" - When I run "terminus org:site:add --org=[[organization_name]] --site=[[test_site_name]] --yes" - Then I should get: - """ - Added a site to the organization - """ - - @vcr organizations_sites_remove - Scenario: Remove a site from an organization - Given a site named "[[test_site_name]]" belonging to "[[organization_name]]" - When I run "terminus org:site:remove --org=[[organization_name]] --site=[[test_site_name]] --yes" - Then I should get: - """ - Removed a site to the organization - """ diff --git a/tests/newfeatures/org-team.feature b/tests/newfeatures/org-team.feature deleted file mode 100644 index 2fce43579..000000000 --- a/tests/newfeatures/org-team.feature +++ /dev/null @@ -1,39 +0,0 @@ -Feature: Organizational users - In order to coordinate users within organizations - As an organizational user - I need to be able to list organizational user memberships. - - Background: I am authenticated - Given I am authenticated - - @vcr organizations_team_list - Scenario: List an organization's teammates - When I run "terminus org:team:list [[organization_name]]" - Then I should get: - """ - [[username]] - """ - - @vcr organizations_team_add-member - Scenario: Add a new member to a team - When I run "terminus org:team:add --org=[[organization_name]] --member=[[other_user]] --role=team_member" - Then I should get: - """ - Added "[[other_user]]" to the organization - """ - - @vcr organizations_team_remove-member - Scenario: Removing a new member from a team - When I run "terminus org:team:remove --org=[[organization_name]] --member=[[other_user]]" - Then I should get: - """ - Removed user from the organization - """ - - @vcr organizations_team_change-role - Scenario: Changing a team member's role - When I run "terminus org:team:role --org=[[organization_name]] --member=[[other_user]] --role=developer" - Then I should get: - """ - Updated role to "developer" - """ diff --git a/tests/newfeatures/org.feature b/tests/newfeatures/org.feature deleted file mode 100644 index dc04aa6c7..000000000 --- a/tests/newfeatures/org.feature +++ /dev/null @@ -1,15 +0,0 @@ -Feature: Listing one's organizational memberships - In order to manage my organizational memberships - As an organizational user - I need to be able to list my organizational memberships. - - Background: I am authenticated - Given I am authenticated - - @vcr organizations_list - Scenario: List a user's organizational memberships - When I run "terminus org:list" - Then I should get: - """ - [[organization_name]] - """ diff --git a/tests/newfeatures/owner.feature b/tests/newfeatures/owner.feature deleted file mode 100644 index 389ac320c..000000000 --- a/tests/newfeatures/owner.feature +++ /dev/null @@ -1,26 +0,0 @@ -Feature: Set a site's owner - In order to ensure that my site is being managed by the appropriate people - As a user - I need to be able to change the owner of my site. - - Background: I am authenticated and I have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_set-owner - Scenario: Changing the site's owner to another team member - Given "[[other_user]]" is a member of the team on "[[test_site_name]]" - When I run "terminus owner:set [[other_user]] --site=[[test_site_name]]" - Then I should get: - """ - Promoted new owner - """ - - @vcr site_set-owner_solo - Scenario: Failing to change the site owner when there is only one team member - Given "[[other_user]]" is not a member of the team on "[[test_site_name]]" - When I run "terminus owner:set [[username]] --site=[[test_site_name]]" - Then I should get: - """ - The new owner must be added with "terminus site team add-member" before promoting. - """ diff --git a/tests/newfeatures/payment-methods.feature b/tests/newfeatures/payment-methods.feature deleted file mode 100644 index e89e7001c..000000000 --- a/tests/newfeatures/payment-methods.feature +++ /dev/null @@ -1,30 +0,0 @@ -Feature: Payment method command - In order to pay for service - As a user - I need to be able to view and use my payment instruments. - - Background: I am logged in - Given I am authenticated - - @vcr instruments_list - Scenario: Listing a user's payment methods - When I run "terminus payment-method:list" - Then I should get: "[[instrument_label]]" - - @vcr site_set-instrument_add - Scenario: Adding payment methods - Given a site named "[[test_site_name]]" - When I run "terminus payment-method:set [[instrument_uuid]] --site=[[test_site_name]]" - Then I should get: - """ - Associated a payment method to the site - """ - - @vcr site_set-instrument_remove - Scenario: Removing payment methods - Given a site named "[[test_site_name]]" - When I run "terminus payment-method:remove --site=[[test_site_name]]" - Then I should not get: - """ - [[payment_instrument_uuid]] - """ diff --git a/tests/newfeatures/redis.feature b/tests/newfeatures/redis.feature deleted file mode 100644 index 6d0aa5eee..000000000 --- a/tests/newfeatures/redis.feature +++ /dev/null @@ -1,25 +0,0 @@ -Feature: Using Redis - In order to enhance my site's speed and responsivity - As a business or an elite user - I need to be able to manipluate Redis via Terminus. - - Background: Given I am authenticated and have a site belonging to an organization - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_redis_enable - Scenario: Enabling Redis - When I run "terminus redis:enable --site=[[test_site_name]]" - Then I should get: - """ - Redis enabled. Converging bindings... - """ - - @vcr site_redis_disable - Scenario: Disabling Redis - When I run "terminus redis:disable --site=[[test_site_name]]" - Then I should get: - """ - Redis disabled. Converging bindings... - """ - diff --git a/tests/newfeatures/self.feature b/tests/newfeatures/self.feature deleted file mode 100644 index 5ecd51a82..000000000 --- a/tests/newfeatures/self.feature +++ /dev/null @@ -1,12 +0,0 @@ -Feature: CLI Commands - In order to control Terminus - As a user - I need to be able to check and clear system files. - - Scenario: Displaying Terminus information - When I run "terminus self:info" - Then I should get: - """ - Terminus version - """ - diff --git a/tests/newfeatures/service-level.feature b/tests/newfeatures/service-level.feature deleted file mode 100644 index df70dff67..000000000 --- a/tests/newfeatures/service-level.feature +++ /dev/null @@ -1,24 +0,0 @@ -Feature: Set a site's service level - In order to ensure the level of service my site requires - As a user - I need to be able to change the service level on my site. - - Background: I am authenticated and I have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_set-service-level - Scenario: Changing the service level - When I run "terminus service-level:set pro --site=[[test_site_name]]" - Then I should get: - """ - Changing site plan to "pro" - """ - - @vcr site_set-service-level_fail - Scenario: Changing service level without payment method - When I run "terminus service-level:set pro --site=[[test_site_name]]" - Then I should get: - """ - needs to be paid for before the service level can be changed - """ diff --git a/tests/newfeatures/site-create.feature b/tests/newfeatures/site-create.feature deleted file mode 100644 index cae92eaa5..000000000 --- a/tests/newfeatures/site-create.feature +++ /dev/null @@ -1,16 +0,0 @@ -Feature: Create a site - In order to use the Pantheon platform - As a user - I need to be able to create a site on it. - - Background: I am authenticated - Given I am authenticated - - @vcr site_create - Scenario: Create Site - When I run "terminus site:create [[test_site_name]] --label=[[test_site_name]] --upstream=WordPress" - Then I should get: "Creating new site installation ..." - Then I should get: - """ - Creating new site "[[test_site_name]]" - """ diff --git a/tests/newfeatures/site-org.feature b/tests/newfeatures/site-org.feature deleted file mode 100644 index edd0b24d1..000000000 --- a/tests/newfeatures/site-org.feature +++ /dev/null @@ -1,29 +0,0 @@ -Feature: Managing site organizational memberships - In order to manage what organizations a site is a member of - As a user - I need to be able to add and remove those relationships. - - Background: I am authenticated and have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_organizations_add - Scenario: Adding a supporting organization to a site - When I run "terminus site:org:add --site=[[test_site_name]] --org=[[organization_name]]" - Then I should get: - """ - as a supporting organization - """ - - @vcr site_organizations_remove - Scenario: Removing a supporting organization from a site - When I run "terminus site:org:remove --site=[[test_site_name]] --org=[[organization_name]]" - Then I should get: - """ - Removed supporting organization - """ - - @vcr site_organizations_list - Scenario: Listing the supporting organizations of a site - When I run "terminus site:org:list --site=[[test_site_name]]" - Then I should get one of the following: "[[organization_name]], No organizations" diff --git a/tests/newfeatures/tag.feature b/tests/newfeatures/tag.feature deleted file mode 100644 index f4896e24d..000000000 --- a/tests/newfeatures/tag.feature +++ /dev/null @@ -1,40 +0,0 @@ -Feature: Tagging organizational sites - In order to organize and categorize sites - As a user - I need to be able to apply tags to those sites. - - Background: Given I am authenticated and have a site belonging to an organization - Given I am authenticated - And a site named "[[test_site_name]]" belonging to "[[organization_name]]" - - @vcr site_tags_add - Scenario: Adding a tag - When I run "terminus tag:add testtag --site=[[test_site_name]] --org=[[organization_name]]" - Then I should get: - """ - Tag "testtag" has been added to [[test_site_name]] - """ - - @vcr site_tags_list - Scenario: Listing a site's tags - When I run "terminus tag:list --site=[[test_site_name]] --org=[[organization_name]] --format=json" - Then I should get: - """ - {"tags":["testtag"]} - """ - - @vcr site_tags_remove - Scenario: Removing a tag - When I run "terminus site tag:remove testtag --site=[[test_site_name]] --org=[[organization_name]]" - Then I should get: - """ - Tag "testtag" has been removed from [[test_site_name]] - """ - - @vcr site_tags_list_empty - Scenario: Failing to list a site's tags because it hasn't any - When I run "terminus tags:list --site=[[test_site_name]] --org=[[organization_name]] --format=json" - Then I should get: - """ - {"tags":[]} - """ diff --git a/tests/newfeatures/upstream-info.feature b/tests/newfeatures/upstream-info.feature deleted file mode 100644 index 99581c254..000000000 --- a/tests/newfeatures/upstream-info.feature +++ /dev/null @@ -1,13 +0,0 @@ -Feature: Viewing information about a site's upstream - In order to easily maintain my site - As a user - I need to be able to view information about my site's upstream. - - Background: I am authenticated and I have a site named [[test_site_name]] - Given I am authenticated - And a site named "[[test_site_name]]" - - @vcr site_upstream-info - Scenario: Check a site's upstream information - When I run "terminus upstream:info [[test_site_name]]" - Then I should get one of the following: "Product Id" diff --git a/tests/newfeatures/upstream-list.feature b/tests/newfeatures/upstream-list.feature deleted file mode 100644 index eb06f6026..000000000 --- a/tests/newfeatures/upstream-list.feature +++ /dev/null @@ -1,15 +0,0 @@ -Feature: Listing upstreams - In order to decide on which upstream I can use - As a user - I need to be able to list available Pantheon upstreams. - - Background: I am logged in and have a site named [[test_site_name]] - Given I am authenticated - - @vcr upstreams_list - Scenario: List Upstreams - When I run "terminus upstream:list" - Then I should get: - """ - WordPress - """ diff --git a/tests/newfeatures/upstream-updates.feature b/tests/newfeatures/upstream-updates.feature deleted file mode 100644 index b3d5c023a..000000000 --- a/tests/newfeatures/upstream-updates.feature +++ /dev/null @@ -1,15 +0,0 @@ -Feature: Update a site with all its upstream's updates - In order to easily maintain my site - As a user - I need to be able to update my site to reflect updates in its current upstream. - - Background: I am authenticated and I have a site named [[test_site_name]] using Git mode - Given I am authenticated - And a site named "[[test_site_name]]" - And the connection mode of "[[test_site_name]]" is "git" - - @vcr site_upstream-updates - Scenario: Check for upstream updates - When I run "terminus upstream:updates --site=[[test_site_name]] --print" - Then I should get one of the following: "No updates to, Update to" - diff --git a/tests/unit_tests/new/Commands/ArtCommandTest.php b/tests/unit_tests/new/Commands/ArtCommandTest.php deleted file mode 100644 index 55659b002..000000000 --- a/tests/unit_tests/new/Commands/ArtCommandTest.php +++ /dev/null @@ -1,93 +0,0 @@ -command = new ArtCommand(); - $this->command->setConfig($this->config); - $this->setInput(['command' => 'art', 'name' => 'hello']); - } - - /** - * @test - */ - public function artCommandPrintsContentsOfFilesInAssetsDirectory() - { - $this->assertEquals('Hello World!', $this->runCommand()->fetchTrimmedOutput()); - } - - /** - * @test - */ - public function artCommandRejectsFilesNotInAssetsDirectory() - { - $this->setInput(['command' => 'art', 'name' => 'foo']); - $this->assertEquals( - '[error] There is no source for the requested foo artwork.', - $this->runCommand()->fetchTrimmedOutput() - ); - } - - /** - * @test - * @expectedException \Exception - * @expectedExceptionCode 1 - * @expectedExceptionMessage There is no source for the requested foo artwork. - */ - public function retrieveArtThrowsExceptionIfInvalidArtName() - { - $this->protectedMethodCall($this->command, 'retrieveArt', ['foo']); - } - - /** - * @test - */ - public function formatFilenameAppliesProperFormatting() - { - $this->protectedMethodCall($this->command, 'formatFilename', ['foo']); - $this->assertEquals( - $this->config->get('assets_dir') . '/foo.txt', - $this->protectedMethodCall($this->command, 'getFilename', []) - ); - } - - /** - * @test - */ - public function randomArtNameReturnsOneOfTheAvailableArtNames() - { - $this->assertContains( - $this->protectedMethodCall($this->command, 'randomArtName'), - $this->protectedMethodCall($this->command, 'availableArt') - ); - } - - /** - * @test - */ - public function randomArtNameReturnString() - { - $this->assertInternalType( - 'string', - $this->protectedMethodCall($this->command, 'randomArtName') - ); - } - - /** - * @test - */ - public function availableArtReturnsAnArray() - { - $this->assertInternalType( - 'array', - $this->protectedMethodCall($this->command, 'availableArt') - ); - } -} diff --git a/tests/unit_tests/new/Commands/Auth/AuthTest.php b/tests/unit_tests/new/Commands/Auth/AuthTest.php deleted file mode 100644 index 2d2a7806b..000000000 --- a/tests/unit_tests/new/Commands/Auth/AuthTest.php +++ /dev/null @@ -1,26 +0,0 @@ -session = $this->getMockBuilder(Session::class) - ->disableOriginalConstructor() - ->getMock(); - } -} diff --git a/tests/unit_tests/new/Commands/Auth/LoginCommandTest.php b/tests/unit_tests/new/Commands/Auth/LoginCommandTest.php deleted file mode 100644 index bad7d0c16..000000000 --- a/tests/unit_tests/new/Commands/Auth/LoginCommandTest.php +++ /dev/null @@ -1,155 +0,0 @@ -token = $this->getMockBuilder(SavedToken::class) - ->disableOriginalConstructor() - ->getMock(); - $this->token->session = $this->session; - $this->session->tokens = $this->getMockBuilder(SavedTokens::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->command = new LoginCommand(); - $this->command->setConfig($this->config); - $this->command->setLogger($this->logger); - $this->command->setSession($this->session); - } - - /** - * Exercsies LoginCommand::logIn where the machine token is explicitly given - */ - public function testLogInWithMachineToken() - { - $token_string = 'token_string'; - - $this->session->tokens->expects($this->once()) - ->method('get') - ->with($this->equalTo($token_string)) - ->will($this->throwException(new \Exception)); - $this->logger->expects($this->once()) - ->method('log') - ->with( - $this->equalTo('notice'), - $this->equalTo('Logging in via machine token.') - ); - $this->session->tokens->expects($this->once()) - ->method('create') - ->with($this->equalTo($token_string)); - - $out = $this->command->logIn(['machine-token' => $token_string,]); - $this->assertNull($out); - } - - /** - * Exercises LoginCommand::logIn where the email address referencing a saved machine token is given - */ - public function testLogInWithEmail() - { - $email = "email@ddr.ess"; - - $this->session->tokens->expects($this->once()) - ->method('get') - ->with($this->equalTo($email)) - ->willReturn($this->token); - $this->logger->expects($this->once()) - ->method('log') - ->with( - $this->equalTo('notice'), - $this->equalTo('Logging in via machine token.') - ); - $this->token->expects($this->once()) - ->method('logIn') - ->with(); - - $out = $this->command->logIn(compact('email')); - $this->assertNull($out); - } - - /** - * Exercises LoginCommand::logIn when no info is given but a single machine token has been saved - */ - public function testLogInWithSoloSavedToken() - { - $email = "email@ddr.ess"; - - $this->session->tokens->expects($this->once()) - ->method('all') - ->with() - ->willReturn([$this->token,]); - $this->token->expects($this->once()) - ->method('get') - ->with($this->equalTo('email')) - ->willReturn($email); - $this->logger->expects($this->exactly(2)) - ->method('log') - ->withConsecutive( - [ - $this->equalTo('notice'), - $this->equalTo('Found a machine token for {email}.'), - $this->equalTo(compact('email')) - ], - [ - $this->equalTo('notice'), - $this->equalTo('Logging in via machine token.') - ] - ); - $this->token->expects($this->once()) - ->method('logIn'); - - $out = $this->command->logIn(); - $this->assertNull($out); - } - - /** - * Exercises LoginCommand::logIn when no data was given and there are no saved machine tokens - * - * @expectedException \Terminus\Exceptions\TerminusException - * @expectedExceptionMessage Please visit the dashboard to generate a machine token: - */ - public function testCannotLogInWithoutTokens() - { - $this->session->tokens->expects($this->once()) - ->method('all')->willReturn([]); - - $out = $this->command->logIn(); - $this->assertNull($out); - } - - /** - * Exercises LoginCommand::logIn when no data was given and there are multiple saved machine tokens - * - * @expectedException \Terminus\Exceptions\TerminusException - * @expectedExceptionMessage Tokens were saved for the following email addresses: - */ - public function testCannotLogInWithoutIndicatingWhichToken() - { - $this->session->tokens->expects($this->once()) - ->method('all') - ->willReturn([$this->token, $this->token,]); - $this->session->tokens->expects($this->once()) - ->method('ids') - ->willReturn(['token1', 'token2',]); - - $out = $this->command->logIn(); - $this->assertNull($out); - } -} diff --git a/tests/unit_tests/new/Commands/Auth/LogoutCommandTest.php b/tests/unit_tests/new/Commands/Auth/LogoutCommandTest.php deleted file mode 100644 index 919b9d90d..000000000 --- a/tests/unit_tests/new/Commands/Auth/LogoutCommandTest.php +++ /dev/null @@ -1,37 +0,0 @@ -command = new LogoutCommand(); - $this->command->setConfig($this->config); - $this->command->setLogger($this->logger); - $this->command->setSession($this->session); - } - - /** - * Exercises LogoutCommand::logOut - */ - public function testLogInWithMachineToken() - { - $this->session->expects($this->once()) - ->method('destroy') - ->with(); - $this->logger->expects($this->once()) - ->method('log') - ->with($this->equalTo('notice'), $this->equalTo('You have been logged out of Pantheon.')); - - $out = $this->command->logOut(); - $this->assertNull($out); - } -} diff --git a/tests/unit_tests/new/Commands/Auth/WhoamiCommandTest.php b/tests/unit_tests/new/Commands/Auth/WhoamiCommandTest.php deleted file mode 100644 index 8f7c1c356..000000000 --- a/tests/unit_tests/new/Commands/Auth/WhoamiCommandTest.php +++ /dev/null @@ -1,77 +0,0 @@ -command = new WhoamiCommand(); - $this->command->setConfig($this->config); - $this->command->setLogger($this->logger); - $this->command->setSession($this->session); - } - - /** - * Exercises WhoamiCommand::WhoAmI When the user is logged in - */ - public function testWhoAmI() - { - $email = "email@ddr.ess"; - $user = $this->getMockBuilder(User::class) - ->disableOriginalConstructor() - ->getMock(); - $user->expects($this->once()) - ->method('fetch') - ->with() - ->willReturn($user); - $user->expects($this->once()) - ->method('serialize') - ->with() - ->willReturn(compact('email')); - - $this->session->expects($this->once()) - ->method('isActive') - ->with() - ->willReturn(true); - $this->session->expects($this->once()) - ->method('getUser') - ->with() - ->willReturn($user); - $this->logger->expects($this->never()) - ->method('log'); - - $out = $this->command->whoAmI(); - $this->assertInstanceOf(AssociativeList::class, $out); - } - - /** - * Exercises WhoamiCommand::WhoAmI When the user is logged out - */ - public function testWhoAmIWhenIAmLoggedOut() - { - $this->session->expects($this->once()) - ->method('isActive') - ->with() - ->willReturn(false); - $this->logger->expects($this->once()) - ->method('log') - ->with( - $this->equalTo('notice'), - $this->equalTo('You are not logged in.') - ); - - $out = $this->command->whoAmI(); - $this->assertNull($out); - } -} diff --git a/tests/unit_tests/new/Commands/Backup/BackupCommandTest.php b/tests/unit_tests/new/Commands/Backup/BackupCommandTest.php deleted file mode 100644 index 87e780321..000000000 --- a/tests/unit_tests/new/Commands/Backup/BackupCommandTest.php +++ /dev/null @@ -1,44 +0,0 @@ -backups = $this->getMockBuilder(Backups::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->environment->backups = $this->backups; - - $this->backup = $this->getMockBuilder(Backup::class) - ->disableOriginalConstructor() - ->getMock(); - } -} diff --git a/tests/unit_tests/new/Commands/Backup/GetCommandTest.php b/tests/unit_tests/new/Commands/Backup/GetCommandTest.php deleted file mode 100644 index d53807b25..000000000 --- a/tests/unit_tests/new/Commands/Backup/GetCommandTest.php +++ /dev/null @@ -1,84 +0,0 @@ -command = new GetCommand($this->sites); - $this->command->setLogger($this->logger); - $this->command->setSites($this->sites); - } - - /** - * Tests the backup:get command with file - * - * @return void - */ - public function testGotBackupWithFile() - { - $test_filename = 'test.tar.gz'; - $test_download_url = 'http://download'; - - $this->backups->expects($this->once()) - ->method('getBackupByFileName') - ->with($test_filename) - ->willReturn($this->backup); - - $this->backup->expects($this->once()) - ->method('getUrl') - ->willReturn($test_download_url); - - $output = $this->command->gotBackup('mysite.dev', $test_filename); - $this->assertEquals($output, $test_download_url); - } - - /** - * Tests the backup:get command with an element - * - * @return void - */ - public function testGotBackupWithElement() - { - $this->backups->expects($this->once()) - ->method('getFinishedBackups') - ->with('database') - ->willReturn([$this->backup]); - - $this->backup->expects($this->once()) - ->method('getUrl') - ->willReturn('http://download'); - - $output = $this->command->gotBackup('mysite.dev', 'db'); - $this->assertEquals($output, 'http://download'); - } - - /** - * Tests the backup:get command with file that doesn't exist - * - * @return void - */ - public function testGotBackupWithInvalidFile() - { - $this->setExpectedException(TerminusNotFoundException::class); - - $this->backups - ->method('getBackupByFileName') - ->will($this->throwException(new TerminusNotFoundException)); - - $this->command->gotBackup('mysite.dev', 'no-file.tar.gz'); - } -} diff --git a/tests/unit_tests/new/Commands/Backup/ListCommandTest.php b/tests/unit_tests/new/Commands/Backup/ListCommandTest.php deleted file mode 100644 index 647bef64a..000000000 --- a/tests/unit_tests/new/Commands/Backup/ListCommandTest.php +++ /dev/null @@ -1,54 +0,0 @@ -command = new ListCommand($this->sites); - $this->command->setLogger($this->logger); - $this->command->setSites($this->sites); - } - - /** - * Tests the backup:list command without any elements - * - * @return void - */ - public function testListBackups() - { - $this->backups->expects($this->once()) - ->method('getFinishedBackups') - ->willReturn([$this->backup]); - - $this->command->listBackups('mysite.dev'); - } - - /** - * Tests the backup:list command with 'db' element - * - * @return void - */ - public function testListBackupsWithDatabaseElement() - { - $this->backups->expects($this->once()) - ->method('getFinishedBackups') - ->with('database') - ->willReturn([$this->backup]); - - $this->command->listBackups('mysite.dev', 'db'); - } -} diff --git a/tests/unit_tests/new/Commands/CommandTestCase.php b/tests/unit_tests/new/Commands/CommandTestCase.php deleted file mode 100644 index d52d64d73..000000000 --- a/tests/unit_tests/new/Commands/CommandTestCase.php +++ /dev/null @@ -1,304 +0,0 @@ -app; - } - - /** - * @param Terminus $app - * @return $this - */ - public function setApp($app) - { - $this->app = $app; - return $this; - } - - /** - * @return Config - */ - public function getConfig() - { - return $this->config; - } - - /** - * @param Config $config - * @return CommandTestCase - */ - public function setConfig($config) - { - $this->config = $config; - return $this; - } - - /** - * @return Runner - */ - public function getRunner() - { - return $this->runner; - } - - /** - * @param Runner $runner - * @return CommandTestCase - */ - public function setRunner($runner) - { - $this->runner = $runner; - return $this; - } - - /** - * @return OutputInterface - */ - public function getOutput() - { - return $this->output; - } - - /** - * Convert the output of a command to an easily digested string. - * @return string|OutputInterface - */ - public function fetchTrimmedOutput() - { - if (get_class($this->output) == BufferedOutput::class) { - return trim($this->getOutput()->fetch()); - } - return $this->getOutput(); - } - - /** - * @param OutputInterface $output - * @return CommandTestCase - */ - public function setOutput(OutputInterface $output) - { - $this->output = $output; - return $this; - } - - /** - * @return mixed - */ - public function getContainer() - { - return $this->container; - } - - /** - * @param mixed $container - * @return CommandTestCase - */ - public function setContainer($container) - { - $this->container = $container; - return $this; - } - - /** - * @return int - */ - public function getStatusCode() - { - return $this->status_code; - } - - /** - * @param mixed $status_code - * @return CommandTestCase - */ - public function setStatusCode($status_code) - { - $this->status_code = $status_code; - return $this; - } - - /** - * @return mixed - */ - public function getInput() - { - return $this->input; - } - - /** - * @param mixed $input - * @return CommandTestCase - */ - public function setInput($input) - { - $this->input = new ArrayInput($input); - return $this; - } - - /** - * Run the command and capture the exit code. - * - * @return $this - */ - public function runCommand() - { - $this->status_code = $this->runner->run($this->input, $this->output); - return $this; - } - - /** - * @inheritdoc - */ - protected function setUp() - { - if (!$this->config) { - $this->config = new Config(); - } - - if (!$this->app) { - $this->app = new Terminus('Terminus', $this->config->get('version'), $this->config); - } - - if (!$this->container) { - $this->container = new Container(); - } - - if (!$this->output) { - $this->output = new BufferedOutput(); - } - - if (!$this->input) { - $this->input = new ArrayInput([]); - } - // Configuring the dependency-injection container - Robo::configureContainer( - $this->container, - $this->app, - $this->config, - $this->input, - $this->output - ); - - // Set the application dispatcher (required when using Robo::configureContainer) - $this->app->setDispatcher($this->container->get('eventDispatcher')); - - if (!$this->runner) { - $this->runner = new Runner($this->container); - } - - if (!empty($mode = $this->config->get('vcr_mode'))) { - VCR::configure()->setMode($mode); - } - - // These are not used by every test but are useful for SiteAwareInterface commands. Which is a lot of them. - // Use `$command->setSites($this->site());` after you create your command to test. - $this->site = $this->getMockBuilder(Site::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->environment = $this->getMockBuilder(Environment::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->site->environments = $this->getMockBuilder(Environments::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->site->environments->method('get') - ->willReturn($this->environment); - - $this->sites = $this->getMockBuilder(Sites::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->sites->method('get') - ->willReturn($this->site); - - // A lot of commands output to a logger. - // To use this call `$command->setLogger($this->logger);` after you create your command to test. - $this->logger = $this->getMockBuilder(NullLogger::class) - ->setMethods(array('log')) - ->getMock(); - } - - /** - * Expose a protected method to testing - * https://rjzaworski.com/2012/04/testing-protected-methods-in-php - * - * @param mixed $obj Object containing the protected method to be called - * @param string $method Name of protected method - * @param array $args Method arguments - * - * @return mixed - */ - protected function protectedMethodCall($obj, $method, $args = array()) - { - $method = new ReflectionMethod(get_class($obj), $method); - $method->setAccessible(true); - - return $method->invokeArgs($obj, $args); - } -} diff --git a/tests/unit_tests/new/Commands/Connection/ConnectionCommandTest.php b/tests/unit_tests/new/Commands/Connection/ConnectionCommandTest.php deleted file mode 100644 index b434a1554..000000000 --- a/tests/unit_tests/new/Commands/Connection/ConnectionCommandTest.php +++ /dev/null @@ -1,43 +0,0 @@ -logger = $this->getMockBuilder(NullLogger::class) - ->setMethods(array('log')) - ->getMock(); - } - - /** - * Test Suite Teardown - */ - protected function tearDown() - { - parent::tearDown(); - } -} diff --git a/tests/unit_tests/new/Commands/Connection/InfoCommandTest.php b/tests/unit_tests/new/Commands/Connection/InfoCommandTest.php deleted file mode 100644 index 96b49db7f..000000000 --- a/tests/unit_tests/new/Commands/Connection/InfoCommandTest.php +++ /dev/null @@ -1,48 +0,0 @@ -command = new InfoCommand($this->getConfig()); - - // use the basic mocked sites from CommandTestCase - $this->command->setSites($this->sites); - } - - /** - * Ensure connection:info delegates to the Environment::connectionInfo() - * - * @return void - */ - public function testConnectionInfo() - { - // should delegate to the environment model appropriately - $this->environment->expects($this->once())->method('connectionInfo') - ->willReturn(['foo' => 'bar']); - - // command execution - $out = $this->command->connectionInfo('dummy-site.dev'); - - // should return the correct type - $this->assertInstanceOf(AssociativeList::class, $out); - } -} diff --git a/tests/unit_tests/new/Commands/Connection/SetCommandTest.php b/tests/unit_tests/new/Commands/Connection/SetCommandTest.php deleted file mode 100644 index 381317c44..000000000 --- a/tests/unit_tests/new/Commands/Connection/SetCommandTest.php +++ /dev/null @@ -1,116 +0,0 @@ -command = new SetCommand($this->getConfig()); - - // use the basic mocks from CommandTestCase - $this->command->setSites($this->sites); - $this->command->setLogger($this->logger); - } - - /** - * Exercises connection:set git mode - * - * @return void - */ - public function testConnectionSetSuccess() - { - // dummy workflow instance - $workflow = $this->getMockBuilder(Workflow::class) - ->disableOriginalConstructor() - ->getMock(); - - // workflow succeeded - $workflow->expects($this->once())->method('checkProgress')->willReturn(true); - $workflow->expects($this->once())->method('getMessage')->willReturn('successful workflow'); - - $this->environment->expects($this->once())->method('changeConnectionMode') - ->with($this->equalTo('a-valid-mode'))->willReturn($workflow); - - // should display a notice about the mode switch - $this->logger->expects($this->once()) - ->method('log')->with( - $this->equalTo('notice'), - $this->equalTo('successful workflow') - ); - - // trigger command call expectations - $this->command->connectionSet('dummy-site.dummy-env', 'a-valid-mode'); - } - - /** - * Exercises connection:set git mode - * - * @return void - */ - public function testConnectionSetNoOp() - { - $this->environment->expects($this->once())->method('changeConnectionMode') - ->with($this->equalTo('the-current-mode'))->willReturn('noop'); - - // should display a notice about the mode switch - $this->logger->expects($this->once()) - ->method('log')->with( - $this->equalTo('notice'), - $this->equalTo('noop') - ); - - // trigger command call expectations - $this->command->connectionSet('dummy-site.dummy-env', 'the-current-mode'); - } - - /** - * Exercises connection:set with invalid test environment - * - * @return void - */ - public function testConnectionSetInvalidTestEnv() - { - $this->environment->id = 'test'; - - $this->setExpectedException( - TerminusException::class, - 'Connection mode cannot be set on the test environment' - ); - - // trigger command call expectations - $this->command->connectionSet('dummy-site.test', 'any-mode'); - } - - /** - * Exercises connection:set with invalid live environment - * - * @return void - */ - public function testConnectionSetInvalidLiveEnv() - { - $this->environment->id = 'live'; - - $this->setExpectedException( - TerminusException::class, - 'Connection mode cannot be set on the live environment' - ); - - // trigger command call expectations - $this->command->connectionSet('dummy-site.live', 'any-mode'); - } -} diff --git a/tests/unit_tests/new/Commands/Env/CloneCommandTest.php b/tests/unit_tests/new/Commands/Env/CloneCommandTest.php deleted file mode 100644 index 27a05038c..000000000 --- a/tests/unit_tests/new/Commands/Env/CloneCommandTest.php +++ /dev/null @@ -1,48 +0,0 @@ -command = new MockCloneCommand(); - } - - /** - * @test - */ - public function startProgressBarReturnsProgressBar() - { - $this->assertInstanceOf( - '\Symfony\Component\Console\Helper\ProgressBar', - $this->protectedMethodCall($this->command, 'startProgressBar', ['database']) - ); - } - - /** - * @test - */ - public function filterOperationsRemovesOperationsPerFlags() - { - $this->assertArrayNotHasKey( - 'cloneFiles', - $this->protectedMethodCall( - $this->command, - 'filterOperations', - [['db-only' => true, 'files-only' => false]] - ) - ); - - $this->assertArrayNotHasKey( - 'cloneDatabase', - $this->protectedMethodCall( - $this->command, - 'filterOperations', - [['files-only' => true, 'db-only' => false]] - ) - ); - } -} diff --git a/tests/unit_tests/new/Commands/Env/CodeLogCommandTest.php b/tests/unit_tests/new/Commands/Env/CodeLogCommandTest.php deleted file mode 100644 index b08614b6a..000000000 --- a/tests/unit_tests/new/Commands/Env/CodeLogCommandTest.php +++ /dev/null @@ -1,89 +0,0 @@ -command = new CodeLogCommand($this->getConfig()); - $this->command->setLogger($this->logger); - $this->command->setSites($this->sites); - - $this->commits = $this->getMockBuilder(Commits::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->env->commits = $this->commits; - - $this->commit_1_attribs = [ - 'datetime' => '2016-09-21T12:21:18', - 'author' => 'Daisy Duck', - 'labels' => ['test', 'dev'], - 'hash' => 'c65e638f03cabc7b97e686bb9de843b7173e329a', - 'message' => 'Add some new code', - ]; - $this->commit_1 = new Commit((object)$this->commit_1_attribs); - $this->commit_2_attribs = [ - 'datetime' => '2016-09-16T06:53:48', - 'author' => 'Donald Duck', - 'labels' => ['test', 'dev'], - 'hash' => 'bccb7d4972a458e6c788c46bd1afb2de47d88ee3', - 'message' => 'Remove some old code', - ]; - $this->commit_2 = new Commit((object)$this->commit_2_attribs); - } - - /** - * Tests the env:log command success with all parameters. - * - * @return void - */ - public function testLog() - { - $this->env->id = 'dev'; - $this->commits->method('all') - ->willReturn([ - $this->commit_1, - $this->commit_2, - ]); - - $out = $this->command->codeLog('mysite.dev'); - - $this->assertInstanceOf('Consolidation\OutputFormatters\StructuredData\RowsOfFields', $out); - $this->assertEquals(count($out), 2); - $out_1 = $out->getArrayCopy()[0]; - $this->assertEquals($this->commit_1_attribs['datetime'], $out_1['time']); - $this->assertEquals($this->commit_1_attribs['author'], $out_1['author']); - $this->assertEquals($this->commit_1_attribs['hash'], $out_1['hash']); - $this->assertEquals($this->commit_1_attribs['message'], $out_1['message']); - $this->assertEquals('test, dev', $out_1['labels']); - } - - /** - * Tests the env:deploy command where no log is available. - * - * @return void - */ - public function testDeployNoCode() - { - $this->env->id = 'dev'; - $this->commits->method('all') - ->willReturn([]); - - $out = $this->command->codeLog('mysite.dev'); - - $this->assertInstanceOf('Consolidation\OutputFormatters\StructuredData\RowsOfFields', $out); - $this->assertEquals(count($out), 0); - } -} diff --git a/tests/unit_tests/new/Commands/Env/CommitCommandTest.php b/tests/unit_tests/new/Commands/Env/CommitCommandTest.php deleted file mode 100644 index efe50e165..000000000 --- a/tests/unit_tests/new/Commands/Env/CommitCommandTest.php +++ /dev/null @@ -1,44 +0,0 @@ -command = new CommitCommand($this->getConfig()); - $this->command->setLogger($this->logger); - $this->command->setSites($this->sites); - $this->env->id = 'dev'; - } - - /** - * Tests the env:commit command success with all parameters. - * - * @return void - */ - public function testCommit() - { - $this->env->expects($this->once()) - ->method('diffstat') - ->willReturn(['a', 'b']); - - $this->env->expects($this->once()) - ->method('commitChanges') - ->willReturn($this->workflow) - ->with('Custom message.'); - - $this->workflow->expects($this->once()) - ->method('wait'); - - $this->command->commit('mysite.dev', ['message' => 'Custom message.']); - } -} diff --git a/tests/unit_tests/new/Commands/Env/DeployCommandTest.php b/tests/unit_tests/new/Commands/Env/DeployCommandTest.php deleted file mode 100644 index e7b437064..000000000 --- a/tests/unit_tests/new/Commands/Env/DeployCommandTest.php +++ /dev/null @@ -1,118 +0,0 @@ -command = new DeployCommand($this->getConfig()); - $this->command->setLogger($this->logger); - $this->command->setSites($this->sites); - } - - /** - * Tests the env:deploy command success with all parameters. - * - * @return void - */ - public function testDeploy() - { - $this->env->id = 'test'; - - $this->env->expects($this->once()) - ->method('hasDeployableCode') - ->willReturn(true); - - $this->env->expects($this->once()) - ->method('deploy') - ->willReturn($this->workflow) - ->with([ - 'updatedb' => 0, - 'clear_cache' => 0, - 'annotation' => 'Deploy from Terminus', - 'clone_database' => [ - 'from_environment' => 'live' - ], - 'clone_files' => [ - 'from_environment' => 'live' - ] - ]); - - $this->workflow->expects($this->once()) - ->method('wait'); - - // Run the deploy. - $this->command->deploy('mysite.test', [ - 'sync-content' => true, - 'note' => 'Deploy from Terminus', - 'cc' => false, - 'updatedb' => false, - ]); - } - - /** - * Tests the env:deploy command where no code is deployable. - * - * @return void - */ - public function testDeployNoCode() - { - $this->env->id = 'test'; - - $this->env->expects($this->once()) - ->method('hasDeployableCode') - ->willReturn(false); - - $this->env->expects($this->never()) - ->method('deploy'); - - $this->logger->expects($this->once()) - ->method('log'); - - // Run the deploy. - $this->command->deploy('mysite.test'); - } - - /** - * Tests the env:deploy command to live. - * - * @return void - */ - public function testDeployLive() - { - $this->env->id = 'live'; - - $this->env->expects($this->once()) - ->method('hasDeployableCode') - ->willReturn(true); - - $this->env->expects($this->once()) - ->method('deploy') - ->willReturn($this->workflow) - ->with([ - 'updatedb' => 1, - 'clear_cache' => 1, - 'annotation' => 'Deploy from Terminus', - ]); - - $this->workflow->expects($this->once()) - ->method('wait'); - - // Run the deploy. - $this->command->deploy('mysite.live', [ - 'sync-content' => true, - 'note' => 'Deploy from Terminus', - 'cc' => true, - 'updatedb' => true, - ]); - } -} diff --git a/tests/unit_tests/new/Commands/Env/EnvCommandTest.php b/tests/unit_tests/new/Commands/Env/EnvCommandTest.php deleted file mode 100644 index db2d00a14..000000000 --- a/tests/unit_tests/new/Commands/Env/EnvCommandTest.php +++ /dev/null @@ -1,60 +0,0 @@ -sites = $this->getMockBuilder(Sites::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->site = $this->getMockBuilder(Site::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->sites->method('get') - ->willReturn($this->site); - - $this->site->environments = $this->getMockBuilder(Environments::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->env = $this->getMockBuilder(Environment::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->site->environments->method('get') - ->willReturn($this->env); - - $this->logger = $this->getMockBuilder(NullLogger::class) - ->setMethods(array('log')) - ->getMock(); - - $this->workflow = $this->getMockBuilder(Workflow::class) - ->disableOriginalConstructor() - ->getMock(); - } -} diff --git a/tests/unit_tests/new/Commands/Env/MockCloneCommand.php b/tests/unit_tests/new/Commands/Env/MockCloneCommand.php deleted file mode 100644 index d85419241..000000000 --- a/tests/unit_tests/new/Commands/Env/MockCloneCommand.php +++ /dev/null @@ -1,8 +0,0 @@ -machine_tokens = $this->getMockBuilder(MachineTokens::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->user = $this->getMockBuilder(User::class) - ->disableOriginalConstructor() - ->getMock(); - $this->user->machine_tokens = $this->machine_tokens; - - $this->session = $this->getMockBuilder(Session::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->session->method('getUser') - ->willReturn($this->user); - - $this->logger = $this->getMockBuilder(NullLogger::class) - ->setMethods(array('log')) - ->getMock(); - } -} diff --git a/tests/unit_tests/new/Commands/MachineToken/MachineTokensDeleteCommandTest.php b/tests/unit_tests/new/Commands/MachineToken/MachineTokensDeleteCommandTest.php deleted file mode 100644 index a2978ce6b..000000000 --- a/tests/unit_tests/new/Commands/MachineToken/MachineTokensDeleteCommandTest.php +++ /dev/null @@ -1,114 +0,0 @@ -command = new DeleteCommand(new Config()); - $this->command->setSession($this->session); - $this->command->setLogger($this->logger); - } - - - /** - * Tests the machine-token:delete command. - * - * @return void - */ - public function testMachineTokenDelete() - { - $token = $this->getMockBuilder(MachineToken::class) - ->disableOriginalConstructor() - ->getMock(); - - $token->expects($this->once()) - ->method('delete') - ->willReturn( - ['status_code' => 200] - ); - - - $this->machine_tokens->expects($this->once()) - ->method('get') - ->with($this->equalTo('123')) - ->willReturn( - $token - ); - - - $this->command->delete('123'); - } - - /** - * Tests the machine-token:delete command when there are no tokens. - * - * @return void - */ - public function testMachineTokenDeleteNonExistant() - { - $token = $this->getMockBuilder(MachineToken::class) - ->disableOriginalConstructor() - ->getMock(); - - $token->expects($this->never()) - ->method('delete'); - - $this->machine_tokens->expects($this->once()) - ->method('get') - ->with($this->equalTo('123')) - ->will($this->throwException(new TerminusException)); - - - $this->setExpectedException(TerminusException::class); - - $this->command->delete('123'); - } - - /** - * Tests the machine-token:delete command when the API fails. - * - * @return void - */ - public function testMachineTokenDeleteAPIFailure() - { - $token = $this->getMockBuilder(MachineToken::class) - ->disableOriginalConstructor() - ->getMock(); - - $token->expects($this->once()) - ->method('delete') - ->will($this->throwException(new TerminusException('There was an problem deleting the machine token.'))); - - - $this->machine_tokens->expects($this->once()) - ->method('get') - ->with($this->equalTo('123')) - ->willReturn( - $token - ); - - - $this->setExpectedException( - \Exception::class, - 'There was an problem deleting the machine token.' - ); - - $this->command->delete('123'); - } -} diff --git a/tests/unit_tests/new/Commands/MachineToken/MachineTokensListCommandTest.php b/tests/unit_tests/new/Commands/MachineToken/MachineTokensListCommandTest.php deleted file mode 100644 index 649e5aa30..000000000 --- a/tests/unit_tests/new/Commands/MachineToken/MachineTokensListCommandTest.php +++ /dev/null @@ -1,71 +0,0 @@ -command = new ListCommand(new Config()); - $this->command->setSession($this->session); - $this->command->setLogger($this->logger); - } - - /** - * Tests the machine-token:list command when there are no tokens. - * - * @return void - */ - public function testMachineTokenListEmpty() - { - $this->machine_tokens->method('all') - ->willReturn([]); - - $this->logger->expects($this->once()) - ->method('log') - ->with($this->equalTo('warning'), $this->equalTo('You have no machine tokens.')); - - $out = $this->command->listTokens(); - $this->assertInstanceOf('Consolidation\OutputFormatters\StructuredData\RowsOfFields', $out); - $this->assertEquals([], $out->getArrayCopy()); - } - - /** - * Tests the machine-token:list command when there are tokens. - * - * @return void - */ - public function testMachineTokenListNotEmpty() - { - $tokens = [ - ['id' => '1', 'device_name' => 'Foo'], - ['id' => '2', 'device_name' => 'Bar'] - ]; - $collection = new MachineTokens(['user' => $this->user]); - $this->machine_tokens->method('all') - ->willReturn([ - new MachineToken((object)$tokens[0], ['collection' => $collection]), - new MachineToken((object)$tokens[1], ['collection' => $collection]) - ]); - - $this->logger->expects($this->never()) - ->method($this->anything()); - - $out = $this->command->listTokens(); - $this->assertInstanceOf('Consolidation\OutputFormatters\StructuredData\RowsOfFields', $out); - $this->assertEquals($tokens, $out->getArrayCopy()); - } -} diff --git a/tests/unit_tests/new/Commands/Multidev/CreateCommandTest.php b/tests/unit_tests/new/Commands/Multidev/CreateCommandTest.php deleted file mode 100644 index 140eba0e5..000000000 --- a/tests/unit_tests/new/Commands/Multidev/CreateCommandTest.php +++ /dev/null @@ -1,63 +0,0 @@ -command = new CreateCommand($this->getConfig()); - $this->command->setLogger($this->logger); - $this->command->setSites($this->sites); - $this->site->environments->method('create')->willReturn($this->workflow); - } - - /** - * Tests the multidev:create command - */ - public function testMultidevCreate() - { - $multidev_name = 'multipass'; - $this->environment->id = 'dev'; - - $this->workflow->method('getMessage')->willReturn("Created Multidev environment \"$multidev_name\""); - $this->workflow->expects($this->once()) - ->method('wait'); - $this->workflow->method('isSuccessful')->willReturn(true); - $this->logger->expects($this->once()) - ->method('log') - ->with($this->equalTo('notice'), "Created Multidev environment \"$multidev_name\""); - - $out = $this->command->createMultidev($multidev_name, $this->environment); - $this->assertNull($out); - } - - /** - * Tests to ensure the multidev:create throws an error when the environment-creation operation errs - * - * @expectedException \Terminus\Exceptions\TerminusException - * @expectedExceptionMessage The environment "multipass" already exists. - */ - public function testMultidevCreateFailure() - { - $multidev_name = 'multipass'; - $this->environment->id = 'dev'; - - $this->workflow->expects($this->once())->method('wait'); - $this->workflow->method('isSuccessful')->willReturn(false); - $this->workflow->method('getMessage')->willReturn("The environment \"$multidev_name\" already exists."); - - $out = $this->command->createMultidev($multidev_name, $this->environment); - $this->assertNull($out); - } -} diff --git a/tests/unit_tests/new/Commands/Multidev/DeleteCommandTest.php b/tests/unit_tests/new/Commands/Multidev/DeleteCommandTest.php deleted file mode 100644 index 4903aa0f2..000000000 --- a/tests/unit_tests/new/Commands/Multidev/DeleteCommandTest.php +++ /dev/null @@ -1,94 +0,0 @@ -command = new DeleteCommand($this->getConfig()); - $this->command->setLogger($this->logger); - $this->command->setSites($this->sites); - $this->environment->method('delete')->willReturn($this->workflow); - } - - /** - * Tests the multidev:create command - */ - public function testMultidevDelete() - { - $this->environment->id = 'multipass'; - - $this->environment->expects($this->once()) - ->method('delete') - ->with(); - $this->workflow->expects($this->once()) - ->method('wait'); - $this->workflow->method('isSuccessful')->willReturn(true); - $this->logger->expects($this->once()) - ->method('log') - ->with( - $this->equalTo('notice'), - $this->equalTo("Deleted the multidev environment {env}."), - $this->equalTo(['env' => $this->environment->id,]) - ); - - $out = $this->command->deleteMultidev("site.{$this->environment->id}"); - $this->assertNull($out); - } - - /** - * Tests to ensure the multidev:delete to ensure it passes the 'delete-branch' option successfully - */ - public function testMultidevDeleteWithBranch() - { - $this->environment->id = 'multipass'; - - $this->environment->expects($this->once()) - ->method('delete') - ->with($this->equalTo(['delete_branch' => true,])); - $this->workflow->expects($this->once()) - ->method('wait'); - $this->workflow->method('isSuccessful')->willReturn(true); - $this->logger->expects($this->once()) - ->method('log') - ->with( - $this->equalTo('notice'), - $this->equalTo("Deleted the multidev environment {env}."), - $this->equalTo(['env' => $this->environment->id,]) - ); - - $out = $this->command->deleteMultidev("site.{$this->environment->id}", ['delete-branch' => true,]); - $this->assertNull($out); - } - - /** - * Tests to ensure the multidev:create throws an error when the environment-creation operation fails - * - * @expectedException \Terminus\Exceptions\TerminusException - * @expectedExceptionMessage The {env} environment could not be deleted. - */ - public function testMultidevDeleteFailure() - { - $this->environment->expects($this->once()) - ->method('delete') - ->with(); - $this->workflow->expects($this->once()) - ->method('wait'); - $this->workflow->method('isSuccessful')->willReturn(false); - $this->workflow->method('getMessage')->willReturn("The {env} environment could not be deleted."); - - $out = $this->command->deleteMultidev('site.multipass'); - $this->assertNull($out); - } -} diff --git a/tests/unit_tests/new/Commands/Multidev/ListCommandTest.php b/tests/unit_tests/new/Commands/Multidev/ListCommandTest.php deleted file mode 100644 index 008dd2387..000000000 --- a/tests/unit_tests/new/Commands/Multidev/ListCommandTest.php +++ /dev/null @@ -1,67 +0,0 @@ -command = new ListCommand($this->getConfig()); - $this->command->setLogger($this->logger); - $this->command->setSites($this->sites); - } - - /** - * Tests the multidev:list command when there are multidev environments - */ - public function testMultidevListEmpty() - { - $this->site->environments->method('multidev')->willReturn([]); - - $this->logger->expects($this->once()) - ->method('log') - ->with($this->equalTo('warning'), $this->equalTo('You have no multidev environments.')); - - $out = $this->command->listMultidevs('site_name'); - $this->assertInstanceOf('Consolidation\OutputFormatters\StructuredData\RowsOfFields', $out); - $this->assertEquals([], $out->getArrayCopy()); - } - - /** - * Tests the multidev:list command when there are no multidev environments - */ - public function testMultidevListNotEmpty() - { - $data = [ - 'id' => 'testing', - 'created' => '1984/07/28 16:40', - 'domain' => 'domain', - 'on_server_development' => 'true', - 'locked' => 'false', - 'initialized' => 'true', - ]; - - $this->site->environments->method('multidev') - ->willReturn([$this->environment,]); - $this->environment->method('serialize') - ->willReturn($data); - $this->logger->expects($this->never()) - ->method($this->anything()); - - $out = $this->command->listMultidevs('my_site'); - $this->assertInstanceOf('Consolidation\OutputFormatters\StructuredData\RowsOfFields', $out); - - $this->assertEquals([$data,], $out->getArrayCopy()); - } -} diff --git a/tests/unit_tests/new/Commands/Multidev/MergeFromDevCommandTest.php b/tests/unit_tests/new/Commands/Multidev/MergeFromDevCommandTest.php deleted file mode 100644 index b34f11ee1..000000000 --- a/tests/unit_tests/new/Commands/Multidev/MergeFromDevCommandTest.php +++ /dev/null @@ -1,96 +0,0 @@ -command = new MergeFromDevCommand($this->getConfig()); - $this->command->setLogger($this->logger); - $this->command->setSites($this->sites); - $this->environment->method('mergeFromDev')->willReturn($this->workflow); - } - - /** - * Tests the multidev:merge-from-dev command - */ - public function testMergeFromDev() - { - $this->environment->id = 'multipass'; - - $this->environment->expects($this->once()) - ->method('mergeFromDev') - ->with($this->equalTo(['updatedb' => false,])); - $this->workflow->expects($this->once()) - ->method('wait'); - $this->workflow->method('isSuccessful')->willReturn(true); - $this->logger->expects($this->once()) - ->method('log') - ->with( - $this->equalTo('notice'), - $this->equalTo("Merged the dev environment into {env}."), - $this->equalTo(['env' => $this->environment->id,]) - ); - - $out = $this->command->mergeFromDev("site.{$this->environment->id}"); - $this->assertNull($out); - } - - /** - * Tests to ensure the multidev:merge-from-dev to ensure it passes the 'updatedb' option successfully - */ - public function testMergeFromDevWithUpdateDB() - { - $this->environment->id = 'multipass'; - - $this->environment->expects($this->once()) - ->method('mergeFromDev') - ->with($this->equalTo(['updatedb' => true,])); - $this->workflow->expects($this->once()) - ->method('wait'); - $this->workflow->method('isSuccessful')->willReturn(true); - $this->logger->expects($this->once()) - ->method('log') - ->with( - $this->equalTo('notice'), - $this->equalTo("Merged the dev environment into {env}."), - $this->equalTo(['env' => $this->environment->id,]) - ); - - $out = $this->command->mergeFromDev("site.{$this->environment->id}", ['updatedb' => true,]); - $this->assertNull($out); - } - - /** - * Tests to ensure the multidev:merge-from-dev throws an error when the environment-creation operation fails - * - * @expectedException \Terminus\Exceptions\TerminusException - * @expectedExceptionMessage The dev environment could not be merged into {env}. - */ - public function testMergeFfromDevFailure() - { - $this->environment->id = 'multipass'; - - $this->environment->expects($this->once()) - ->method('mergeFromDev') - ->with($this->equalTo(['updatedb' => false,])); - $this->workflow->expects($this->once()) - ->method('wait'); - $this->workflow->method('isSuccessful')->willReturn(false); - $this->workflow->method('getMessage')->willReturn("The dev environment could not be merged into {env}."); - - $out = $this->command->mergeFromDev("site.{$this->environment->id}"); - $this->assertNull($out); - } -} diff --git a/tests/unit_tests/new/Commands/Multidev/MergeToDevCommandTest.php b/tests/unit_tests/new/Commands/Multidev/MergeToDevCommandTest.php deleted file mode 100644 index a37ccde69..000000000 --- a/tests/unit_tests/new/Commands/Multidev/MergeToDevCommandTest.php +++ /dev/null @@ -1,96 +0,0 @@ -command = new MergeToDevCommand($this->getConfig()); - $this->command->setLogger($this->logger); - $this->command->setSites($this->sites); - $this->environment->method('mergeToDev')->willReturn($this->workflow); - } - - /** - * Tests the multidev:merge-to-dev command - */ - public function testMergeToDev() - { - $this->environment->id = 'multipass'; - - $this->environment->expects($this->once()) - ->method('mergeToDev') - ->with($this->equalTo(['from_environment' => $this->environment->id, 'updatedb' => false,])); - $this->workflow->expects($this->once()) - ->method('wait'); - $this->workflow->method('isSuccessful')->willReturn(true); - $this->logger->expects($this->once()) - ->method('log') - ->with( - $this->equalTo('notice'), - $this->equalTo("Merged the {env} environment into dev."), - $this->equalTo(['env' => $this->environment->id,]) - ); - - $out = $this->command->mergeToDev("site.{$this->environment->id}"); - $this->assertNull($out); - } - - /** - * Tests to ensure the multidev:merge-to-dev to ensure it passes the 'updatedb' option successfully - */ - public function testMergeToDevWithUpdateDB() - { - $this->environment->id = 'multipass'; - - $this->environment->expects($this->once()) - ->method('mergeToDev') - ->with($this->equalTo(['from_environment' => $this->environment->id, 'updatedb' => true,])); - $this->workflow->expects($this->once()) - ->method('wait'); - $this->workflow->method('isSuccessful')->willReturn(true); - $this->logger->expects($this->once()) - ->method('log') - ->with( - $this->equalTo('notice'), - $this->equalTo("Merged the {env} environment into dev."), - $this->equalTo(['env' => $this->environment->id,]) - ); - - $out = $this->command->mergeToDev("site.{$this->environment->id}", ['updatedb' => true,]); - $this->assertNull($out); - } - - /** - * Tests to ensure the multidev:merge-to-dev throws an error when the environment-creation operation fails - * - * @expectedException \Terminus\Exceptions\TerminusException - * @expectedExceptionMessage The {env} environment could not be merged into dev. - */ - public function testMergeToDevFailure() - { - $this->environment->id = 'multipass'; - - $this->environment->expects($this->once()) - ->method('mergeToDev') - ->with($this->equalTo(['from_environment' => $this->environment->id, 'updatedb' => false,])); - $this->workflow->expects($this->once()) - ->method('wait'); - $this->workflow->method('isSuccessful')->willReturn(false); - $this->workflow->method('getMessage')->willReturn("The {env} environment could not be merged into dev."); - - $out = $this->command->mergeToDev("site.{$this->environment->id}"); - $this->assertNull($out); - } -} diff --git a/tests/unit_tests/new/Commands/Multidev/MultidevCommandTest.php b/tests/unit_tests/new/Commands/Multidev/MultidevCommandTest.php deleted file mode 100644 index 7266f7169..000000000 --- a/tests/unit_tests/new/Commands/Multidev/MultidevCommandTest.php +++ /dev/null @@ -1,28 +0,0 @@ -workflow = $this->getMockBuilder(Workflow::class) - ->disableOriginalConstructor() - ->getMock(); - } -} diff --git a/tests/unit_tests/new/Commands/Remote/DrushCommandTest.php b/tests/unit_tests/new/Commands/Remote/DrushCommandTest.php deleted file mode 100644 index f2a8e93ee..000000000 --- a/tests/unit_tests/new/Commands/Remote/DrushCommandTest.php +++ /dev/null @@ -1,37 +0,0 @@ -getMockBuilder(DrushCommand::class) - ->disableOriginalConstructor() - ->setMethods([ - 'prepareEnvironment', - 'executeCommand', - ]) - ->getMock(); - - $command->expects($this->once()) - ->method('prepareEnvironment') - ->with($this->equalTo('dummy-site.dummy-env')); - - $command->expects($this->once()) - ->method('executeCommand') - ->willReturn('command output'); - - $output = $command->drushCommand('dummy-site.dummy-env', ['drushable', 'command', 'arguments']); - $this->assertEquals('command output', $output); - } -} diff --git a/tests/unit_tests/new/Commands/Remote/DummyCommand.php b/tests/unit_tests/new/Commands/Remote/DummyCommand.php deleted file mode 100644 index 6c985ad86..000000000 --- a/tests/unit_tests/new/Commands/Remote/DummyCommand.php +++ /dev/null @@ -1,30 +0,0 @@ - 'alternative', - 'no-alternative' => '', - ]; - - protected $valid_frameworks = [ - 'framework-a', - 'framework-b', - ]; - - public function dummyCommand($site_env_id, array $dummy_args) - { - $this->prepareEnvironment($site_env_id); - - return $this->executeCommand($dummy_args); - } -} diff --git a/tests/unit_tests/new/Commands/Remote/SSHBaseCommandTest.php b/tests/unit_tests/new/Commands/Remote/SSHBaseCommandTest.php deleted file mode 100644 index b3416eb1c..000000000 --- a/tests/unit_tests/new/Commands/Remote/SSHBaseCommandTest.php +++ /dev/null @@ -1,112 +0,0 @@ -command = new DummyCommand($this->getConfig()); - $this->command->setSites($this->sites); - $this->command->setLogger($this->logger); - - $this->site->expects($this->any())->method('get') - ->withConsecutive( - [$this->equalTo('framework')], - [$this->equalTo('name')] - ) - ->willReturnOnConsecutiveCalls('framework-a', 'site'); - } - - public function testExecuteCommand() - { - // fake out ssh command - $this->environment->expects($this->once()) - ->method('sendCommandViaSsh') - ->with($this->equalTo('dummy arg1 arg2')) - ->willReturn(['output' => 'dummy output', 'exit_code' => 0]); - - $output = $this->command->dummyCommand('site.env', ['arg1', 'arg2']); - - $this->assertEquals('dummy output', $output); - } - - public function testUnavailableWithSuggestion() - { - //expected info and error messages - $this->logger->expects($this->once()) - ->method('log')->with( - $this->equalTo('error'), - $this->equalTo( - 'That command is not available via Terminus. ' - . 'Please use the native {command} command. ' - . 'Hint: You may want to try `{suggestion}`.' - ), - $this->equalTo([ - 'command' => 'dummy', - 'suggestion' => "terminus alternative" - ]) - ); - - $output = $this->command->dummyCommand('site.env', ['avoided']); - - $this->assertEquals('', $output); - } - - public function testUnavailableWithoutSuggestion() - { - //expected info and error messages - $this->logger->expects($this->once()) - ->method('log')->with( - $this->equalTo('error'), - $this->equalTo( - 'That command is not available via Terminus. ' - . 'Please use the native {command} command.' - ), - $this->equalTo([ - 'command' => 'dummy', - ]) - ); - - $output = $this->command->dummyCommand('site.env', ['no-alternative']); - - $this->assertEquals('', $output); - } - - public function testValidateConnectionMode() - { - // should log error message - $this->logger->expects($this->once()) - ->method('log')->with( - $this->equalTo('notice'), - $this->stringContains('This environment is in read-only Git mode.') - ); - - $this->protectedMethodCall($this->command, 'validateConnectionMode', ['git']); - } - - public function testValidateFrameworkValid() - { - $this->protectedMethodCall($this->command, 'validateFramework', ['framework-a']); - } - - /** - * @expectedException \Terminus\Exceptions\TerminusException - * @expectedExceptionMessage The dummy command is only available on sites running framework-a, framework-b. - */ - public function testValidateFrameworkInvalid() - { - $this->protectedMethodCall($this->command, 'validateFramework', ['framework-invalid']); - } -} diff --git a/tests/unit_tests/new/Commands/Remote/WpCommandTest.php b/tests/unit_tests/new/Commands/Remote/WpCommandTest.php deleted file mode 100644 index 1f8a045cd..000000000 --- a/tests/unit_tests/new/Commands/Remote/WpCommandTest.php +++ /dev/null @@ -1,37 +0,0 @@ -getMockBuilder(WpCommand::class) - ->disableOriginalConstructor() - ->setMethods([ - 'prepareEnvironment', - 'executeCommand', - ]) - ->getMock(); - - $command->expects($this->once()) - ->method('prepareEnvironment') - ->with($this->equalTo('dummy-site.dummy-env')); - - $command->expects($this->once()) - ->method('executeCommand') - ->willReturn('command output'); - - $output = $command->wpCommand('dummy-site.dummy-env', ['wpcli', 'command', 'arguments']); - $this->assertEquals('command output', $output); - } -} diff --git a/tests/unit_tests/new/Commands/SSHKeys/SSHKeysCommandTest.php b/tests/unit_tests/new/Commands/SSHKeys/SSHKeysCommandTest.php deleted file mode 100644 index 851af424e..000000000 --- a/tests/unit_tests/new/Commands/SSHKeys/SSHKeysCommandTest.php +++ /dev/null @@ -1,45 +0,0 @@ -ssh_keys = $this->getMockBuilder(SshKeys::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->user = $this->getMockBuilder(User::class) - ->disableOriginalConstructor() - ->getMock(); - $this->user->ssh_keys = $this->ssh_keys; - - $this->session = $this->getMockBuilder(Session::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->session->method('getUser') - ->willReturn($this->user); - } -} diff --git a/tests/unit_tests/new/Commands/SSHKeys/SSHKeysDeleteCommandTest.php b/tests/unit_tests/new/Commands/SSHKeys/SSHKeysDeleteCommandTest.php deleted file mode 100644 index 104f5ba54..000000000 --- a/tests/unit_tests/new/Commands/SSHKeys/SSHKeysDeleteCommandTest.php +++ /dev/null @@ -1,115 +0,0 @@ -command = new DeleteCommand($this->getConfig()); - $this->command->setSession($this->session); - $this->command->setLogger($this->logger); - } - - - /** - * Tests the ssh-keys:delete command. - * - * @return void - */ - public function testSSHKeysDelete() - { - $token = $this->getMockBuilder(SshKey::class) - ->disableOriginalConstructor() - ->getMock(); - - $token->expects($this->exactly(2)) - ->method('delete') - ->willReturn( - ['status_code' => 200] - ); - - - $this->ssh_keys->expects($this->exactly(2)) - ->method('get') - ->with($this->equalTo('79e7e210bdf335bb8651a46b9a8417ab')) - ->willReturn( - $token - ); - - - $this->command->delete('79e7e210bdf335bb8651a46b9a8417ab'); - $this->command->delete('79:e7:e2:10:bd:f3:35:bb:86:51:a4:6b:9a:84:17:ab'); - } - - /** - * Tests the ssh-keys:delete command when there are no tokens. - * - * @return void - */ - public function testSSHKeysDeleteNonExistant() - { - $token = $this->getMockBuilder(SshKey::class) - ->disableOriginalConstructor() - ->getMock(); - - $token->expects($this->never()) - ->method('delete'); - - $this->ssh_keys->expects($this->once()) - ->method('get') - ->with($this->equalTo('123')) - ->will($this->throwException(new TerminusException)); - - - $this->setExpectedException(TerminusException::class); - - $this->command->delete('123'); - } - - /** - * Tests the ssh-keys:delete command when the API fails. - * - * @return void - */ - public function testSSHKeysDeleteAPIFailure() - { - $token = $this->getMockBuilder(SshKey::class) - ->disableOriginalConstructor() - ->getMock(); - - $token->expects($this->once()) - ->method('delete') - ->will($this->throwException(new TerminusException('There was an problem deleting the SSH key.'))); - - - $this->ssh_keys->expects($this->once()) - ->method('get') - ->with($this->equalTo('123')) - ->willReturn( - $token - ); - - - $this->setExpectedException( - \Exception::class, - 'There was an problem deleting the SSH key.' - ); - - $this->command->delete('123'); - } -} diff --git a/tests/unit_tests/new/Commands/SSHKeys/SSHKeysListCommandTest.php b/tests/unit_tests/new/Commands/SSHKeys/SSHKeysListCommandTest.php deleted file mode 100644 index c93cb0af2..000000000 --- a/tests/unit_tests/new/Commands/SSHKeys/SSHKeysListCommandTest.php +++ /dev/null @@ -1,93 +0,0 @@ -command = new ListCommand($this->getConfig()); - $this->command->setSession($this->session); - $this->command->setLogger($this->logger); - } - - /** - * Tests the ssh-key:list command when there are no tokens. - * - * @return void - */ - public function testSSHKeyListEmpty() - { - $this->ssh_keys->method('all') - ->willReturn([]); - - $this->logger->expects($this->once()) - ->method('log') - ->with($this->equalTo('warning'), $this->equalTo('You have no ssh keys.')); - - $out = $this->command->listSSHKeys(); - $this->assertInstanceOf('Consolidation\OutputFormatters\StructuredData\RowsOfFields', $out); - $this->assertEquals([], $out->getArrayCopy()); - } - - - /** - * Tests the ssh-key:list command when there are tokens. - * - * @return void - */ - public function testSSHKeysListNotEmpty() - { - $keys = [ - [ - 'id' => '79e7e210bdf335bb8651a46b9a8417ab', - 'key' => 'ssh-rsa xxxxxxx dev@foo.bar', - ], - [ - 'id' => '27a7a11ab9d2acbf91063410546ef980', - 'key' => 'ssh-rsa yyyyyyy dev@baz.bar', - ] - ]; - $output = [ - [ - 'id' => '79e7e210bdf335bb8651a46b9a8417ab', - 'hex' => '79:e7:e2:10:bd:f3:35:bb:86:51:a4:6b:9a:84:17:ab', - 'comment' => 'dev@foo.bar' - ], - [ - 'id' => '27a7a11ab9d2acbf91063410546ef980', - 'hex' => '27:a7:a1:1a:b9:d2:ac:bf:91:06:34:10:54:6e:f9:80', - 'comment' => 'dev@baz.bar' - ] - ]; - $collection = new SshKeys(['user' => $this->user]); - $this->ssh_keys->method('all') - ->willReturn([ - new SshKey((object)$keys[0], ['collection' => $collection]), - new SshKey((object)$keys[1], ['collection' => $collection]) - ]); - - $this->logger->expects($this->never()) - ->method($this->anything()); - - $out = $this->command->listSSHKeys(); - $this->assertInstanceOf('Consolidation\OutputFormatters\StructuredData\RowsOfFields', $out); - $this->assertEquals($output, $out->getArrayCopy()); - } -} diff --git a/tests/unit_tests/new/Commands/Site/DeleteCommandTest.php b/tests/unit_tests/new/Commands/Site/DeleteCommandTest.php deleted file mode 100644 index 8c807c3de..000000000 --- a/tests/unit_tests/new/Commands/Site/DeleteCommandTest.php +++ /dev/null @@ -1,69 +0,0 @@ -command = new DeleteCommand($this->getConfig()); - $this->command->setSites($this->sites); - $this->command->setLogger($this->logger); - } - - /** - * Exercises the site:delete command - */ - public function testDelete() - { - $site_name = 'my-site'; - - $this->site->expects($this->once()) - ->method('delete') - ->with(); - $this->logger->expects($this->once()) - ->method('log')->with( - $this->equalTo('notice'), - $this->equalTo("Deleted {site} from Pantheon"), - $this->equalTo(['site' => $site_name,]) - ); - - $out = $this->command->delete($site_name); - $this->assertNull($out); - } - - - /** - * Exercises the site:delete command when Site::delete fails to ensure message gets through - * - * @expectedException \Exception - * @expectedExceptionMessage Error message - */ - public function testDeleteFailure() - { - $site_name = 'my-site'; - - $this->site->expects($this->once()) - ->method('delete') - ->with() - ->will($this->throwException(new \Exception('Error message'))); - $this->logger->expects($this->never()) - ->method('log'); - - $out = $this->command->delete($site_name); - $this->assertNull($out); - } -} diff --git a/tests/unit_tests/new/Commands/Site/ImportCommandTest.php b/tests/unit_tests/new/Commands/Site/ImportCommandTest.php deleted file mode 100644 index f730feb9b..000000000 --- a/tests/unit_tests/new/Commands/Site/ImportCommandTest.php +++ /dev/null @@ -1,53 +0,0 @@ -command = new ImportCommand($this->getConfig()); - $this->command->setSites($this->sites); - $this->command->setLogger($this->logger); - } - - /** - * Exercises site:import command with a valid url - * - * @return void - * - */ - public function testSiteImportValidURL() - { - $workflow = $this->getMockBuilder(Workflow::class) - ->disableOriginalConstructor() - ->getMock(); - - $workflow->expects($this->once())->method('wait')->willReturn(true); - - $this->environment->expects($this->once())->method('import') - ->with($this->equalTo('a-valid-url'))->willReturn($workflow); - $this->logger->expects($this->once()) - ->method('log')->with( - $this->equalTo('notice'), - $this->equalTo('Imported site onto Pantheon') - ); - - $this->command->import('dummy-site', 'a-valid-url'); - } -} diff --git a/tests/unit_tests/new/Commands/Site/InfoCommandTest.php b/tests/unit_tests/new/Commands/Site/InfoCommandTest.php deleted file mode 100644 index 6cd19ef9d..000000000 --- a/tests/unit_tests/new/Commands/Site/InfoCommandTest.php +++ /dev/null @@ -1,40 +0,0 @@ -command = new InfoCommand($this->getConfig()); - $this->command->setSites($this->sites); - $this->command->setLogger($this->logger); - } - - /** - * Exercises site:info - */ - public function testSiteImportValidURL() - { - $this->site->expects($this->once()) - ->method('serialize') - ->willReturn(['data' => 'array',]); - $this->logger->expects($this->never()) - ->method('log'); - - $out = $this->command->info('my-site'); - $this->assertInstanceOf(AssociativeList::class, $out); - } -} diff --git a/tests/unit_tests/new/Commands/Site/ListCommandTest.php b/tests/unit_tests/new/Commands/Site/ListCommandTest.php deleted file mode 100644 index dfd82d04b..000000000 --- a/tests/unit_tests/new/Commands/Site/ListCommandTest.php +++ /dev/null @@ -1,302 +0,0 @@ -session = $this->getMockBuilder(Session::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->command = new ListCommand($this->getConfig()); - $this->command->setSites($this->sites); - $this->command->setLogger($this->logger); - $this->command->setSession($this->session); - } - - /** - * Exercises site:list with no filters and all membership types - */ - public function testListAllSites() - { - $dummy_info = [ - 'name' => 'my-site', - 'id' => 'site_id', - 'service_level' => 'pro', - 'framework' => 'cms', - 'owner' => 'user_id', - 'created' => '1984-07-28 16:40', - 'memberships' => 'org_id: org_url', - ]; - - $this->site->memberships = ['org_id: org_url']; - $this->sites->expects($this->once()) - ->method('fetch') - ->with($this->equalTo(['org_id' => null, 'team_only' => false,])) - ->willReturn($this->sites); - $this->sites->expects($this->never()) - ->method('filterByName'); - $this->session->expects($this->never()) - ->method('getUser'); - $this->sites->expects($this->never()) - ->method('filterByOwner'); - $this->site->expects($this->any()) - ->method('serialize') - ->with() - ->willReturn($dummy_info); - $this->sites->expects($this->once()) - ->method('all') - ->with() - ->willReturn([$this->site, $this->site,]); - $this->logger->expects($this->never()) - ->method('log'); - - $out = $this->command->index(); - $this->assertInstanceOf(RowsOfFields::class, $out); - $this->assertEquals([$dummy_info, $dummy_info,], $out->getArrayCopy()); - } - - /** - * Exercises site:list with no filters and team membership type - */ - public function testListTeamSitesOnly() - { - $dummy_info = [ - 'name' => 'my-site', - 'id' => 'site_id', - 'service_level' => 'pro', - 'framework' => 'cms', - 'owner' => 'user_id', - 'created' => '1984-07-28 16:40', - 'memberships' => 'user_id: Team', - ]; - - $this->site->memberships = ['user_id: Team']; - $this->sites->expects($this->once()) - ->method('fetch') - ->with($this->equalTo(['org_id' => null, 'team_only' => true,])) - ->willReturn($this->sites); - $this->sites->expects($this->never()) - ->method('filterByName'); - $this->session->expects($this->never()) - ->method('getUser'); - $this->sites->expects($this->never()) - ->method('filterByOwner'); - $this->site->expects($this->any()) - ->method('serialize') - ->with() - ->willReturn($dummy_info); - $this->sites->expects($this->once()) - ->method('all') - ->with() - ->willReturn([$this->site, $this->site,]); - $this->logger->expects($this->never()) - ->method('log'); - - $out = $this->command->index(['team' => true, 'owner' => null, 'org' => null, 'name' => null,]); - $this->assertInstanceOf(RowsOfFields::class, $out); - $this->assertEquals([$dummy_info, $dummy_info,], $out->getArrayCopy()); - } - - /** - * Exercises site:list with no filters and belonging to an org - */ - public function testListOrgSitesOnly() - { - $dummy_info = [ - 'name' => 'my-site', - 'id' => 'site_id', - 'service_level' => 'pro', - 'framework' => 'cms', - 'owner' => 'user_id', - 'created' => '1984-07-28 16:40', - 'memberships' => 'org_id: org_url', - ]; - - $this->site->memberships = ['org_id: org_url']; - $this->sites->expects($this->once()) - ->method('fetch') - ->with($this->equalTo(['org_id' => 'org_id', 'team_only' => false,])) - ->willReturn($this->sites); - $this->sites->expects($this->never()) - ->method('filterByName'); - $this->session->expects($this->never()) - ->method('getUser'); - $this->sites->expects($this->never()) - ->method('filterByOwner'); - $this->site->expects($this->any()) - ->method('serialize') - ->with() - ->willReturn($dummy_info); - $this->sites->expects($this->once()) - ->method('all') - ->with() - ->willReturn([$this->site, $this->site,]); - $this->logger->expects($this->never()) - ->method('log'); - - $out = $this->command->index(['team' => false, 'owner' => null, 'org' => 'org_id', 'name' => null,]); - $this->assertInstanceOf(RowsOfFields::class, $out); - $this->assertEquals([$dummy_info, $dummy_info,], $out->getArrayCopy()); - } - - /** - * Exercises site:list with a name filter of either membership type - */ - public function testListByNameRegex() - { - $dummy_info = [ - 'name' => 'my-site', - 'id' => 'site_id', - 'service_level' => 'pro', - 'framework' => 'cms', - 'owner' => 'user_id', - 'created' => '1984-07-28 16:40', - 'memberships' => 'org_id: org_url', - ]; - $regex = '(.*)'; - - $this->site->memberships = ['org_id: org_url']; - $this->sites->expects($this->once()) - ->method('fetch') - ->with($this->equalTo(['org_id' => null, 'team_only' => false,])) - ->willReturn($this->sites); - $this->sites->expects($this->once()) - ->method('filterByName') - ->with($this->equalTo($regex)) - ->willReturn($this->sites); - $this->session->expects($this->never()) - ->method('getUser'); - $this->sites->expects($this->never()) - ->method('filterByOwner'); - $this->site->expects($this->any()) - ->method('serialize') - ->with() - ->willReturn($dummy_info); - $this->sites->expects($this->once()) - ->method('all') - ->with() - ->willReturn([$this->site, $this->site,]); - $this->logger->expects($this->never()) - ->method('log'); - - $out = $this->command->index(['team' => false, 'owner' => null, 'org' => null, 'name' => $regex,]); - $this->assertInstanceOf(RowsOfFields::class, $out); - $this->assertEquals([$dummy_info, $dummy_info,], $out->getArrayCopy()); - } - - /** - * Exercises site:list of either membership type owned by a user of a given ID - */ - public function testListByOwner() - { - $user_id = 'user_id'; - $dummy_info = [ - 'name' => 'my-site', - 'id' => 'site_id', - 'service_level' => 'pro', - 'framework' => 'cms', - 'owner' => $user_id, - 'created' => '1984-07-28 16:40', - 'memberships' => 'org_id: org_url', - ]; - - $this->site->memberships = ['org_id: org_url']; - $this->sites->expects($this->once()) - ->method('fetch') - ->with($this->equalTo(['org_id' => null, 'team_only' => false,])) - ->willReturn($this->sites); - $this->session->expects($this->never()) - ->method('filterByName'); - $this->session->expects($this->never()) - ->method('getUser'); - $this->sites->expects($this->once()) - ->method('filterByOwner') - ->with($this->equalTo($user_id)) - ->willReturn($this->sites); - $this->site->expects($this->any()) - ->method('serialize') - ->with() - ->willReturn($dummy_info); - $this->sites->expects($this->once()) - ->method('all') - ->with() - ->willReturn([$this->site, $this->site,]); - $this->logger->expects($this->never()) - ->method('log'); - - $out = $this->command->index(['team' => false, 'owner' => $user_id, 'org' => null, 'name' => null,]); - $this->assertInstanceOf(RowsOfFields::class, $out); - $this->assertEquals([$dummy_info, $dummy_info,], $out->getArrayCopy()); - } - - /** - * Exercises site:list of either membership type owned by a user is the logged-in user - */ - public function testListMyOwn() - { - $user_id = 'user_id'; - $dummy_info = [ - 'name' => 'my-site', - 'id' => 'site_id', - 'service_level' => 'pro', - 'framework' => 'cms', - 'owner' => $user_id, - 'created' => '1984-07-28 16:40', - 'memberships' => 'org_id: org_url', - ]; - $user = $this->getMockBuilder(User::class) - ->disableOriginalConstructor() - ->getMock(); - $user->id = $user_id; - - $this->site->memberships = ['org_id: org_url']; - $this->sites->expects($this->once()) - ->method('fetch') - ->with($this->equalTo(['org_id' => null, 'team_only' => false,])) - ->willReturn($this->sites); - $this->session->expects($this->never()) - ->method('filterByName'); - $this->session->expects($this->once()) - ->method('getUser') - ->with() - ->willReturn($user); - $this->sites->expects($this->once()) - ->method('filterByOwner') - ->with($this->equalTo($user_id)) - ->willReturn($this->sites); - $this->site->expects($this->any()) - ->method('serialize') - ->with() - ->willReturn($dummy_info); - $this->sites->expects($this->once()) - ->method('all') - ->with() - ->willReturn([$this->site, $this->site,]); - $this->logger->expects($this->never()) - ->method('log'); - - $out = $this->command->index(['team' => false, 'owner' => 'me', 'org' => null, 'name' => null,]); - $this->assertInstanceOf(RowsOfFields::class, $out); - $this->assertEquals([$dummy_info, $dummy_info,], $out->getArrayCopy()); - } -} diff --git a/tests/unit_tests/new/Commands/Site/LookupCommandTest.php b/tests/unit_tests/new/Commands/Site/LookupCommandTest.php deleted file mode 100644 index 29404f0de..000000000 --- a/tests/unit_tests/new/Commands/Site/LookupCommandTest.php +++ /dev/null @@ -1,76 +0,0 @@ -command = new LookupCommand($this->getConfig()); - $this->command->setSites($this->sites); - $this->command->setLogger($this->logger); - } - - /** - * Exercises site:lookup where the result is that the site exists and you have access to it - */ - public function testSiteLookupExists() - { - $site_name = 'my-site'; - - $this->sites->method('findUuidByName') - ->with($this->equalTo($site_name)) - ->willReturn(['name' => $site_name, 'id' => 'site_id',]); - - $out = $this->command->lookup($site_name); - $this->assertInstanceOf(AssociativeList::class, $out); - } - - /** - * Exercises site:lookup where the result is that the site exists but you do not have access to it - * - * @expectedException \Exception - * @expectedExceptionMessage You are not authorized for this site. - */ - public function testSiteLookupExistsButNotAuthorized() - { - $site_name = 'my-site'; - - $this->sites->method('findUuidByName') - ->with($this->equalTo($site_name)) - ->will($this->throwException(new \Exception('You are not authorized for this site.'))); - - $out = $this->command->lookup($site_name); - $this->assertInstanceOf(AssociativeList::class, $out); - } - - /** - * Exercises site:lookup where the result is that the site does not exist - * - * @expectedException \Exception - * @expectedExceptionMessage A site named my-site was not found. - */ - public function testSiteLooupDoesNotExist() - { - $site_name = 'my-site'; - - $this->sites->method('findUuidByName') - ->with($this->equalTo($site_name)) - ->will($this->throwException(new \Exception("A site named $site_name was not found."))); - - $out = $this->command->lookup($site_name); - $this->assertInstanceOf(AssociativeList::class, $out); - } -} diff --git a/tests/unit_tests/new/Commands/Site/Team/AddCommandTest.php b/tests/unit_tests/new/Commands/Site/Team/AddCommandTest.php deleted file mode 100644 index a7a1b6dbf..000000000 --- a/tests/unit_tests/new/Commands/Site/Team/AddCommandTest.php +++ /dev/null @@ -1,35 +0,0 @@ -command = new AddCommand($this->getConfig()); - $this->command->setLogger($this->logger); - $this->command->setSites($this->sites); - } - - /** - * Tests the site:team:add command. - */ - public function testAddCommand() - { - $new_member = 'test@example.com'; - $this->site->user_memberships->expects($this->once()) - ->method('create') - ->willReturn($this->workflow) - ->with($new_member, 'team_member'); - $this->command->add('mysite', $new_member); - } -} diff --git a/tests/unit_tests/new/Commands/Site/Team/ListCommandTest.php b/tests/unit_tests/new/Commands/Site/Team/ListCommandTest.php deleted file mode 100644 index e3fe8025c..000000000 --- a/tests/unit_tests/new/Commands/Site/Team/ListCommandTest.php +++ /dev/null @@ -1,52 +0,0 @@ -command = new ListCommand($this->getConfig()); - $this->command->setLogger($this->logger); - $this->command->setSites($this->sites); - } - - /** - * Tests the site:team:list command. - */ - public function testListCommand() - { - $user = new \stdClass(); - $user->id = 'abcdef'; - $user->profile = new \stdClass(); - $user->profile->firstname = 'Daisy'; - $user->profile->lastname = 'Duck'; - $user->email = 'daisy@duck.com'; - - $this->user_membership->expects($this->any()) - ->method('get') - ->will($this->onConsecutiveCalls($user, 'team_member', $user, 'team_member')); - - $this->site->user_memberships->expects($this->once()) - ->method('all') - ->willReturn([$this->user_membership, $this->user_membership]); - - $out = $this->command->teamList('mysite'); - foreach ($out as $u) { - $this->assertEquals($u['first'], $user->profile->firstname); - $this->assertEquals($u['last'], $user->profile->lastname); - $this->assertEquals($u['email'], $user->email); - $this->assertEquals($u['role'], 'team_member'); - $this->assertEquals($u['uuid'], $user->id); - } - } -} diff --git a/tests/unit_tests/new/Commands/Site/Team/RemoveCommandTest.php b/tests/unit_tests/new/Commands/Site/Team/RemoveCommandTest.php deleted file mode 100644 index b40779822..000000000 --- a/tests/unit_tests/new/Commands/Site/Team/RemoveCommandTest.php +++ /dev/null @@ -1,33 +0,0 @@ -command = new RemoveCommand($this->getConfig()); - $this->command->setLogger($this->logger); - $this->command->setSites($this->sites); - } - - /** - * Tests the site:team:remove command. - */ - public function testRemoveCommand() - { - $this->user_membership->expects($this->once()) - ->method('delete') - ->willReturn($this->workflow); - $this->command->remove('mysite', 'test@example.com'); - } -} diff --git a/tests/unit_tests/new/Commands/Site/Team/RoleCommandTest.php b/tests/unit_tests/new/Commands/Site/Team/RoleCommandTest.php deleted file mode 100644 index 6c05cdb1e..000000000 --- a/tests/unit_tests/new/Commands/Site/Team/RoleCommandTest.php +++ /dev/null @@ -1,38 +0,0 @@ -command = new RoleCommand($this->getConfig()); - $this->command->setLogger($this->logger); - $this->command->setSites($this->sites); - } - - /** - * Tests the site:team:role command. - */ - public function testRoleCommand() - { - $this->site->expects($this->once()) - ->method('getFeature') - ->with('change_management') - ->willReturn(true); - $this->user_membership->expects($this->once()) - ->method('setRole') - ->with('admin') - ->willReturn($this->workflow); - $this->command->role('mysite', 'test@example.com', 'admin'); - } -} diff --git a/tests/unit_tests/new/Commands/Site/Team/TeamCommandTest.php b/tests/unit_tests/new/Commands/Site/Team/TeamCommandTest.php deleted file mode 100644 index eb03e26b1..000000000 --- a/tests/unit_tests/new/Commands/Site/Team/TeamCommandTest.php +++ /dev/null @@ -1,38 +0,0 @@ -site->user_memberships = $this->getMockBuilder(SiteUserMemberships::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->user_membership = $this->getMockBuilder(SiteUserMembership::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->site->user_memberships->method('get') - ->willReturn($this->user_membership); - - $this->workflow = $this->getMockBuilder(Workflow::class) - ->disableOriginalConstructor() - ->getMock(); - } -} diff --git a/tests/unit_tests/new/Commands/Upstream/UpstreamCommandTest.php b/tests/unit_tests/new/Commands/Upstream/UpstreamCommandTest.php deleted file mode 100644 index 26e506ee3..000000000 --- a/tests/unit_tests/new/Commands/Upstream/UpstreamCommandTest.php +++ /dev/null @@ -1,33 +0,0 @@ -site->upstream = $this->getMockBuilder(Upstream::class) - ->disableOriginalConstructor() - ->getMock(); - } -} diff --git a/tests/unit_tests/new/Commands/Upstream/UpstreamUpdatesApplyCommandTest.php b/tests/unit_tests/new/Commands/Upstream/UpstreamUpdatesApplyCommandTest.php deleted file mode 100644 index 412aac7b6..000000000 --- a/tests/unit_tests/new/Commands/Upstream/UpstreamUpdatesApplyCommandTest.php +++ /dev/null @@ -1,125 +0,0 @@ -command = new UpdatesApplyCommand($this->getConfig()); - $this->command->setSites($this->sites); - $this->command->setLogger($this->logger); - } - - public function testApplyUpdatesNone() - { - $this->environment->id = 'dev'; - - $upstream = (object)[ - "remote_head" => "2f1c945d01cd03250e2b6668ad77bf24f54a5a56", - "ahead" => 1, - "update_log" => (object)[], - ]; - - $this->site->upstream->method('getUpdates') - ->willReturn($upstream); - - $this->logger->expects($this->once()) - ->method('log') - ->with( - $this->equalTo('warning'), - $this->equalTo('There are no available updates for this site.') - ); - - $this->environment->expects($this->never()) - ->method('applyUpstreamUpdates'); - - $this->command->applyUpstreamUpdates('123'); - } - - public function testApplyUpdates() - { - $this->environment->id = 'dev'; - - $upstream = (object)[ - "remote_head" => "2f1c945d01cd03250e2b6668ad77bf24f54a5a56", - "ahead" => 1, - "update_log" => (object)[ - "1bc423f65b3cc527b77d91da5c95eb240d9484f0" => (object)[ - "gravitar_url" => "http://pantheon-content.s3.amazonaws.com/blank_user.png", - "hash" => "1bc423f65b3cc527b77d91da5c95eb240d9484f0", - "author" => "Pantheon Automation", - "labels" => [], - "datetime" => "2016-06-16T04:21:14", - "parents" => [ - "45be60a4e82bc42b34bde2b6f02f4d2885a05eed" - ], - "message" => "Update to Drupal 7.44. For more information, see " . - "https://www.drupal.org/project/drupal/releases/7.44.", - "email" => "bot@getpantheon.com", - ], - "2f1c945d01cd03250e2b6668ad77bf24f54a5a56" => (object)[ - "gravitar_url" => "http://pantheon-content.s3.amazonaws.com/blank_user.png", - "hash" => "2f1c945d01cd03250e2b6668ad77bf24f54a5a56", - "author" => "Pantheon Automation", - "labels" => [], - "datetime" => "2016-07-07T20:24:52", - "parents" => [ - "45be60a4e82bc42b34bde2b6f02f4d2885a05eed" - ], - "message" => "Update to Drupal 7.50. For more information, see " . - "https://www.drupal.org/project/drupal/releases/7.50", - "email" => "bot@getpantheon.com", - ], - ], - ]; - $this->site->upstream->method('getUpdates') - ->willReturn($upstream); - - $workflow = $this->getMockBuilder(Workflow::class) - ->disableOriginalConstructor() - ->getMock(); - - $workflow->expects($this->any()) - ->method('checkProgress') - ->willReturn(true); - - $workflow->expects($this->any()) - ->method('getMessage') - ->willReturn('Applied upstream updates to "dev"'); - - $this->environment->expects($this->once()) - ->method('applyUpstreamUpdates') - ->with($this->equalTo(true), $this->equalTo(true)) - ->willReturn($workflow); - - $this->site->expects($this->once()) - ->method('get') - ->with('name') - ->willReturn('my-site'); - - $this->logger->expects($this->at(0)) - ->method('log') - ->with( - $this->equalTo('notice'), - $this->equalTo('Applying {count} upstream update(s) to the {env} environment of {site_id}...'), - $this->equalTo(['count' => 2, 'env' => 'dev', 'site_id' => 'my-site']) - ); - - $this->logger->expects($this->at(1)) - ->method('log') - ->with( - $this->equalTo('notice'), - $this->equalTo('Applied upstream updates to "dev"') - ); - - $this->command->applyUpstreamUpdates('my-site'); - } -} diff --git a/tests/unit_tests/new/Commands/Upstream/UpstreamUpdatesListCommandTest.php b/tests/unit_tests/new/Commands/Upstream/UpstreamUpdatesListCommandTest.php deleted file mode 100644 index 00c350d9e..000000000 --- a/tests/unit_tests/new/Commands/Upstream/UpstreamUpdatesListCommandTest.php +++ /dev/null @@ -1,104 +0,0 @@ -command = new UpdatesListCommand($this->getConfig()); - $this->command->setSites($this->sites); - $this->command->setLogger($this->logger); - } - - /** - * Test displaying updates when there are none. - */ - public function testListUpstreamsEmpty() - { - $upstream = (object)[ - "remote_head" => "2f1c945d01cd03250e2b6668ad77bf24f54a5a56", - "ahead" => 1, - "update_log" => (object)[], - ]; - $this->site->upstream->method('getUpdates') - ->willReturn($upstream); - - $this->logger->expects($this->once()) - ->method('log') - ->with( - $this->equalTo('warning'), - $this->equalTo('There are no available updates for this site.') - ); - - - $out = $this->command->listUpstreamUpdates('123'); - - $this->assertEquals([], $out->getArrayCopy()); - } - - /** - * Test displaying updates for a site. - */ - public function testListUpstreams() - { - $upstream = (object)[ - "remote_head" => "2f1c945d01cd03250e2b6668ad77bf24f54a5a56", - "ahead" => 1, - "update_log" => (object)[ - "1bc423f65b3cc527b77d91da5c95eb240d9484f0" => (object)[ - "gravitar_url" => "http://pantheon-content.s3.amazonaws.com/blank_user.png", - "hash" => "1bc423f65b3cc527b77d91da5c95eb240d9484f0", - "author" => "Pantheon Automation", - "labels" => [], - "datetime" => "2016-06-16T04:21:14", - "parents" => [ - "45be60a4e82bc42b34bde2b6f02f4d2885a05eed" - ], - "message" => "Update to Drupal 7.44. For more information, see " . - "https://www.drupal.org/project/drupal/releases/7.44.", - "email" => "bot@getpantheon.com", - ], - "2f1c945d01cd03250e2b6668ad77bf24f54a5a56" => (object)[ - "gravitar_url" => "http://pantheon-content.s3.amazonaws.com/blank_user.png", - "hash" => "2f1c945d01cd03250e2b6668ad77bf24f54a5a56", - "author" => "Pantheon Automation", - "labels" => [], - "datetime" => "2016-07-07T20:24:52", - "parents" => [ - "45be60a4e82bc42b34bde2b6f02f4d2885a05eed" - ], - "message" => "Update to Drupal 7.50. For more information, see " . - "https://www.drupal.org/project/drupal/releases/7.50", - "email" => "bot@getpantheon.com", - ], - ], - ]; - $this->site->upstream->method('getUpdates') - ->willReturn($upstream); - - - $out = $this->command->listUpstreamUpdates('123'); - $result = [ - [ - 'hash' => "1bc423f65b3cc527b77d91da5c95eb240d9484f0", - 'datetime' => "2016-06-16T04:21:14", - 'message' => "Update to Drupal 7.44. For more information, see " . - "https://www.drupal.org/project/drupal/releases/7.44.", - 'author' => "Pantheon Automation", - ], - [ - 'hash' => "2f1c945d01cd03250e2b6668ad77bf24f54a5a56", - 'datetime' => "2016-07-07T20:24:52", - 'message' => "Update to Drupal 7.50. For more information, see " . - "https://www.drupal.org/project/drupal/releases/7.50", - 'author' => "Pantheon Automation", - ], - ]; - $this->assertEquals($result, $out->getArrayCopy()); - } -} diff --git a/tests/unit_tests/new/Commands/Workflow/ListCommandTest.php b/tests/unit_tests/new/Commands/Workflow/ListCommandTest.php deleted file mode 100644 index 4b5664770..000000000 --- a/tests/unit_tests/new/Commands/Workflow/ListCommandTest.php +++ /dev/null @@ -1,46 +0,0 @@ -command = new ListCommand($this->getConfig()); - $this->command->setLogger($this->logger); - $this->command->setSites($this->sites); - } - - /** - * Tests the workflow:list command. - */ - public function testListCommand() - { - $this->site->workflows->expects($this->once()) - ->method('fetch') - ->willReturn(null); - - $this->site->workflows->expects($this->once()) - ->method('all') - ->willReturn([$this->workflow]); - - $this->workflow->expects($this->once()) - ->method('serialize') - ->willReturn(['id' => '12345', 'details' => 'test']); - - $out = $this->command->wfList('mysite'); - foreach ($out as $w) { - $this->assertEquals($w['id'], '12345'); - $this->assertEquals($w['details'], 'test'); - } - } -} diff --git a/tests/unit_tests/new/Commands/Workflow/WorkflowCommandTest.php b/tests/unit_tests/new/Commands/Workflow/WorkflowCommandTest.php deleted file mode 100644 index 3e056d081..000000000 --- a/tests/unit_tests/new/Commands/Workflow/WorkflowCommandTest.php +++ /dev/null @@ -1,30 +0,0 @@ -site->workflows = $this->getMockBuilder(Workflows::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->workflow = $this->getMockBuilder(Workflow::class) - ->disableOriginalConstructor() - ->getMock(); - } -} diff --git a/tests/unit_tests/new/ConfigTest.php b/tests/unit_tests/new/ConfigTest.php deleted file mode 100644 index 7f4b9bbb9..000000000 --- a/tests/unit_tests/new/ConfigTest.php +++ /dev/null @@ -1,45 +0,0 @@ -config = new Config(); - } - - /** - * Tests the get function - * - * @expectedException \Terminus\Exceptions\TerminusException - * @expectedExceptionMessage No configuration setting for DNE found. - */ - public function testGet() - { - $this->assertTrue((boolean)$this->config->get('test_mode')); - $this->config->get('DNE'); - } - - /** - * Tests the getHomeDir function - */ - public function testGetHomeDir() - { - $this->assertEquals(getenv('HOME'), $this->config->getHomeDir()); - } -} diff --git a/tests/unit_tests/new/RunnerTest.php b/tests/unit_tests/new/RunnerTest.php deleted file mode 100755 index 1f364026c..000000000 --- a/tests/unit_tests/new/RunnerTest.php +++ /dev/null @@ -1,86 +0,0 @@ -config = new Config(); - $this->application = new Terminus('Terminus', $this->config->get('version'), $this->config); - - // Configuring the dependency-injection container - $input = new ArgvInput($_SERVER['argv']); - $this->output = new NullOutput(); - $roboConfig = new \Robo\Config(); - $this->container = Robo::createDefaultContainer($input, $this->output, $this->application, $roboConfig); - - // Instantiating the Runner - $this->runner = new Runner($this->container); - } - - /** - * Tests the Terminus constructor - * - * @return void - */ - public function testConstructor() - { - $runner = new Runner($this->container); - $this->assertAttributeInstanceOf('Robo\Runner', 'runner', $runner); - } - - /** - * Tests the run function - * - * @return void - */ - public function testRun() - { - $input = new ArgvInput([null, '-V', '--quiet']); - $status_code = $this->runner->run($input, $this->output); - $this->assertEquals(0, $status_code); - - $input = new ArgvInput([null, 'DNE', '--quiet']); - $status_code = $this->runner->run($input, $this->output); - $this->assertEquals(1, $status_code); - } -} diff --git a/tests/unit_tests/new/Session/SessionTest.php b/tests/unit_tests/new/Session/SessionTest.php deleted file mode 100644 index b971bd39d..000000000 --- a/tests/unit_tests/new/Session/SessionTest.php +++ /dev/null @@ -1,91 +0,0 @@ -filecache = $this->getMockBuilder(FileCache::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->session = new Session($this->filecache); - } - - /** - * Test getting and setting data - */ - public function testSetGet() - { - //$this->assertEquals('baz', $this->session->get('foo')); - //$this->assertEquals(123, $this->session->get('abc')); - } - - - /** - * Test getting and setting data - */ - public function testSetData() - { - $data = [ - 'foo' => 'bar', - 'abc' => 123 - ]; - - $this->filecache->expects($this->once()) - ->method('putData') - ->with('session', $data); - - $this->session->setData($data); - - foreach ($data as $key => $val) { - $this->assertEquals($val, $this->session->get($key)); - } - } - - /** - * Test getting and setting data - */ - public function testGetUser() - { - $data = [ - 'foo' => 'bar', - 'abc' => 123 - ]; - - $this->filecache->expects($this->once()) - ->method('getData') - ->with('session') - ->willReturn(['user_id' => '123']); - - $this->session = new Session($this->filecache); - - // @TODO: Test mocking of new user (will require some sort of mockable factory rather than - // the direct use of new User() in Session) - $user = $this->session->getUser(); - $this->assertInstanceOf('Terminus\Models\User', $user); - } - - /** - * Test destroying the session - */ - public function testDestroy() - { - $this->filecache->expects($this->once()) - ->method('remove') - ->with('session'); - - $this->session->destroy(); - } -} diff --git a/tests/unit_tests/new/TerminusTest.php b/tests/unit_tests/new/TerminusTest.php deleted file mode 100755 index 40cd28a2d..000000000 --- a/tests/unit_tests/new/TerminusTest.php +++ /dev/null @@ -1,36 +0,0 @@ -name, $config->get('version'), $config); - $this->assertAttributeInstanceOf('Pantheon\Terminus\Config', 'config', $terminus); - $this->assertEquals($terminus->getName(), $this->name); - $this->assertEquals($terminus->getVersion(), $config->get('version')); - $this->assertArrayHasKey('yes', $terminus->getDefinition()->getOptions()); - $this->assertInstanceOf( - 'Symfony\Component\Console\Input\InputOption', - $terminus->getDefinition()->getOption('yes') - ); - } -}