From 1fb42b8f9ca2ca48e25427821a732f9b9c399d43 Mon Sep 17 00:00:00 2001 From: Max Snow Date: Thu, 1 Aug 2024 11:23:17 +1000 Subject: [PATCH 1/4] Updates readme, adds tests --- .github/workflows/ci.yml | 45 ++++++++++++++++++++++++++++++++++++++++ README.md | 40 ++++++++++++++++++++++------------- composer.json | 2 +- 3 files changed, 72 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c4398f6 --- /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.php }} - PHPUnit ${{ matrix.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..be9d204 100644 --- a/composer.json +++ b/composer.json @@ -21,6 +21,6 @@ "require": { "covergenius/php-vcr": "^1.7", "php": "^8.1", - "phpunit/phpunit": "^10.4" + "phpunit/phpunit": "^10.4 | ^11" } } From af8251bc8a1547eb1fae6731185edfc660cc3627 Mon Sep 17 00:00:00 2001 From: Max Snow Date: Thu, 1 Aug 2024 11:30:22 +1000 Subject: [PATCH 2/4] add composer commands --- composer.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/composer.json b/composer.json index be9d204..8764f07 100644 --- a/composer.json +++ b/composer.json @@ -22,5 +22,13 @@ "covergenius/php-vcr": "^1.7", "php": "^8.1", "phpunit/phpunit": "^10.4 | ^11" + }, + "scripts": { + "test": [ + "vendor/bin/phpunit" + ], + "lint": [ + "vendor/bin/phpcs" + ] } } From b3e4576537dd75fb2cbea1dbc1e5061786459815 Mon Sep 17 00:00:00 2001 From: Max Snow Date: Thu, 1 Aug 2024 11:35:19 +1000 Subject: [PATCH 3/4] Move name to hopefully output matrix var names --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c4398f6..e4a5272 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,8 +20,6 @@ jobs: { php: 8.2, phpunit: 11 }, { php: 8.3, phpunit: 11 } ] - name: PHP ${{ matrix.php }} - PHPUnit ${{ matrix.phpunit }} - steps: - name: Checkout code uses: actions/checkout@v4 @@ -30,6 +28,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: + name: PHP ${{ matrix.php }} - PHPUnit ${{ matrix.phpunit }} php-version: ${{ matrix.versions.php }} extensions: dom, curl, libxml, mbstring, zip ini-values: error_reporting=E_ALL From f0b73c559e5e8f6d8f1d1c75d0b0952b0d6b77cd Mon Sep 17 00:00:00 2001 From: Max Snow Date: Thu, 1 Aug 2024 11:51:50 +1000 Subject: [PATCH 4/4] update vars --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e4a5272..adb0503 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,8 @@ jobs: { 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 @@ -28,7 +30,6 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - name: PHP ${{ matrix.php }} - PHPUnit ${{ matrix.phpunit }} php-version: ${{ matrix.versions.php }} extensions: dom, curl, libxml, mbstring, zip ini-values: error_reporting=E_ALL