Skip to content

Commit

Permalink
Merge pull request #7 from BaguettePHP/feature/ci-phpunit
Browse files Browse the repository at this point in the history
Set CI and update PHPUnit
  • Loading branch information
zonuexe authored Apr 29, 2023
2 parents a2a5f61 + 1110bc5 commit f1fd22d
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 81 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Test
on:
workflow_dispatch:
pull_request:
branches:
- master
paths-ignore:
- '**.md'
push:
branches:
- master
paths-ignore:
- '**.md'
jobs:
run:
name: Run
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-20.04]
php-versions: ['5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
env:
key: cache-v1
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP with tools
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, opcache, xdebug, xml
tools: composer, cs2pr
- name: Get Composer cache directory
id: composer-cache-dir
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Restore composer cache
id: composer-cache
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache-dir.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Remove composer.lock
run: rm -f composer.lock
- name: Setup Composer
run: composer install
- name: Run PHPUnit tests
run: vendor/bin/phpunit
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
/vendor/*
/.idea
/*.iml
/.phpunit.result.cache
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Description
Requirements
------------

* PHP (5.4+)
* PHP (5.5+)
* `ext/intl`

Installation
Expand Down
11 changes: 7 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
}
],
"require": {
"ext-intl": "*"
"php": ">=5.5.0",
"ext-intl": "*"
},
"require-dev": {
"theseer/phpdox": "^0.8"
,"phploc/phploc": "*"
,"phpunit/phpunit": "^5.5|^4.8"
"phpunit/phpunit": "^8.5|^7.5|^4.8",
"yoast/phpunit-polyfills": "^1.0"
},
"autoload": {
"psr-4": {
Expand All @@ -25,5 +25,8 @@
"psr-4": {
"Teto\\HTTP\\": "tests/"
}
},
"config": {
"sort-packages": true
}
}
54 changes: 0 additions & 54 deletions phpdox.xml.dist

This file was deleted.

47 changes: 26 additions & 21 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/3.7/phpunit.xsd"
bootstrap="./tests/bootstrap.php">
<testsuites>
<testsuite>
<directory>./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">./src/</directory>
</whitelist>
<blacklist>
<directory suffix=".php">./vendor/</directory>
</blacklist>
<exclude></exclude>
</filter>
<logging>
<log type="coverage-html" target="build/report/coverage" />
<log type="coverage-clover" target="build/logs/clover.xml" />
</logging>

<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="tests/bootstrap.php"
>
<testsuites>
<testsuite name="HTTP Accept-Language">
<directory>./tests/</directory>
</testsuite>
</testsuites>

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

<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
</phpunit>
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

namespace Teto\HTTP;

abstract class TestCase extends \PHPUnit_Framework_TestCase
abstract class TestCase extends \PHPUnit\Framework\TestCase
{
}

0 comments on commit f1fd22d

Please sign in to comment.