Integrates Pest with PHP-VCR using plugins.

Overview

Pest plugin for PHP-VCR

GitHub Actions Latest Stable Version Total Downloads License

Integrates Pest with PHP-VCR using plugins.

Installation

You can install the package via composer:

composer require phpjuice/pest-plugin-vcr --dev

Setup

Add new folder inside tests to store cassettes:

mkdir tests/cassettes

Add the following line to your Pest.php file, this will tell VCR where to look for cassettes:

use VCR\VCR;


VCR::configure()->setCassettePath(__DIR__.'/cassettes');

Usage

This plugin will provide you with two handy functions vcrTurnOn & vcrTurnOff to turn on and off the http recording :

it('records requests to pestphp.com', function () {

    vcrTurnOn('pestphp.com');

    $result = file_get_contents('https://pestphp.com/');

    expect($result)
        ->toBe('Hello from pestphp.');

    vcrTurnOff();
});

The previous testsuite, will first send a request to pestphp.com and Record your test suite's HTTP interactions into a cassette and replay them during future test runs for fast, deterministic, accurate tests.

Important before running your tests make sure to have the following folder tests/cassettes

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, send us an email to [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

PHP Package Boilerplate

This package was generated using the PHP Package Boilerplate by Beyond Code.

GitHub Actions Latest Stable Version Total Downloads License

You might also like...
Implementation of PoP\Hooks using package bainternet/php-hooks

Implementation of PoP\\Hooks using package `bainternet/php-hooks` (a fork from the WordPress hooks system), to use with PHPUnit and avoid having to load WordPress

To run time/IO related unit tests (e.g., sleep function calls, database queries, API calls, etc) faster using Swoole.

To run time/IO related unit tests (e.g., sleep function calls, database queries, API calls, etc) faster using Swoole.

A video course for laravel artisan to learn creating API using testing

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Example repo for writing tests in Drupal (using DDEV)

Drupal Test Writing This is a test D9 site which can be used for practicing test writing and running.

PHP client for Selenium/WebDriver protocol. Previously facebook/php-webdriver

Php-webdriver library is PHP language binding for Selenium WebDriver, which allows you to control web browsers from PHP.

The modern, simple and intuitive PHP unit testing framework.

atoum PHP version atoum version 5.3 - 5.6 1.x - 3.x 7.2 - 8.x 4.x (current) A simple, modern and intuitive unit testing framework for PHP! Just lik

Full-stack testing PHP framework

Codeception Modern PHP Testing for everyone Codeception is a modern full-stack testing framework for PHP. Inspired by BDD, it provides an absolutely n

Faker is a PHP library that generates fake data for you
Faker is a PHP library that generates fake data for you

Faker Faker is a PHP library that generates fake data for you. Whether you need to bootstrap your database, create good-looking XML documents, fill-in

Releases(v1.0.2)
  • v1.0.2(Aug 30, 2021)

    What's Changed

    • Update dependencies by @mohammed-elhaouari in https://github.com/phpjuice/pest-plugin-vcr/pull/5

    Full Changelog: https://github.com/phpjuice/pest-plugin-vcr/compare/v1.0.1...v1.0.2

    Source code(tar.gz)
    Source code(zip)
  • v1.0.1(Aug 29, 2021)

    What's Changed

    • Update issue templates by @mohammed-elhaouari in https://github.com/phpjuice/pest-plugin-vcr/pull/2
    • update readme badges by @mohammed-elhaouari in https://github.com/phpjuice/pest-plugin-vcr/pull/3
    • fix VCR cassettes path by @mohammed-elhaouari in https://github.com/phpjuice/pest-plugin-vcr/pull/4

    Full Changelog: https://github.com/phpjuice/pest-plugin-vcr/compare/v1.0.0...v1.0.1

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Aug 28, 2021)

    What's Changed

    • Release v1.0.0 by @mohammed-elhaouari in https://github.com/phpjuice/pest-plugin-vcr/pull/1

    Full Changelog: https://github.com/phpjuice/pest-plugin-vcr/commits/v1.0.0

    Source code(tar.gz)
    Source code(zip)
Owner
PHPJuice
We create open source products for the developer community
PHPJuice
Pest is an elegant PHP Testing Framework with a focus on simplicity

Pest is an elegant PHP Testing Framework with a focus on simplicity. It was carefully crafted to bring the joy of testing to PHP. Explore the docs: pe

PEST 5.9k Dec 27, 2022
Enforce consistent styling for your Pest PHP tests

A set of PHP CS rules for formatting Pest PHP tests.

Worksome 2 Mar 15, 2022
⛽ Pest plugin to test Laravel applications powered by Octane.

⛽ Laravel Octane (Pest Plugin) Pest plugin to test Laravel applications powered by Octane. Install Via Composer composer require --dev cerbero/pest-pl

Andrea Marco Sartori 21 Apr 5, 2022
Add mocking capabilities to Pest or PHPUnit

This repository contains the Pest Plugin Mock. The Mocking API can be used in regular PHPUnit projects. For that, you just have to run the following c

PEST 16 Dec 3, 2022
A Pest plugin to control the flow of time

This Pest plugin offers a function testTime that allows you to freeze and manipulate the current time in your tests.

Spatie 34 Nov 16, 2022
The Pest Parallel Plugin

This repository contains the Pest Plugin Parallel. If you want to start testing your application with Pest, visit the main Pest Repository. Explore th

PEST 28 Dec 5, 2022
Wraps your Pest suite in a Laravel application instance, allowing global use of the framework in tests.

Pest Larastrap Plugin This is currently a highly experimental project and is subject to large pre-release changes. Pest PHP is an awesome PHP testing

Luke Downing 3 Jan 6, 2022
PHPUnit to Pest Converter

PestConverter PestConverter is a PHP library for converting PHPUnit tests to Pest tests. Before use Before using this converter, make sure your files

null 10 Nov 21, 2022
Prevent none-test output in your Pest tests.

Pest Plugin Silence Often, when writing tests, we echo and dump test code to debug and check everything is working correctly. It can be easy to forget

Worksome 5 Feb 23, 2022
Given When Then (GWT) Plugin for Pest

Given When Then (GWT) Plugin for Pest A simple API allows you to structure your tests focused on the behaviour. Given-When-Then separation makes the t

Milroy Fraser 85 Dec 22, 2022