Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
adding test coverage
Browse files Browse the repository at this point in the history
test coverage

Update test coverage settings

update

Update circleci configs

Update phpunit test settings

Update

test

test

update

update

update

update

update

update
  • Loading branch information
vincent-gao committed Jan 28, 2022
1 parent 5ba2d3e commit 274a9be
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,35 @@ jobs:
INSTALL_SUGGEST: 1
BEHAT_PROFILE: "--profile=suggest"

phpunit_tests:
<<: *job-build
steps:
- attach_workspace:
at: /workspace
- checkout
- run: if [ -f "./dev-tools.sh" ] && [ ! "$DEV_TOOLS" ]; then ./dev-tools.sh; fi
- setup_remote_docker:
docker_layer_caching: true
- run: .circleci/build.sh
- run:
name: Run phpunit tests and generate coverage
command: |
.circleci/phpunit_tests.sh
.circleci/phpunit_coverage.sh
- run:
name: Copy test results
command: |
.circleci/phpunit_results.sh
when: always
- store_artifacts:
path: /tmp/phpunit
- store_test_results:
path: /tmp/phpunit

workflows:
version: 2
main:
jobs:
- build
- build_suggest
- phpunit_tests
7 changes: 7 additions & 0 deletions .circleci/phpunit_coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
##
# Generate coverage report
#
set -e
echo "==> Generate coverage report"
ahoy cli "phpdbg -qrr vendor/bin/phpunit ./dpc-sdp --coverage-html /app/phpunit/coverage-report"
6 changes: 6 additions & 0 deletions .circleci/phpunit_results.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
##
# Moves phpunit results from inside container to outside.
#
set -e
docker cp $(docker-compose ps -q cli):/app/phpunit/ /tmp/
9 changes: 9 additions & 0 deletions .circleci/phpunit_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
##
# Run phpunit tests in CI.
#
set -e

ahoy cli "mkdir -p /app/phpunit"
echo "==> Run phpunit tests"
ahoy cli "vendor/bin/phpunit ./dpc-sdp --log-junit /app/phpunit/junit.xml"
1 change: 1 addition & 0 deletions dev-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@
#
# Uncomment and set the Dev-Tools's commit value and commit this change.
# export GH_COMMIT=COMMIT_SHA
export GH_COMMIT=aefc0a705ec75976acdc8da4e6b89a77047fa307

bash <(curl -L https://raw.githubusercontent.com/dpc-sdp/dev-tools/master/install?"$(date +%s)") "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
/**
* Tests the TideSitePreviewHelper.
*
* @coversDefaultClass \Drupal\tide_site_preview\TideSitePreviewHelper
* @group tide_site_preview
*/
class TideSitePreviewHelperTest extends EntityKernelTestBase {
Expand Down

0 comments on commit 274a9be

Please sign in to comment.