tests: add coverage (#647)

This commit is contained in:
yansongda 2022-08-17 14:15:40 +08:00 committed by GitHub
parent e02069503b
commit 02bf68d1fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 70 additions and 28 deletions

1
.gitattributes vendored
View File

@ -1,5 +1,6 @@
/tests export-ignore
/.github export-ignore
/.phpunit.cache
.gitattributes export-ignore
.gitignore export-ignore
phpunit.php export-ignore

26
.github/workflows/coverage.yml vendored Normal file
View File

@ -0,0 +1,26 @@
name: Code Coverage
on:
push:
branches:
- master
pull_request:
jobs:
coverage:
name: Code Coverage
runs-on: 'ubuntu-latest'
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: openssl
coverage: xdebug
- name: Install Dependencies
run: composer require php-di/php-di
- name: Run Coverage
run: vendor/bin/phpunit --coverage-clover coverage.xml
- name: Upload Coverage
uses: codecov/codecov-action@v3

View File

@ -1,23 +1,22 @@
name: Coding Style
on: [push, pull_request]
on:
push:
branches:
- master
pull_request:
jobs:
php_cs_fixer:
name: php_cs_fixer
runs-on: "${{ matrix.os }}"
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
php-version:
- 8.1
runs-on: "ubuntu-latest"
steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
php-version: '8.1'
coverage: none
- name: Install Dependencies
run: composer install --no-progress
- name: Run PHP-CS-Fixer
@ -35,11 +34,12 @@ jobs:
- 8.1
steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: none
- name: Install Dependencies
run: composer install --no-progress
- name: Run PHP-Stan

View File

@ -1,5 +1,9 @@
name: Tester
on: [push, pull_request]
on:
push:
branches:
- master
pull_request:
jobs:
PHPUnit:
@ -19,12 +23,13 @@ jobs:
- 8.1
steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: openssl
coverage: none
- name: Install Dependencies
run: composer install --no-progress
- name: Laravel Framework

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ vendor/
composer.lock
*.DS_Store
.idea/
.phpunit.cache/

View File

@ -1,8 +1,9 @@
<p align="center">
<a href="https://pay.yansongda.cn" target="_blank" rel="noopener noreferrer"><img width="200" src="https://cdn.jsdelivr.net/gh/yansongda/pay-site/.vuepress/public/images/logo.png" alt="Logo"></a>
<a href="https://pay.yansongda.cn" target="_blank" rel="noopener noreferrer"><img width="200" src="https://pay.yansongda.cn/images/logo.png" alt="Logo"></a>
</p>
<p align="center">
<a href="https://codecov.io/gh/yansongda/pay" ><img src="https://codecov.io/gh/yansongda/pay/branch/master/graph/badge.svg?token=tYMV0YT5jj"/></a>
<a href="https://scrutinizer-ci.com/g/yansongda/pay/?branch=master"><img src="https://scrutinizer-ci.com/g/yansongda/pay/badges/quality-score.png?b=master" alt="scrutinizer"></a>
<a href="https://github.com/yansongda/pay/actions"><img src="https://github.com/yansongda/pay/workflows/Linter/badge.svg" alt="Linter Status"></a>
<a href="https://github.com/yansongda/pay/actions"><img src="https://github.com/yansongda/pay/workflows/Tester/badge.svg" alt="Tester Status"></a>

View File

@ -1,17 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
cacheResult="false">
<testsuites>
<testsuite name="tests">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
executionOrder="depends,defects"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
convertDeprecationsToExceptions="true"
failOnRisky="true"
failOnWarning="true"
verbose="true">
<testsuites>
<testsuite name="default">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
<coverage cacheDirectory=".phpunit.cache/code-coverage"
processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
</phpunit>