Skip to content

Commit d081839

Browse files
authored
feat: add tests (#18)
* feat: add tests * downgrade to pest 2.0 * fix phpunit.xml * downgrade to phpunit 1.0 * impreove github action * impreove github action * test
1 parent 91e6fa6 commit d081839

File tree

4 files changed

+50
-4
lines changed

4 files changed

+50
-4
lines changed

.github/workflows/run-tests.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Run Tests
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
push:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
php: [7.4, 8.0, 8.1, 8.2, 8.3]
16+
17+
name: PHP ${{ matrix.php }}
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Setup PHP
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: ${{ matrix.php }}
27+
tools: composer:v2
28+
coverage: xdebug
29+
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.lock') }}
39+
restore-keys: ${{ runner.os }}-composer-
40+
41+
- name: Install dependencies
42+
run: composer install --prefer-dist --no-progress
43+
44+
- name: Run tests
45+
run: ./vendor/bin/pest --ci

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ composer.phar
33
composer.lock
44
.DS_Store
55
.idea
6-
tests/_output/*
6+
.phpunit.cache
7+
.phpunit.result.cache

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"php": ">=5.4.0"
2121
},
2222
"require-dev": {
23-
"pestphp/pest": "^3.8",
23+
"pestphp/pest": "^1.0",
2424
"rector/rector": "^2.0"
2525
},
2626
"autoload": {

phpunit.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
>
77
<testsuites>
88
<testsuite name="Unit">
9-
<directory>./tests/Unit</directory>
9+
<directory>tests/Unit</directory>
1010
</testsuite>
1111
</testsuites>
1212
<source>
1313
<include>
14-
<directory>./src</directory>
14+
<directory>src</directory>
1515
</include>
1616
</source>
1717
<php>

0 commit comments

Comments
 (0)