PHP-VCR bridge
Important
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.
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'])],
);composer require --dev testo/bridge-vcr