Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 6 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,19 @@ jobs:
path: ~/.composer/cache/files
key: php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: php-${{ matrix.php }}-composer-

- name: Install dependencies
run: composer install --prefer-source
- name: Run tests
run: |
cd tests
../vendor/bin/phpunit --coverage-text .

- name: Check code style
run: vendor/bin/phpcs --standard=PEAR src/

- name: Run tests
run: composer test-ci

- name: SonarQube Scan
if: ${{ matrix.php == '8.1' && github.actor != 'dependabot[bot]' }}
uses: SonarSource/sonarqube-scan-action@v5.2.0
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/coverage
/.vscode
.idea
coverage-clover.xml

### PHPUnit ###
# Covers PHPUnit
Expand All @@ -18,10 +19,6 @@
.phpunit.result.cache
.phpunit.cache

# PHPUnit
/app/phpunit.xml
/phpunit.xml

# Build data
/build/

Expand Down
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ JsonMapper - map nested JSON structures onto PHP classes
:target: https://packagist.org/packages/apimatic/jsonmapper
.. image:: https://github.com/apimatic/jsonmapper/workflows/Tests/badge.svg
:target: https://github.com/apimatic/jsonmapper/actions?query=workflow%3ATests
.. image:: https://sonarcloud.io/api/project_badges/measure?project=apimatic_jsonmapper&metric=coverage
:target: https://sonarcloud.io/summary/new_code?id=apimatic_jsonmapper
.. image:: https://sonarcloud.io/api/project_badges/measure?project=apimatic_jsonmapper&metric=sqale_rating
:target: https://sonarcloud.io/summary/new_code?id=apimatic_jsonmapper
.. image:: https://sonarcloud.io/api/project_badges/measure?project=apimatic_jsonmapper&metric=vulnerabilities
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
},
"scripts": {
"test": "phpunit --coverage-text",
"test-ci": "phpunit --coverage-text --coverage-clover=coverage-clover.xml",
"test-coverage": "phpunit --path-coverage --coverage-html=CodeCoverage",
"lint-fix": "phpcbf --standard=PEAR src/",
"lint": "phpcs --standard=PEAR src/"
Expand Down
25 changes: 25 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
bootstrap="tests/bootstrap.php"
colors="true"
beStrictAboutChangesToGlobalState="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutCoversAnnotation="true"
>
<testsuites>
<testsuite name="JsonMapper Test Suite">
<directory>./tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory suffix=".php">src</directory>
</whitelist>
</filter>

<php>
<ini name="date.timezone" value="UTC"/>
</php>
</phpunit>
4 changes: 3 additions & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ sonar.host.url=https://sonarcloud.io
sonar.sourceEncoding=UTF-8

sonar.sources=src
sonar.tests=tests
sonar.tests=tests

sonar.php.coverage.reportPaths=coverage-clover.xml
14 changes: 0 additions & 14 deletions tests/phpunit.xml

This file was deleted.