Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TESTO

PHP-VCR bridge

Documentation Support on Boosty


Important

🪞 This is a read-only mirror.

Active development of the Testo project lives in php-testo/testo under bridge/vcr/. This repository is automatically synchronized from there on every release.

File issues and pull requests in the main monorepo, not here.

About

PHP-VCR integration for Testo. Mark any test with #[VCR('cassette')]: its HTTP interactions are recorded to a cassette on the first run and replayed from it afterwards, so the test stays fast, deterministic, and offline. The attribute is self-wiring — no plugin registration required.

use Testo\Attribute\Test;
use Testo\Bridge\VCR;
use Testo\Bridge\VCR\RecordMode;

#[Test]
#[VCR('github-user', mode: RecordMode::None)]
public function fetches_a_user(): void
{
    $json = \file_get_contents('https://api.github.com/users/roxblnfk');
    // asserts...
}

Register VcrPlugin only to point php-vcr at a non-default cassette directory:

// testo.php
use Testo\Application\Config\ApplicationConfig;
use Testo\Application\Config\SuiteConfig;
use Testo\Bridge\VCR\VcrPlugin;

return new ApplicationConfig(
    plugins: [new VcrPlugin(cassettePath: __DIR__ . '/tests/fixtures')],
    suites:  [new SuiteConfig(name: 'Feature', location: ['tests/Feature'])],
);

Install

composer require --dev testo/bridge-vcr

PHP Latest Version on Packagist License Total Downloads

About

PHP-VCR bridge for the Testo testing framework (split-published from php-testo/testo)

Resources

Code of conduct

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages