From b715babfbbce118b75f603546b4bc2231bf4d78d Mon Sep 17 00:00:00 2001 From: Janette Day Date: Tue, 8 Feb 2022 15:25:25 -0600 Subject: [PATCH] Cypress in cli (#313) --- assets/docker/docker-compose.common.yml | 2 +- composer.json | 3 +- composer.lock | 523 +++++++++--------------- src/Command/DkanCommands.php | 25 +- src/Command/FrontendCommands.php | 146 ++++--- src/Command/ProjectCommands.php | 95 +++++ src/Util/TestUserTrait.php | 37 ++ tests/dktl_test.sh | 1 + 8 files changed, 427 insertions(+), 405 deletions(-) create mode 100644 src/Command/ProjectCommands.php create mode 100644 src/Util/TestUserTrait.php diff --git a/assets/docker/docker-compose.common.yml b/assets/docker/docker-compose.common.yml index 5aa5dfe9..e0abe125 100755 --- a/assets/docker/docker-compose.common.yml +++ b/assets/docker/docker-compose.common.yml @@ -41,7 +41,7 @@ services: # Used for all console commands and tools. cli: hostname: cli - image: getdkan/dkan-cli:v0.4.0 + image: getdkan/dkan-cli:v0.4.2 env_file: - "${DKTL_DIRECTORY}/assets/docker/mysql.env" environment: diff --git a/composer.json b/composer.json index b27b67e4..c7f060b5 100644 --- a/composer.json +++ b/composer.json @@ -3,8 +3,7 @@ "require": { "consolidation/robo": "^3.0.0", "pear/archive_tar": "^1.4", - "aws/aws-sdk-php": "^3.67", - "drupal/coder": "^8.3" + "aws/aws-sdk-php": "^3.67" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 57e18658..c7a4abbf 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3a42540adbee9386c106cd0dc94ed3b3", + "content-hash": "fe253ea4beefd6b14efcc890d092a240", "packages": [ { "name": "aws/aws-crt-php", @@ -58,16 +58,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.208.5", + "version": "3.209.20", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "58fa9d8b522b0afa260299179ff950c783ff0ee1" + "reference": "77c9c3a6211cb7eae599d5ab8f96765c50c0fa72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/58fa9d8b522b0afa260299179ff950c783ff0ee1", - "reference": "58fa9d8b522b0afa260299179ff950c783ff0ee1", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/77c9c3a6211cb7eae599d5ab8f96765c50c0fa72", + "reference": "77c9c3a6211cb7eae599d5ab8f96765c50c0fa72", "shasum": "" }, "require": { @@ -111,12 +111,12 @@ } }, "autoload": { - "psr-4": { - "Aws\\": "src/" - }, "files": [ "src/functions.php" - ] + ], + "psr-4": { + "Aws\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -143,29 +143,29 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.208.5" + "source": "https://github.com/aws/aws-sdk-php/tree/3.209.20" }, - "time": "2021-12-13T20:17:56+00:00" + "time": "2022-02-08T19:16:05+00:00" }, { "name": "composer/semver", - "version": "3.2.6", + "version": "3.2.9", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "83e511e247de329283478496f7a1e114c9517506" + "reference": "a951f614bd64dcd26137bc9b7b2637ddcfc57649" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/83e511e247de329283478496f7a1e114c9517506", - "reference": "83e511e247de329283478496f7a1e114c9517506", + "url": "https://api.github.com/repos/composer/semver/zipball/a951f614bd64dcd26137bc9b7b2637ddcfc57649", + "reference": "a951f614bd64dcd26137bc9b7b2637ddcfc57649", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpstan/phpstan": "^0.12.54", + "phpstan/phpstan": "^1.4", "symfony/phpunit-bridge": "^4.2 || ^5" }, "type": "library", @@ -210,7 +210,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.2.6" + "source": "https://github.com/composer/semver/tree/3.2.9" }, "funding": [ { @@ -226,31 +226,32 @@ "type": "tidelift" } ], - "time": "2021-10-25T11:34:17+00:00" + "time": "2022-02-04T13:58:43+00:00" }, { "name": "consolidation/annotated-command", - "version": "4.4.0", + "version": "4.5.1", "source": { "type": "git", "url": "https://github.com/consolidation/annotated-command.git", - "reference": "308f6ac178566a1ce9aa90ed908dac90a2c1e707" + "reference": "701a7abe8505abe89520837be798e15a3953a367" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/annotated-command/zipball/308f6ac178566a1ce9aa90ed908dac90a2c1e707", - "reference": "308f6ac178566a1ce9aa90ed908dac90a2c1e707", + "url": "https://api.github.com/repos/consolidation/annotated-command/zipball/701a7abe8505abe89520837be798e15a3953a367", + "reference": "701a7abe8505abe89520837be798e15a3953a367", "shasum": "" }, "require": { "consolidation/output-formatters": "^4.1.1", "php": ">=7.1.3", "psr/log": "^1|^2", - "symfony/console": "^4.4.8|~5.1.0", - "symfony/event-dispatcher": "^4.4.8|^5", - "symfony/finder": "^4.4.8|^5" + "symfony/console": "^4.4.8|^5|^6", + "symfony/event-dispatcher": "^4.4.8|^5|^6", + "symfony/finder": "^4.4.8|^5|^6" }, "require-dev": { + "composer-runtime-api": "^2.0", "phpunit/phpunit": "^7.5.20 || ^8 || ^9", "squizlabs/php_codesniffer": "^3", "yoast/phpunit-polyfills": "^0.2.0" @@ -279,22 +280,22 @@ "description": "Initialize Symfony Console commands from annotated command class methods.", "support": { "issues": "https://github.com/consolidation/annotated-command/issues", - "source": "https://github.com/consolidation/annotated-command/tree/4.4.0" + "source": "https://github.com/consolidation/annotated-command/tree/4.5.1" }, - "time": "2021-09-30T01:08:15+00:00" + "time": "2021-12-30T04:00:37+00:00" }, { "name": "consolidation/config", - "version": "2.0.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/consolidation/config.git", - "reference": "9a2c2a7b2aea1b3525984a4378743a8b74c14e1c" + "reference": "ce6a96fe858df4cc4252e2f48503151dc20a1559" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/config/zipball/9a2c2a7b2aea1b3525984a4378743a8b74c14e1c", - "reference": "9a2c2a7b2aea1b3525984a4378743a8b74c14e1c", + "url": "https://api.github.com/repos/consolidation/config/zipball/ce6a96fe858df4cc4252e2f48503151dc20a1559", + "reference": "ce6a96fe858df4cc4252e2f48503151dc20a1559", "shasum": "" }, "require": { @@ -339,28 +340,28 @@ "description": "Provide configuration services for a commandline tool.", "support": { "issues": "https://github.com/consolidation/config/issues", - "source": "https://github.com/consolidation/config/tree/2.0.1" + "source": "https://github.com/consolidation/config/tree/2.0.2" }, - "time": "2020-12-06T00:03:30+00:00" + "time": "2021-12-30T03:53:15+00:00" }, { "name": "consolidation/log", - "version": "2.0.2", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/consolidation/log.git", - "reference": "82a2aaaa621a7b976e50a745a8d249d5085ee2b1" + "reference": "9efdd57031bf2fda033f6a256cd8b7902a4e6b92" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/log/zipball/82a2aaaa621a7b976e50a745a8d249d5085ee2b1", - "reference": "82a2aaaa621a7b976e50a745a8d249d5085ee2b1", + "url": "https://api.github.com/repos/consolidation/log/zipball/9efdd57031bf2fda033f6a256cd8b7902a4e6b92", + "reference": "9efdd57031bf2fda033f6a256cd8b7902a4e6b92", "shasum": "" }, "require": { "php": ">=7.1.3", "psr/log": "^1.0", - "symfony/console": "^4|^5" + "symfony/console": "^4 || ^5 || ^6" }, "require-dev": { "phpunit/phpunit": ">=7.5.20", @@ -391,36 +392,36 @@ "description": "Improved Psr-3 / Psr\\Log logger based on Symfony Console components.", "support": { "issues": "https://github.com/consolidation/log/issues", - "source": "https://github.com/consolidation/log/tree/2.0.2" + "source": "https://github.com/consolidation/log/tree/2.1.0" }, - "time": "2020-12-10T16:26:23+00:00" + "time": "2022-01-30T03:49:07+00:00" }, { "name": "consolidation/output-formatters", - "version": "4.1.2", + "version": "4.2.1", "source": { "type": "git", "url": "https://github.com/consolidation/output-formatters.git", - "reference": "5821e6ae076bf690058a4de6c94dce97398a69c9" + "reference": "4413d7c732afb5d7bdac565c41aa9c8c49c48888" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/output-formatters/zipball/5821e6ae076bf690058a4de6c94dce97398a69c9", - "reference": "5821e6ae076bf690058a4de6c94dce97398a69c9", + "url": "https://api.github.com/repos/consolidation/output-formatters/zipball/4413d7c732afb5d7bdac565c41aa9c8c49c48888", + "reference": "4413d7c732afb5d7bdac565c41aa9c8c49c48888", "shasum": "" }, "require": { "dflydev/dot-access-data": "^1.1.0", "php": ">=7.1.3", - "symfony/console": "^4|^5", - "symfony/finder": "^4|^5" + "symfony/console": "^4|^5|^6", + "symfony/finder": "^4|^5|^6" }, "require-dev": { "php-coveralls/php-coveralls": "^2.4.2", "phpunit/phpunit": ">=7", "squizlabs/php_codesniffer": "^3", - "symfony/var-dumper": "^4", - "symfony/yaml": "^4", + "symfony/var-dumper": "^4|^5|^6", + "symfony/yaml": "^4|^5|^6", "yoast/phpunit-polyfills": "^0.2.0" }, "suggest": { @@ -450,38 +451,38 @@ "description": "Format text by applying transformations provided by plug-in formatters.", "support": { "issues": "https://github.com/consolidation/output-formatters/issues", - "source": "https://github.com/consolidation/output-formatters/tree/4.1.2" + "source": "https://github.com/consolidation/output-formatters/tree/4.2.1" }, - "time": "2020-12-12T19:04:59+00:00" + "time": "2021-12-30T03:58:00+00:00" }, { "name": "consolidation/robo", - "version": "3.0.6", + "version": "3.0.7", "source": { "type": "git", - "url": "https://github.com/consolidation/Robo.git", - "reference": "36dce2965a67abe5cf91f2bc36d2582a64a11258" + "url": "https://github.com/consolidation/robo.git", + "reference": "57012db2a93c904ed0a7b9d8676c0325c0366bc8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/Robo/zipball/36dce2965a67abe5cf91f2bc36d2582a64a11258", - "reference": "36dce2965a67abe5cf91f2bc36d2582a64a11258", + "url": "https://api.github.com/repos/consolidation/robo/zipball/57012db2a93c904ed0a7b9d8676c0325c0366bc8", + "reference": "57012db2a93c904ed0a7b9d8676c0325c0366bc8", "shasum": "" }, "require": { "consolidation/annotated-command": "^4.3", - "consolidation/config": "^1.2.1|^2.0.1", - "consolidation/log": "^1.1.1|^2.0.2", + "consolidation/config": "^1.2.1 || ^2.0.1", + "consolidation/log": "^1.1.1 || ^2.0.2", "consolidation/output-formatters": "^4.1.2", "consolidation/self-update": "^2.0", "league/container": "^3.3.1", "php": ">=7.1.3", - "symfony/console": "^4.4.19 || ^5", - "symfony/event-dispatcher": "^4.4.19 || ^5", - "symfony/filesystem": "^4.4.9 || ^5", - "symfony/finder": "^4.4.9 || ^5", + "symfony/console": "^4.4.19 || ^5 || ^6", + "symfony/event-dispatcher": "^4.4.19 || ^5 || ^6", + "symfony/filesystem": "^4.4.9 || ^5 || ^6", + "symfony/finder": "^4.4.9 || ^5 || ^6", "symfony/process": "^4.4.9 || ^5", - "symfony/yaml": "^4.4 || ^5" + "symfony/yaml": "^4.4 || ^5 || ^6" }, "conflict": { "codegyre/robo": "*" @@ -490,7 +491,7 @@ "natxet/cssmin": "3.0.4", "patchwork/jsqueeze": "^2", "pear/archive_tar": "^1.4.4", - "phpunit/phpunit": "^7.5.20 | ^8", + "phpunit/phpunit": "^7.5.20 || ^8", "squizlabs/php_codesniffer": "^3.6", "yoast/phpunit-polyfills": "^0.2.0" }, @@ -548,30 +549,30 @@ ], "description": "Modern task runner", "support": { - "issues": "https://github.com/consolidation/Robo/issues", - "source": "https://github.com/consolidation/Robo/tree/3.0.6" + "issues": "https://github.com/consolidation/robo/issues", + "source": "https://github.com/consolidation/robo/tree/3.0.7" }, - "time": "2021-10-05T23:56:45+00:00" + "time": "2021-12-31T01:01:31+00:00" }, { "name": "consolidation/self-update", - "version": "2.0.2", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/consolidation/self-update.git", - "reference": "74289cf9b37d5cf84321ebea47deeea21678b940" + "reference": "48d3bfac6d37b10c8ddae6e366ea79db5594d918" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/self-update/zipball/74289cf9b37d5cf84321ebea47deeea21678b940", - "reference": "74289cf9b37d5cf84321ebea47deeea21678b940", + "url": "https://api.github.com/repos/consolidation/self-update/zipball/48d3bfac6d37b10c8ddae6e366ea79db5594d918", + "reference": "48d3bfac6d37b10c8ddae6e366ea79db5594d918", "shasum": "" }, "require": { "composer/semver": "^3.2", "php": ">=5.5.0", - "symfony/console": "^2.8|^3|^4|^5", - "symfony/filesystem": "^2.5|^3|^4|^5" + "symfony/console": "^2.8 || ^3 || ^4 || ^5 || ^6", + "symfony/filesystem": "^2.5 || ^3 || ^4 || ^5 || ^6" }, "bin": [ "scripts/release" @@ -604,9 +605,9 @@ "description": "Provides a self:update command for Symfony Console applications.", "support": { "issues": "https://github.com/consolidation/self-update/issues", - "source": "https://github.com/consolidation/self-update/tree/2.0.2" + "source": "https://github.com/consolidation/self-update/tree/2.0.4" }, - "time": "2021-12-17T16:45:58+00:00" + "time": "2022-02-08T16:22:44+00:00" }, { "name": "dflydev/dot-access-data", @@ -671,49 +672,6 @@ }, "time": "2017-01-20T21:14:22+00:00" }, - { - "name": "drupal/coder", - "version": "8.3.13", - "source": { - "type": "git", - "url": "https://git.drupalcode.org/project/coder.git", - "reference": "d3286d571b19633cc296d438c36b9aed195de43c" - }, - "require": { - "ext-mbstring": "*", - "php": ">=7.0.8", - "sirbrillig/phpcs-variable-analysis": "^2.10", - "squizlabs/php_codesniffer": "^3.5.6", - "symfony/yaml": ">=2.0.5" - }, - "require-dev": { - "phpstan/phpstan": "^0.12.63", - "phpunit/phpunit": "^6.0 || ^7.0" - }, - "type": "phpcodesniffer-standard", - "autoload": { - "psr-4": { - "Drupal\\": "coder_sniffer/Drupal/", - "DrupalPractice\\": "coder_sniffer/DrupalPractice/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0-or-later" - ], - "description": "Coder is a library to review Drupal code.", - "homepage": "https://www.drupal.org/project/coder", - "keywords": [ - "code review", - "phpcs", - "standards" - ], - "support": { - "issues": "https://www.drupal.org/project/issues/coder", - "source": "https://www.drupal.org/project/coder" - }, - "time": "2021-02-06T10:44:32+00:00" - }, { "name": "grasmash/expander", "version": "1.0.0", @@ -1818,138 +1776,31 @@ }, "time": "2019-03-08T08:55:37+00:00" }, - { - "name": "sirbrillig/phpcs-variable-analysis", - "version": "v2.11.2", - "source": { - "type": "git", - "url": "https://github.com/sirbrillig/phpcs-variable-analysis.git", - "reference": "3fad28475bfbdbf8aa5c440f8a8f89824983d85e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/3fad28475bfbdbf8aa5c440f8a8f89824983d85e", - "reference": "3fad28475bfbdbf8aa5c440f8a8f89824983d85e", - "shasum": "" - }, - "require": { - "php": ">=5.4.0", - "squizlabs/php_codesniffer": "^3.5" - }, - "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", - "limedeck/phpunit-detailed-printer": "^3.1 || ^4.0 || ^5.0", - "phpstan/phpstan": "^0.11.8", - "phpunit/phpunit": "^5.0 || ^6.5 || ^7.0 || ^8.0", - "sirbrillig/phpcs-import-detection": "^1.1" - }, - "type": "phpcodesniffer-standard", - "autoload": { - "psr-4": { - "VariableAnalysis\\": "VariableAnalysis/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-2-Clause" - ], - "authors": [ - { - "name": "Sam Graham", - "email": "php-codesniffer-variableanalysis@illusori.co.uk" - }, - { - "name": "Payton Swick", - "email": "payton@foolord.com" - } - ], - "description": "A PHPCS sniff to detect problems with variables.", - "support": { - "issues": "https://github.com/sirbrillig/phpcs-variable-analysis/issues", - "source": "https://github.com/sirbrillig/phpcs-variable-analysis", - "wiki": "https://github.com/sirbrillig/phpcs-variable-analysis/wiki" - }, - "time": "2021-07-06T23:45:17+00:00" - }, - { - "name": "squizlabs/php_codesniffer", - "version": "3.6.2", - "source": { - "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5e4e71592f69da17871dba6e80dd51bce74a351a", - "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a", - "shasum": "" - }, - "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" - }, - "bin": [ - "bin/phpcs", - "bin/phpcbf" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Greg Sherwood", - "role": "lead" - } - ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", - "keywords": [ - "phpcs", - "standards" - ], - "support": { - "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", - "source": "https://github.com/squizlabs/PHP_CodeSniffer", - "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" - }, - "time": "2021-12-12T21:44:58+00:00" - }, { "name": "symfony/console", - "version": "v5.1.11", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "d9a267b621c5082e0a6c659d73633b6fd28a8a08" + "reference": "a2a86ec353d825c75856c6fd14fac416a7bdb6b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/d9a267b621c5082e0a6c659d73633b6fd28a8a08", - "reference": "d9a267b621c5082e0a6c659d73633b6fd28a8a08", + "url": "https://api.github.com/repos/symfony/console/zipball/a2a86ec353d825c75856c6fd14fac416a7bdb6b8", + "reference": "a2a86ec353d825c75856c6fd14fac416a7bdb6b8", "shasum": "" }, "require": { "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", - "symfony/polyfill-php80": "^1.15", - "symfony/service-contracts": "^1.1|^2", - "symfony/string": "^5.1" + "symfony/polyfill-php73": "^1.9", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.1|^6.0" }, "conflict": { + "psr/log": ">=3", "symfony/dependency-injection": "<4.4", "symfony/dotenv": "<5.1", "symfony/event-dispatcher": "<4.4", @@ -1957,16 +1808,16 @@ "symfony/process": "<4.4" }, "provide": { - "psr/log-implementation": "1.0" + "psr/log-implementation": "1.0|2.0" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" + "psr/log": "^1|^2", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/lock": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" }, "suggest": { "psr/log": "For using the console logger", @@ -1999,8 +1850,14 @@ ], "description": "Eases the creation of beautiful and testable command line interfaces", "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command line", + "console", + "terminal" + ], "support": { - "source": "https://github.com/symfony/console/tree/v5.1.11" + "source": "https://github.com/symfony/console/tree/v5.4.3" }, "funding": [ { @@ -2016,7 +1873,7 @@ "type": "tidelift" } ], - "time": "2021-01-27T10:01:46+00:00" + "time": "2022-01-26T16:28:35+00:00" }, { "name": "symfony/deprecation-contracts", @@ -2087,16 +1944,16 @@ }, { "name": "symfony/event-dispatcher", - "version": "v5.4.0", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "27d39ae126352b9fa3be5e196ccf4617897be3eb" + "reference": "dec8a9f58d20df252b9cd89f1c6c1530f747685d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/27d39ae126352b9fa3be5e196ccf4617897be3eb", - "reference": "27d39ae126352b9fa3be5e196ccf4617897be3eb", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/dec8a9f58d20df252b9cd89f1c6c1530f747685d", + "reference": "dec8a9f58d20df252b9cd89f1c6c1530f747685d", "shasum": "" }, "require": { @@ -2152,7 +2009,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.0" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.3" }, "funding": [ { @@ -2168,7 +2025,7 @@ "type": "tidelift" } ], - "time": "2021-11-23T10:19:22+00:00" + "time": "2022-01-02T09:53:40+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -2251,16 +2108,16 @@ }, { "name": "symfony/filesystem", - "version": "v5.4.0", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "731f917dc31edcffec2c6a777f3698c33bea8f01" + "reference": "0f0c4bf1840420f4aef3f32044a9dbb24682731b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/731f917dc31edcffec2c6a777f3698c33bea8f01", - "reference": "731f917dc31edcffec2c6a777f3698c33bea8f01", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/0f0c4bf1840420f4aef3f32044a9dbb24682731b", + "reference": "0f0c4bf1840420f4aef3f32044a9dbb24682731b", "shasum": "" }, "require": { @@ -2295,7 +2152,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.4.0" + "source": "https://github.com/symfony/filesystem/tree/v5.4.3" }, "funding": [ { @@ -2311,20 +2168,20 @@ "type": "tidelift" } ], - "time": "2021-10-28T13:39:27+00:00" + "time": "2022-01-02T09:53:40+00:00" }, { "name": "symfony/finder", - "version": "v5.4.0", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "d2f29dac98e96a98be467627bd49c2efb1bc2590" + "reference": "231313534dded84c7ecaa79d14bc5da4ccb69b7d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/d2f29dac98e96a98be467627bd49c2efb1bc2590", - "reference": "d2f29dac98e96a98be467627bd49c2efb1bc2590", + "url": "https://api.github.com/repos/symfony/finder/zipball/231313534dded84c7ecaa79d14bc5da4ccb69b7d", + "reference": "231313534dded84c7ecaa79d14bc5da4ccb69b7d", "shasum": "" }, "require": { @@ -2358,7 +2215,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.4.0" + "source": "https://github.com/symfony/finder/tree/v5.4.3" }, "funding": [ { @@ -2374,25 +2231,28 @@ "type": "tidelift" } ], - "time": "2021-11-28T15:25:38+00:00" + "time": "2022-01-26T16:34:36+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.23.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" + "reference": "30885182c981ab175d4d034db0f6f469898070ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", + "reference": "30885182c981ab175d4d034db0f6f469898070ab", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-ctype": "*" + }, "suggest": { "ext-ctype": "For best performance" }, @@ -2437,7 +2297,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.24.0" }, "funding": [ { @@ -2453,20 +2313,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-10-20T20:35:02+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.23.1", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "16880ba9c5ebe3642d1995ab866db29270b36535" + "reference": "81b86b50cf841a64252b439e738e97f4a34e2783" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/16880ba9c5ebe3642d1995ab866db29270b36535", - "reference": "16880ba9c5ebe3642d1995ab866db29270b36535", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/81b86b50cf841a64252b439e738e97f4a34e2783", + "reference": "81b86b50cf841a64252b439e738e97f4a34e2783", "shasum": "" }, "require": { @@ -2486,12 +2346,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Grapheme\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2518,7 +2378,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.24.0" }, "funding": [ { @@ -2534,11 +2394,11 @@ "type": "tidelift" } ], - "time": "2021-05-27T12:26:48+00:00" + "time": "2021-11-23T21:10:46+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.23.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", @@ -2567,12 +2427,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -2602,7 +2462,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.24.0" }, "funding": [ { @@ -2622,21 +2482,24 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.23.1", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6" + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-mbstring": "*" + }, "suggest": { "ext-mbstring": "For best performance" }, @@ -2682,7 +2545,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.24.0" }, "funding": [ { @@ -2698,20 +2561,20 @@ "type": "tidelift" } ], - "time": "2021-05-27T12:26:48+00:00" + "time": "2021-11-30T18:21:41+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.23.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/cc5db0e22b3cb4111010e48785a97f670b350ca5", + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5", "shasum": "" }, "require": { @@ -2728,12 +2591,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -2761,7 +2624,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.24.0" }, "funding": [ { @@ -2777,20 +2640,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-06-05T21:20:04+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.23.1", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be" + "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/57b712b08eddb97c762a8caa32c84e037892d2e9", + "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9", "shasum": "" }, "require": { @@ -2807,12 +2670,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -2844,7 +2707,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.24.0" }, "funding": [ { @@ -2860,20 +2723,20 @@ "type": "tidelift" } ], - "time": "2021-07-28T13:41:28+00:00" + "time": "2021-09-13T13:58:33+00:00" }, { "name": "symfony/process", - "version": "v5.4.0", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "5be20b3830f726e019162b26223110c8f47cf274" + "reference": "553f50487389a977eb31cf6b37faae56da00f753" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/5be20b3830f726e019162b26223110c8f47cf274", - "reference": "5be20b3830f726e019162b26223110c8f47cf274", + "url": "https://api.github.com/repos/symfony/process/zipball/553f50487389a977eb31cf6b37faae56da00f753", + "reference": "553f50487389a977eb31cf6b37faae56da00f753", "shasum": "" }, "require": { @@ -2906,7 +2769,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.4.0" + "source": "https://github.com/symfony/process/tree/v5.4.3" }, "funding": [ { @@ -2922,7 +2785,7 @@ "type": "tidelift" } ], - "time": "2021-11-28T15:25:38+00:00" + "time": "2022-01-26T16:28:35+00:00" }, { "name": "symfony/service-contracts", @@ -3009,16 +2872,16 @@ }, { "name": "symfony/string", - "version": "v5.4.0", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "9ffaaba53c61ba75a3c7a3a779051d1e9ec4fd2d" + "reference": "92043b7d8383e48104e411bc9434b260dbeb5a10" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/9ffaaba53c61ba75a3c7a3a779051d1e9ec4fd2d", - "reference": "9ffaaba53c61ba75a3c7a3a779051d1e9ec4fd2d", + "url": "https://api.github.com/repos/symfony/string/zipball/92043b7d8383e48104e411bc9434b260dbeb5a10", + "reference": "92043b7d8383e48104e411bc9434b260dbeb5a10", "shasum": "" }, "require": { @@ -3075,7 +2938,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.0" + "source": "https://github.com/symfony/string/tree/v5.4.3" }, "funding": [ { @@ -3091,32 +2954,32 @@ "type": "tidelift" } ], - "time": "2021-11-24T10:02:00+00:00" + "time": "2022-01-02T09:53:40+00:00" }, { "name": "symfony/yaml", - "version": "v5.3.11", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "226638aa877bc4104e619a15f27d8141cd6b4e4a" + "reference": "e80f87d2c9495966768310fc531b487ce64237a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/226638aa877bc4104e619a15f27d8141cd6b4e4a", - "reference": "226638aa877bc4104e619a15f27d8141cd6b4e4a", + "url": "https://api.github.com/repos/symfony/yaml/zipball/e80f87d2c9495966768310fc531b487ce64237a2", + "reference": "e80f87d2c9495966768310fc531b487ce64237a2", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/polyfill-ctype": "~1.8" + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/console": "<4.4" + "symfony/console": "<5.3" }, "require-dev": { - "symfony/console": "^4.4|^5.0" + "symfony/console": "^5.3|^6.0" }, "suggest": { "symfony/console": "For validating YAML files using the lint command" @@ -3150,7 +3013,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v5.3.11" + "source": "https://github.com/symfony/yaml/tree/v5.4.3" }, "funding": [ { @@ -3166,7 +3029,7 @@ "type": "tidelift" } ], - "time": "2021-11-20T16:42:42+00:00" + "time": "2022-01-26T16:32:32+00:00" } ], "packages-dev": [], @@ -3180,5 +3043,5 @@ "platform-overrides": { "php": "7.4" }, - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.2.0" } diff --git a/src/Command/DkanCommands.php b/src/Command/DkanCommands.php index 50d4aeb6..942e3983 100644 --- a/src/Command/DkanCommands.php +++ b/src/Command/DkanCommands.php @@ -3,6 +3,7 @@ namespace DkanTools\Command; use DkanTools\Util\Util; +use DkanTools\Util\TestUserTrait; /** * This is project's console commands configuration for Robo task runner. @@ -12,6 +13,8 @@ */ class DkanCommands extends \Robo\Tasks { + use TestUserTrait; + /** * Build DKAN docs with doxygen. */ @@ -30,12 +33,8 @@ public function dkanDocs() */ public function dkanTestCypress(array $args) { - $this->dkanTestUser("testuser", "2jqzOAnXS9mmcLasy", "api_user"); - $this->dkanTestUser("testeditor", "testeditor", "administrator"); - - $this->taskExec("npm install cypress") - ->dir("docroot/modules/contrib/dkan") - ->run(); + $this->apiUser(); + $this->editorUser(); $cypress = $this->taskExec('CYPRESS_baseUrl="http://$DKTL_PROXY_DOMAIN" npx cypress run') ->dir("docroot/modules/contrib/dkan"); @@ -172,6 +171,11 @@ public function dkanDemo() ->exec("dktl make") ->exec("dktl install") ->exec("dktl install:sample") + ->exec("git clone -b " + . FrontendCommands::FRONTEND_VCS_REF + . " " + . FrontendCommands::FRONTEND_VCS_URL + . " " . FrontendCommands::FRONTEND_DIR) ->exec("dktl frontend:install") ->exec("dktl frontend:build") ->exec("dktl drush cr") @@ -208,13 +212,4 @@ public function dkanDev() $this->io()->success("Your dev site is available at: " . Util::getUri()); } - - private function dkanTestUser($name, $pass, $roll) - { - $this->taskExecStack() - ->stopOnFail() - ->exec("dktl drush user:create $name --password=$pass") - ->exec("dktl drush user-add-role $roll $name") - ->run(); - } } diff --git a/src/Command/FrontendCommands.php b/src/Command/FrontendCommands.php index d2aa0272..9b5bfb05 100644 --- a/src/Command/FrontendCommands.php +++ b/src/Command/FrontendCommands.php @@ -12,34 +12,35 @@ class FrontendCommands extends Tasks const FRONTEND_DIR = 'src/frontend'; const FRONTEND_VCS_URL = 'https://github.com/GetDKAN/data-catalog-app/'; - const FRONTEND_VCS_REF = 'master'; + const FRONTEND_VCS_REF = 'cypress-update-8.7.0'; const FRONTEND_THEME = 'getdkan/dkan_js_frontend_bartik'; + /** - * Download the DKAN frontend app to src/frontend. - * - * If no url or ref are provided, DKAN Tools will probe DKAN's composer.json - * file, looking for the following configuration: - * - * "extra": { - * "dkan-frontend": { - * "type": "vcs", - * "url": "https://github.com/GetDKAN/data-catalog-app", - * "ref": "1.0.0" - * } - * } - * - * If not found, the defaults set in self::FRONTEND_VCS_URL and - * self::FRONTEND_VCS_REF will be used. - * - * @option string type - * The type of frontend package. "vcs" currently the only type supported. - * @option string url - * URL for the frontend package. Currently only github URLs supported. - * @option string ref - * Reference (tag, branch or commit) from the vcs system to use. - * - */ + * Download the DKAN frontend app to src/frontend. + * + * If no url or ref are provided, DKAN Tools will probe DKAN's composer.json + * file, looking for the following configuration: + * + * "extra": { + * "dkan-frontend": { + * "type": "vcs", + * "url": "https://github.com/GetDKAN/data-catalog-app", + * "ref": "1.0.0" + * } + * } + * + * If not found, the defaults set in self::FRONTEND_VCS_URL and + * self::FRONTEND_VCS_REF will be used. + * + * @option string type + * The type of frontend package. "vcs" currently the only type supported. + * @option string url + * URL for the frontend package. Currently only github URLs supported. + * @option string ref + * Reference (tag, branch or commit) from the vcs system to use. + * + */ public function frontendGet($opts = ['type' => 'vcs', 'url' => null, 'ref' => null]) { if (file_exists(self::FRONTEND_DIR)) { @@ -79,7 +80,7 @@ private function frontendGetPopulateDefaults(&$opts) if ($opts['url'] && $opts['ref']) { return; } - $defaults = ['url' => self::FRONTEND_VCS_URL, 'ref' => self::FRONTEND_VCS_REF ]; + $defaults = ['url' => self::FRONTEND_VCS_URL, 'ref' => self::FRONTEND_VCS_REF]; $note = "Frontend config not found in DKAN composer.json. Reverting to " . "defaults from DKAN Tools"; @@ -130,13 +131,13 @@ private function getVcsArchiveUrl($url, $ref) } /** - * Create symlink for src/frontend. - */ + * Create symlink for src/frontend. + */ private function frontendLink() { $result = $this->taskExec('ln -s ../src/frontend frontend') - ->dir("docroot") - ->run(); + ->dir("docroot") + ->run(); if ($result && $result->getExitCode() === 0) { $this->io()->success( 'Successfully symlinked /src/frontend to docroot/frontend' @@ -145,18 +146,18 @@ private function frontendLink() } /** - * Download frontend app if not present, and run npm install. - * - * The URL and branch/tag for the frontend app should be specified in the - * "extra" section of DKAN's composer.json. If you want to specify a - * different tag or branch, or different repo entirely, run "dktl - * frontend:get" first and specify the --ref and/or --url options. - * - * @param array $opts - * Options array. - * @option theme - * Whether or not to install default front-end theme. Defaults to true. - */ + * Download frontend app if not present, and run npm install. + * + * The URL and branch/tag for the frontend app should be specified in the + * "extra" section of DKAN's composer.json. If you want to specify a + * different tag or branch, or different repo entirely, run "dktl + * frontend:get" first and specify the --ref and/or --url options. + * + * @param array $opts + * Options array. + * @option theme + * Whether or not to install default front-end theme. Defaults to true. + */ public function frontendInstall($opts = ['theme' => true]) { if (!file_exists(self::FRONTEND_DIR)) { @@ -165,6 +166,35 @@ public function frontendInstall($opts = ['theme' => true]) if (!file_exists("docroot/frontend")) { $this->frontendLink(); } + $this->cypressLink(); + $this->npmInstall(); + $this->moduleInstall(); + + if ($opts['theme']) { + $this->installTheme(); + } + + $this->taskExec("drush config-set system.site page.front \"/home\" -y")->run(); + $this->io()->success('Set front page.'); + } + + /** + * Install DKAN frontend Drupal module. + */ + private function moduleInstall() + { + $result = $this->taskExec("drush en -y dkan_js_frontend")->dir("docroot")->run(); + if ($result->getExitCode() != 0) { + $this->io()->error('Could not install front-end node module'); + return $result; + } + } + + /** + * Install frontend npm dependencies. + */ + private function npmInstall() + { $result = $this->taskExec("npm install") ->dir("src/frontend") ->run(); @@ -173,18 +203,24 @@ public function frontendInstall($opts = ['theme' => true]) return $result; } $this->io()->success('Front-end dependencies installed.'); - $result = $this->taskExec("drush en -y dkan_js_frontend")->dir("docroot")->run(); - if ($result->getExitCode() != 0) { - $this->io()->error('Could not install front-end node module'); + } + + /** + * Symlink in global cypress installation. + */ + private function cypressLink() + { + $result = $this->taskExec("npm link ../../../../usr/local/bin/node_modules/cypress") + ->dir("src/frontend") + ->run(); + if ($result && $result->getExitCode() === 0) { + $this->io()->success( + 'Successfully symlinked global cypress into frontend folder.' + ); + } else { + $this->io()->error('Could not symlink package folder'); return $result; } - - if ($opts['theme']) { - $this->installTheme(); - } - - $this->taskExec("drush config-set system.site page.front \"/home\" -y")->run(); - $this->io()->success('Set front page.'); } /** @@ -225,7 +261,7 @@ public function frontendBuild() { // Override GATSBY_API_URL with our own proxied domain. $task = $this - ->taskExec('npm run build') + ->taskExec('npm run build --force') ->dir("src/frontend"); $result = $task->run(); if ($result->getExitCode() != 0) { @@ -245,10 +281,6 @@ private function frontendModulePresent() */ public function frontendTest() { - $this->taskExec("npm install cypress") - ->dir("docroot/frontend") - ->run(); - return $this->taskExec('CYPRESS_baseUrl="http://$DKTL_PROXY_DOMAIN" npx cypress run') ->dir("docroot/frontend") ->run(); diff --git a/src/Command/ProjectCommands.php b/src/Command/ProjectCommands.php new file mode 100644 index 00000000..8ff392fa --- /dev/null +++ b/src/Command/ProjectCommands.php @@ -0,0 +1,95 @@ +apiUser(); + $this->editorUser(); + + $result = $this->taskExec("npm link ../../../../usr/local/bin/node_modules/cypress") + ->dir("src/tests") + ->run(); + if ($result->getExitCode() != 0) { + $this->io()->error('Could not symlink package folder'); + return $result; + } + + $task = $this + ->taskExec('npm install --force') + ->dir("src/tests"); + $result = $task->run(); + if ($result->getExitCode() != 0) { + $this->io()->error('Could not insall test dependencies.'); + return $result; + } + $this->io()->success('Installation of test dependencies successful.'); + + $cypress = $this->taskExec('CYPRESS_baseUrl="http://$DKTL_PROXY_DOMAIN" npx cypress run') + ->dir("src/tests"); + + foreach ($args as $arg) { + $cypress->arg($arg); + } + + return $cypress->run(); + } + + /** + * Run Site PhpUnit Tests. Additional phpunit CLI options can be passed. + * + * @see https://phpunit.de/manual/6.5/en/textui.html#textui.clioptions + * @param array $args Arguments to append to phpunit command. + */ + public function projectTestPhpunit(array $args) + { + $proj_dir = Util::getProjectDirectory(); + $phpunit_executable = $this->getPhpUnitExecutable(); + + $phpunitExec = $this->taskExec($phpunit_executable) + ->option('testsuite', 'Custom Test Suite') + ->dir("{$proj_dir}/docroot/modules/custom"); + + foreach ($args as $arg) { + $phpunitExec->arg($arg); + } + + return $phpunitExec->run(); + } + + private function getPhpUnitExecutable() + { + $proj_dir = Util::getProjectDirectory(); + + $phpunit_executable = $phpunit_executable = "{$proj_dir}/vendor/bin/phpunit"; + + if (!file_exists($phpunit_executable)) { + $this->taskExec("dktl installphpunit")->run(); + $phpunit_executable = "phpunit"; + } + + return $phpunit_executable; + } + + private function inGitDetachedState($dkanDirPath) + { + $output = []; + exec("cd {$dkanDirPath} && git rev-parse --abbrev-ref HEAD", $output); + return (isset($output[0]) && $output[0] == 'HEAD'); + } +} diff --git a/src/Util/TestUserTrait.php b/src/Util/TestUserTrait.php new file mode 100644 index 00000000..54b65882 --- /dev/null +++ b/src/Util/TestUserTrait.php @@ -0,0 +1,37 @@ +taskExecStack() + ->stopOnFail() + ->exec("dktl drush user:create $name --password=$pass") + ->exec("dktl drush user-add-role $roll $name") + ->run(); + } + + /** + * Protected create api user. + */ + protected function apiUser() + { + $this->create("testuser", "2jqzOAnXS9mmcLasy", "api_user"); + } + + /** + * Protected create editor. + */ + protected function editorUser() + { + $this->create("testeditor", "testeditor", "administrator"); + } +} diff --git a/tests/dktl_test.sh b/tests/dktl_test.sh index 2fedf741..e0ee0175 100755 --- a/tests/dktl_test.sh +++ b/tests/dktl_test.sh @@ -78,6 +78,7 @@ testDktlInstall() { testFrontEnd() { result=`dktl frontend:install` assertContains "${result}" "Successfully symlinked /src/frontend to docroot/frontend" + assertContains "${result}" "Successfully symlinked global cypress into frontend folder" assertContains "${result}" "Front-end dependencies installed." assertContains "${result}" "Successfully installed and enabled front-end theme"