Skip to content

Commit

Permalink
Add test scaffolding for Code Studio. (#50)
Browse files Browse the repository at this point in the history
* Add test scaffolding for Code Studio.

* More stan.

* Fix.

* Composer normalize.

* Rename things.

* Clean up.

* Tweak deploy.

* Update README.md

* Scan tests with PHPStan.

* Update composer files.

* Normalize.

* Add drush.

Co-authored-by: Dane Powell <[email protected]>
  • Loading branch information
grasmash and danepowell committed Dec 15, 2021
1 parent 94e15fc commit d8368e0
Show file tree
Hide file tree
Showing 9 changed files with 1,650 additions and 569 deletions.
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,10 @@ npm-debug.log
drush/sites/.checksums

# Deprecation detector rules
.rules
.rules

# PHPCS
.phpcs-cache

# PHPUnit
.phpunit.result.cache
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,24 @@ composer remove acquia/mysql56

## Next steps

After creating your project, consider doing the following:
After creating your project, if you'd also like to use Acquia BLT, do the following:
* Add BLT via Composer with `composer require acquia/blt`
* Install the [BLT Launcher](https://github.com/acquia/blt-launcher) and follow the rest of the [BLT setup guide](https://docs.acquia.com/blt/install/next-steps/).
* Set up automated testing using BLT recipes and plugins such as [BLT Behat](https://github.com/acquia/blt-behat) and the [Acquia Drupal Spec Tool](https://github.com/acquia/drupal-spec-tool).
* Update composer.json's scripts array to utilize BLT commands. E.g.,
```json
{"scripts": {
"app-validate-all": [
"blt validate --no-interaction --ansi --verbose"
],
"app-test-all": [
"blt tests --no-interaction --ansi --verbose"
],
"app-deploy": [
"blt artifact:deploy --commit-msg \"Automated commit by Code Studio for Pipeline ${CI_PIPELINE_ID}\" --branch \"${CI_COMMIT_BRANCH}-codestudio-build\" --ignore-dirty --no-interaction --verbose"
]
}}
```

# License

Expand Down
43 changes: 43 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,16 @@
"drupal/core-composer-scaffold": "^9",
"drupal/core-recommended": "^9",
"drupal/mysql56": "^1.0",
"drupal/upgrade_status": "^3.13",
"drush/drush": "^10.6",
"oomphinc/composer-installers-extender": "^1.1 || ^2"
},
"require-dev": {
"acquia/coding-standards": "^0.8.0",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.6"
},
"config": {
"platform": {
"php": "7.4"
Expand Down Expand Up @@ -122,6 +129,42 @@
"acms:install": [
"bash ./docroot/profiles/contrib/acquia_cms/install-acms"
],
"app-deploy": [
"echo \u001b\"[33mRunning composer app-deploy script. Edit composer.json scripts.app-deploy to modify test commands.\u001b[0m\"",
"echo \u001b\"[33mBy default, Acquia Code Studio will use use this during CI/CD jobs.\u001b[0m\"",
"acli push:artifact --no-interaction -vvv"
],
"app-fix-phpcbf": [
"phpcbf"
],
"app-test-all": [
"echo \u001b\"[33mRunning composer app-test-all script. Edit composer.json scripts.app-test-all to modify test commands.\u001b[0m\"",
"echo \u001b\"[33mBy default, Acquia Code Studio will use use this during CI/CD jobs.\u001b[0m\"",
"@app-test-unit"
],
"app-test-unit": [
"echo \u001b\"[33mRunning PHP Unit. Create or edit phpunit.xml.dist to change configuration.\u001b[0m\"",
"phpunit -vvv"
],
"app-validate-all": [
"echo \u001b\"[33mRunning composer app-validate-all script. Edit composer.json scripts.app-validate-all to modify validate commands.\u001b[0m\"",
"echo \u001b\"[33mBy default, Acquia Code Studio will use use this during CI/CD jobs.\u001b[0m\"",
"@app-validate-php-lint",
"@app-validate-phpcs",
"@app-validate-phpstan"
],
"app-validate-php-lint": [
"find src -name '*.php' -print0 | xargs -0 -n1 php -l",
"find tests -name '*.php' -print0 | xargs -0 -n1 php -l"
],
"app-validate-phpcs": [
"echo \u001b\"[33m Running PHP Code Sniffer. Create or edit phpcs.xml.dist to change configuration.\u001b[0m\"",
"phpcs"
],
"app-validate-phpstan": [
"echo \u001b\"[33mRunning PHP Stan. Create or edit phpstan.neon.dist to change configuration.\u001b[0m\"",
"phpstan analyze"
],
"nuke": [
"rm -rf docroot vendor composer.lock"
]
Expand Down
Loading

0 comments on commit d8368e0

Please sign in to comment.