Skip to content

Commit

Permalink
Switch to phpunit (part 1)
Browse files Browse the repository at this point in the history
  • Loading branch information
trasher authored Jul 3, 2024
1 parent b21408a commit 86a0655
Show file tree
Hide file tree
Showing 53 changed files with 6,509 additions and 3,929 deletions.
18 changes: 18 additions & 0 deletions .github/actions/test_tests-phpunit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
set -e -u -x -o pipefail

PHPUNIT_ADDITIONNAL_OPTIONS=""
if [[ "$CODE_COVERAGE" = true ]]; then
export COVERAGE_DIR="coverage-functional"
PHPUNIT_ADDITIONNAL_OPTIONS="--coverage-filter src --coverage-clover phpunit/$COVERAGE_DIR/clover.xml"

else
PHPUNIT_ADDITIONNAL_OPTIONS="--no-coverage";
fi

#temporary hack to prevent dual configuration
ln -s ../tests/config/ phpunit/

vendor/bin/phpunit $PHPUNIT_ADDITIONNAL_OPTIONS

unset COVERAGE_DIR
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ jobs:
run: |
.github/actions/init_initialize-9.5-db.sh
docker compose exec -T app .github/actions/test_update-from-9.5.sh
- name: "PHPUnit tests"
if: env.skip != 'true'
run: |
docker compose exec -T app .github/actions/test_tests-phpunit.sh
- name: "Functional tests"
if: "${{ env.skip != 'true' && (success() || failure()) }}"
run: |
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ jobs:
- name: "Install database"
run: |
docker compose exec -T app .github/actions/test_install.sh
- name: "PHPUnit tests"
run: |
docker compose exec -T app .github/actions/test_tests-phpunit.sh
- name: "Functional tests"
run: |
docker compose exec -T app .github/actions/test_tests-functional.sh
Expand All @@ -77,5 +80,5 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ./tests/coverage-functional/clover.xml,./tests/coverage-ldap/clover.xml,./tests/coverage-imap/clover.xml
files: ./phpunit/coverage-functional/clover.xml,./tests/coverage-functional/clover.xml,./tests/coverage-ldap/clover.xml,./tests/coverage-imap/clover.xml
override_branch: ${{ inputs.branch }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@ phpunit.xml
/inc/downstream.php
/docker-compose.override.yaml
/.devcontainer/docker-compose.override.yaml
/.phpunit.result.cache
/phpunit/files/
/phpunit/config
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "^1.11",
"phpstan/phpstan-deprecation-rules": "^1.2",
"phpunit/phpunit": "^9.6",
"squizlabs/php_codesniffer": "^3.10",
"symfony/browser-kit": "^5.4",
"symfony/http-client": "^5.4",
Expand Down
Loading

0 comments on commit 86a0655

Please sign in to comment.