Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds github testing, updates readme #4

Merged
merged 4 commits into from
Aug 1, 2024
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
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
40 changes: 26 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand All @@ -44,22 +51,27 @@ composer require --dev php-vcr/phpunit-testlistener-vcr
</extensions>
```

Prior to PHPUnit 10
### For phpunit version 9 and below
``` xml
<listeners>
<listener class="VCR\PHPUnit\TestListener\VCRTestListener" file="vendor/php-vcr/phpunit-testlistener-vcr/src/VCRTestListener.php" />
<listener class="VCR\PHPUnit\TestListener\VCRTestListener" file="vendor/covergenius/phpunit-testlistener-vcr/src/VCRTestListener.php" />
</listeners>
```

## 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

Expand All @@ -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)
10 changes: 9 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
}