Skip to content

Commit 37bb334

Browse files
committed
ci: add PHPUnit configuration and improve workflow
1 parent fb20b7c commit 37bb334

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

.github/workflows/test.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,24 @@ jobs:
2727
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite
2828
coverage: xdebug
2929

30+
- name: Get composer cache directory
31+
id: composer-cache
32+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
33+
34+
- name: Cache dependencies
35+
uses: actions/cache@v3
36+
with:
37+
path: ${{ steps.composer-cache.outputs.dir }}
38+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
39+
restore-keys: ${{ runner.os }}-composer-
40+
3041
- name: Install dependencies
3142
run: |
3243
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
3344
composer update --prefer-dist --no-interaction
3445
3546
- name: Execute tests
36-
run: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.xml
47+
run: vendor/bin/phpunit
3748

3849
- name: Upload coverage to Codecov
3950
uses: codecov/codecov-action@v3

phpunit.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
colors="true"
6+
>
7+
<testsuites>
8+
<testsuite name="Feature">
9+
<directory suffix="Test.php">./tests/Feature</directory>
10+
</testsuite>
11+
</testsuites>
12+
<coverage processUncoveredFiles="true">
13+
<include>
14+
<directory suffix=".php">./src</directory>
15+
</include>
16+
<report>
17+
<clover outputFile="coverage.xml"/>
18+
<text outputFile="php://stdout" showUncoveredFiles="true"/>
19+
</report>
20+
</coverage>
21+
<php>
22+
<env name="APP_ENV" value="testing"/>
23+
<env name="APP_DEBUG" value="true"/>
24+
</php>
25+
</phpunit>

0 commit comments

Comments
 (0)