diff --git a/.github/workflows/phpunit.yaml b/.github/workflows/phpunit.yaml new file mode 100644 index 0000000..dd812f6 --- /dev/null +++ b/.github/workflows/phpunit.yaml @@ -0,0 +1,41 @@ +on: + pull_request: + push: + +name: "PHPUnit" + +jobs: + phpunit: + name: PHP ${{ matrix.php }}-${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + php: + - "8.0" + - "8.1" + - "8.2" + - "8.3" + steps: + - name: Checkout + uses: actions/checkout@v2.3.4 + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + tools: composer:v2 + coverage: pcov + + - name: Install dependencies + run: composer install + + - name: Run tests with code coverage. + run: php -ddisable_functions=time vendor/bin/phpunit --coverage-clover=coverage.xml --colors=always + + - name: Upload coverage to Codecov. + if: matrix.os == 'ubuntu-latest' + uses: codecov/codecov-action@v3 + with: + files: ./coverage.xml \ No newline at end of file diff --git a/README.md b/README.md index ce3193a..dcff51e 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,10 @@ The package helps mock internal php functions as simple as possible. Use this package when you need mock such functions as: `time()`, `str_contains()`, `rand`, etc. +[![Latest Stable Version](https://poser.pugx.org/xepozz/internal-mocker/v/stable.svg)](https://packagist.org/packages/xepozz/internal-mocker) +[![Total Downloads](https://poser.pugx.org/xepozz/internal-mocker/downloads.svg)](https://packagist.org/packages/xepozz/internal-mocker) +[![phpunit](https://github.com/xepozz/internal-mocker/workflows/PHPUnit/badge.svg)](https://github.com/xepozz/internal-mocker/actions) + ## Installation ```bash