Skip to content

44 - Add automated tests #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
22 changes: 22 additions & 0 deletions .lando.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,25 @@ services:
- appserver
appserver:
type: php
overrides:
environment:
SIMPLETEST_BASE_URL: "http://api.lndo.site"
SYMFONY_DEPRECATIONS_HELPER: 'disabled' # Temporary workaround to use deprecated methods.
SIMPLETEST_DB: 'mysql://database:database@database/database'
MINK_DRIVER_ARGS_WEBDRIVER: '["chrome", {"browserName":"chrome","chromeOptions":{"args":["--disable-gpu","--headless"]}}, "http://chrome:9515"]'
BROWSERTEST_OUTPUT_DIRECTORY: '/app/sites/simpletest/browser_output'
DRUSH_OPTIONS_ROOT: '/app'
DRUSH_OPTIONS_URI: 'https://api.lndo.site'
database:
creds:
user: database
password: database
database: database
chrome:
type: compose
services:
image: drupalci/webdriver-chromedriver:production
command: chromedriver --log-path=/tmp/chromedriver.log --verbose --whitelisted-ips=
source_database:
type: mysql
tooling:
Expand All @@ -24,3 +43,6 @@ tooling:
service: appserver
description: clear the Drupal cache
cmd: /app/scripts/lando/cr.sh
test:
service: appserver
cmd: "php /app/vendor/bin/phpunit -c /app/phpunit.xml"
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,17 @@ https://api.writecrow.org/texts/id?id=10533&_format=json
"search_api_excerpt":"\u2026 or colleagues have to be convincing , more specific and \u003Cstrong\u003Eprofessional\u003C\/strong\u003E. In most cases, Marketing plans are written for \u2026 by attracting their attention as well as explain some \u003Cstrong\u003Eprofessional\u003C\/strong\u003E concepts specifically. Last but not least, by \u2026 majors because they have to be focus on explaining \u003Cstrong\u003Eprofessional\u003C\/strong\u003E concepts and definition in their fields instead \u2026"
}]}
```

## Testing
Test integration for PHPUnit using Lando, the Docker-based environment tool, is modeled on https://agile.coop/blog/drupal-phpunit-tests-lando/

Usage:
```
lando test profiles/corpus/tests/src/Functional/BaseLoad.php
```

Notes:
- the `phpunit.xml` file in the project root controls PHP Unit settings,
- some of those values are provided as overrides in the `.lando.yml` file
- The database credentials are explicitly set in `.lando.yml` in part to override the `drupal8` recipe
- The tests are located in the `corpus` profile, and presume the installation of that profile based on the configuration found in the `config/install` directory.
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,10 @@
}
}
}
},
"require-dev": {
"drupal/core-dev": "^9.3",
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9.5"
}
}
Loading