feat: Add support for separate cassettes per DataProvider cases #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces comprehensive support for creating separate VCR cassettes for each PHPUnit DataProvider case, providing better isolation and organization of HTTP recordings in data-driven tests.
🚀 New Features
Enhanced UseCassette Attribute
separateCassettePerCase
: When set totrue
, creates individual cassette files for each data provider casegroupCaseFilesInDirectory
: When set totrue
, organizes separate cassette files in subdirectoriesFlexible Cassette Naming Strategies
cassette-0.yml
,cassette-1.yml
cassette-example-com.yml
,cassette-example-org.yml
cassette/0.yml
,cassette/example-com.yml
Class and Method Level Support
UseCassette
declared on test classesUseCassette
declared on individual test methods🔧 Implementation Details
Core Changes
TestCaseParameters
andTestMethodInfo
for better data handlingData Provider Name Normalization
📚 Documentation
🧪 Test Coverage
AttributeDeclaredOnClassWithSeparateCassettesInSeparateFoldersTest
AttributeDeclaredOnClassWithSeparateCassettesInSingleFolderTest
WithoutVcrTest
AttributeDeclaredOnMethodsTest
with new scenarios🔄 Backward Compatibility
💡 Usage Examples
Basic Separate Cassettes
Organized in Directories
This enhancement significantly improves the developer experience when working with data-driven tests that make HTTP requests, providing better isolation, easier debugging, and more organized test fixtures.