Skip to content

Commit

Permalink
Merge pull request #177 from UN-OCHA/develop
Browse files Browse the repository at this point in the history
Update main
  • Loading branch information
orakili committed Nov 9, 2021
2 parents 4c8f492 + 17978a4 commit f915323
Show file tree
Hide file tree
Showing 363 changed files with 14,285 additions and 2,773 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,15 @@ buildlog.txt

###> squizlabs/php_codesniffer ###
/.phpcs-cache
/phpcs.xml
/coverage
/tests/coverage/
###< squizlabs/php_codesniffer ###

###> phpunit/phpunit ###
/phpunit.xml
.phpunit.result.cache
###< phpunit/phpunit ###

###> symfony/phpunit-bridge ###
.phpunit
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###
26 changes: 24 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,39 @@ script:
- docker exec -it -u appuser -w /srv/www rwint9-test-site ./vendor/bin/phpcs --config-set installed_paths vendor/drupal/coder/coder_sniffer

# Check coding standards.
- docker exec -it -u appuser -w /srv/www rwint9-test-site ./vendor/bin/phpcs -p --report=full --standard=tests/phpcs.xml ./html/modules/custom ./html/themes/custom
- docker exec -it -u appuser -w /srv/www rwint9-test-site ./vendor/bin/phpcs -p --report=full ./html/modules/custom ./html/themes/custom

# Run unit tests.
- docker exec -it -u root -w /srv/www rwint9-test-site mkdir -p /srv/www/html/sites/default/files/browser_output
- docker exec -it -u root -w /srv/www -e BROWSERTEST_OUTPUT_DIRECTORY=/srv/www/html/sites/default/files/browser_output rwint9-test-site ./vendor/bin/phpunit --testsuite Unit --debug

# Install the site with the existing config.
- docker exec -it rwint9-test-site drush -y si --existing-config
- docker exec -it rwint9-test-site drush -y en dblog

# Ensure the file directories are writable.
- docker exec -it rwint9-test-site chmod -R 777 /srv/www/html/sites/default/files /srv/www/html/sites/default/private

# Create the build logs directory and make sure it's writable.
- docker exec -it -u root rwint9-test-site mkdir -p /srv/www/html/build/logs
- docker exec -it -u root rwint9-test-site chmod -R 777 /srv/www/html/build/logs

# Run all tests and generate coverage report.
- docker exec -it -u root -w /srv/www -e XDEBUG_MODE=coverage -e BROWSERTEST_OUTPUT_DIRECTORY=/srv/www/html/sites/default/files/browser_output -e DTT_BASE_URL=http://127.0.0.1 rwint9-test-site ./vendor/bin/phpunit --coverage-clover /srv/www/html/build/logs/clover.xml --debug

after_success:
- echo "The tests completed without errors."
# Create directory for clover.
- mkdir -p ./build/logs
- chmod -R 777 ./build/logs
- docker cp rwint9-test-site:/srv/www/html/build/logs/clover.xml ./build/logs/
# Fix source files path.
- sed -i 's#/srv/www#.#g' build/logs/clover.xml
# Get coveralls and execute.
- wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.4.3/php-coveralls.phar
- chmod +x php-coveralls.phar
- ./php-coveralls.phar -vv

after_failure:
- echo "The tests failed. Please check the output above for problems."
- ../vendor/bin/drush watchdog:show --extended
- docker exec -it rwint9-test-site drush watchdog:show --count=50 --extended
32 changes: 30 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
ReliefWeb - Drupal 9 version
============================
# ReliefWeb - Drupal 9 version

This is the drupal 9 codebase for the [ReliefWeb](https://reliefweb.int) site.

Expand All @@ -23,3 +22,32 @@ if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) {
include $app_root . '/' . $site_path . '/settings.local.php';
}
```

## Local development

For local development, add this line to settings.local.php:
`$config['config_split.config_split.config_dev']['status'] = TRUE;`
After importing a fresh database, run `drush cim` to enable devel, database log
and stage_file_proxy.

## Testing [![Coverage Status](https://coveralls.io/repos/github/UN-OCHA/rwint9-site/badge.svg)](https://coveralls.io/github/UN-OCHA/rwint9-site)

```bash
# with coverage
XDEBUG_MODE=coverage ./vendor/bin/phpunit --testsuite Unit
XDEBUG_MODE=coverage ./vendor/bin/phpunit --testsuite Existing

# without coverage
./vendor/bin/phpunit --testsuite Unit
./vendor/bin/phpunit --testsuite Existing
```

or run all test in custom

```bash
# with coverage
XDEBUG_MODE=coverage vendor/bin/phpunit

# without coverage
vendor/bin/phpunit
```
14 changes: 11 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@
"php": ">=8.0",
"composer/installers": "^1.10",
"cweagans/composer-patches": "^1.7",
"d4h/finediff": "^1.0",
"drupal-composer/preserve-paths": "^0.1.6",
"drupal/admin_denied": "^1.1",
"drupal/allowed_formats": "^1.3",
"drupal/components": "^2.2",
"drupal/config_split": "^1.7",
"drupal/config_split": "^2.0.0-beta4",
"drupal/core-composer-scaffold": "^9.2.4",
"drupal/core-dev": "^9.2.4",
"drupal/core-recommended": "^9.2.4",
Expand All @@ -79,6 +80,7 @@
"drupal/user_display_name": "^1.0",
"drush/drush": "^10.4",
"league/commonmark": "^1.6",
"league/html-to-markdown": "^5.0",
"pelago/emogrifier": "^5.0",
"reliefweb/simple-autocomplete": "v1.3.0",
"reliefweb/simple-datepicker": "^v1.3.1",
Expand All @@ -89,13 +91,19 @@
},
"require-dev": {
"drupal/coder": "^8.3.12",
"drupal/config_filter": "^2.2",
"drupal/console": "^1.9.7",
"drupal/devel": "^4.1.1",
"drupal/devel": "^4.1",
"drupal/devel_php": "^1.3",
"drupal/stage_file_proxy": "^1.1",
"kint-php/kint": "^3.3",
"mikey179/vfsstream": "^1.6.8",
"phpcompatibility/php-compatibility": "^9.3.5",
"phpmd/phpmd": "^2.9.1",
"phpunit/phpunit": "^9.5.4"
"phpspec/prophecy-phpunit": "^2",
"phpunit/php-code-coverage": "^9.2",
"phpunit/phpunit": "^9.5.4",
"weitzman/drupal-test-traits": "^1.5"
},
"conflict": {
"drupal/drupal": "*",
Expand Down
Loading

0 comments on commit f915323

Please sign in to comment.