diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..adb0503 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,45 @@ +name: CI Tests + +on: + pull_request: + push: + branches: + - master + - v* + +jobs: + tests: + runs-on: ubuntu-22.04 + + strategy: + fail-fast: false + matrix: + stability: [prefer-stable] + versions: [ + { php: 8.1, phpunit: 10 }, { php: 8.2, phpunit: 10 }, { php: 8.3, phpunit: 10 }, + { php: 8.2, phpunit: 11 }, { php: 8.3, phpunit: 11 } + ] + + name: PHP ${{ matrix.versions.php }} - PHPUnit ${{ matrix.versions.phpunit }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + # Docs: https://github.com/shivammathur/setup-php + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.versions.php }} + extensions: dom, curl, libxml, mbstring, zip + ini-values: error_reporting=E_ALL + tools: composer:v2 + coverage: none + + - name: Install dependencies + run: | + composer require "phpunit/phpunit=^${{ matrix.versions.phpunit }}" --no-update + composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader + + - name: Run phpunit tests + run: composer test diff --git a/README.md b/README.md index 0fcbe5c..98f43ff 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,17 @@ # PHPUnit TestListener for PHP-VCR -Integrates PHPUnit with [PHP-VCR](http://github.com/php-vcr/php-vcr) using annotations. +[![CI Tests](https://github.com/covergenius/phpunit-testlistener-vcr/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/covergenius/phpunit-testlistener-vcr/actions) +[![License](https://img.shields.io/packagist/l/covergenius/phpunit-testlistener-vcr.svg?style=flat-square)](LICENSE) +[![Development Version](https://img.shields.io/packagist/vpre/covergenius/phpunit-testlistener-vcr.svg?style=flat-square)](https://packagist.org/packages/covergenius/phpunit-testlistener-vcr) +[![Monthly Installs](https://img.shields.io/packagist/dm/covergenius/phpunit-testlistener-vcr.svg?style=flat-square)](https://packagist.org/packages/covergenius/phpunit-testlistener-vcr) + +Integrates PHPUnit with [PHP-VCR](http://github.com/covergenius/php-vcr) using annotations. ![PHP-VCR](https://user-images.githubusercontent.com/133832/27151811-0d95c6c4-514c-11e7-834e-eff1eec2ea16.png) Use `@vcr cassette_name` on your tests to turn VCR automatically on and off. -[![Build Status](https://travis-ci.org/php-vcr/phpunit-testlistener-vcr.svg?branch=master)](https://travis-ci.org/php-vcr/phpunit-testlistener-vcr) + ## Usage example @@ -33,9 +38,11 @@ class VCRTest extends TestCase 1) Install using composer: ``` sh -composer require --dev php-vcr/phpunit-testlistener-vcr +composer require --dev covergenius/phpunit-testlistener-vcr ``` +### For phpunit version 10+ + 2) Add listener to your `phpunit.xml`: ``` xml @@ -44,22 +51,27 @@ composer require --dev php-vcr/phpunit-testlistener-vcr ``` -Prior to PHPUnit 10 +### For phpunit version 9 and below ``` xml - + ``` ## Dependencies +PHPUnit-Testlistener-VCR depends on the following; + +* [php-vcr/php-vcr](https://github.com/covergenius/php-vcr) + +### Version 4 +* PHP 8.1+ +* PHPUnit >=10 + +### Version 3 + +* PHP 7.1+ +* PHPUnit <10 -PHPUnit-Testlistener-VCR depends on: - * PHP 8.1+ - * PHP 7.1+ (use <4.0) - * PHP 7.0+ (use <3.0) - * PHPUnit 10+ - * PHPUnit <10 (use <4.0) - * [php-vcr/php-vcr](https://github.com/php-vcr/php-vcr) ## Run tests @@ -72,8 +84,8 @@ composer install ## Changelog -**The changelog is manage at [PHPUnit testlistener for PHP-VCR releases page](https://github.com/php-vcr/phpunit-testlistener-vcr/releases).** +**The changelog is manage at [PHPUnit testlistener for PHP-VCR releases page](https://github.com/covergenius/covergenius/phpunit-testlistener-vcr/releases).** ## Copyright Copyright (c) 2013-2018 Adrian Philipp. Released under the terms of the MIT license. See LICENSE for details. -[Contributors](https://github.com/php-vcr/phpunit-testlistener-vcr/graphs/contributors) +[Contributors](https://github.com/covergenius/phpunit-testlistener-vcr/graphs/contributors) diff --git a/composer.json b/composer.json index c342158..8764f07 100644 --- a/composer.json +++ b/composer.json @@ -21,6 +21,14 @@ "require": { "covergenius/php-vcr": "^1.7", "php": "^8.1", - "phpunit/phpunit": "^10.4" + "phpunit/phpunit": "^10.4 | ^11" + }, + "scripts": { + "test": [ + "vendor/bin/phpunit" + ], + "lint": [ + "vendor/bin/phpcs" + ] } }