Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,21 @@
- name: Setup tmate session
if: ${{ github.event.inputs.tmate_enabled == 1 }}
uses: mxschmitt/action-tmate@v3

tests:
name: Unit tests
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [8.2, 8.3, 8.4]
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup PHP
uses: shivammathur/setup-php@v2

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'Pull Request' step
Uses Step
uses 'shivammathur/setup-php' with ref 'v2', not a pinned commit hash
with:
php-version: ${{ matrix.php-version }}
- name: Composer install
run: composer install
- name: Run tests
run: vendor/bin/phpunit -c phpunit.xml
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
},
"require-dev": {
"drupal/coder": "^8.3",
"squizlabs/php_codesniffer": "^3.4"
"squizlabs/php_codesniffer": "^3.4",
"phpunit/phpunit": "^12.4"
},
"scripts": {
"codesniff": [
Expand All @@ -39,6 +40,9 @@
"vendor/bin/phpcbf . --ignore=vendor src"
],
"code:lint": "find src -name '*.php' -print0 | xargs -0 -n1 php -l",
"code:test" : [
"vendor/bin/phpunit -c ./phpunit.xml"
],
"pre-commit": [
"composer validate --strict",
"@codesniff",
Expand Down
12 changes: 12 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<phpunit
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutChangesToGlobalState="true"
failOnWarning="true"
cacheResult="false">
<testsuites>
<testsuite name="unit">
<directory>./tests/src/</directory>
</testsuite>
</testsuites>
</phpunit>
Loading