php-http/HttplugBundle

[Plugin] Add configuration for VCR plugin

GaryPEGEOT opened this issue · 1 comments

Q A
Bug? no
New Feature? yes
Version master

Actual Behavior

No easy way to configure the VCR plugin

Expected Behavior

Same configuration pattern as the other plugins

Possible Solutions

Either a kind of "all-in-one" implementation:

// config.yml
httplug:
    clients:
        acme:
            # ...
            plugins:
                # ...
                - record_and_replay: # or vcr
                    mode: record # record | replay | replay_or_record
                    recorder: filesystem # optionnal
                    naming_strategy: service_id.of.naming_strategy # optionnal

Or a more explicit way, ie be defining a record plugin, and a replay plugin

// config.yml
httplug:
    clients:
        acme:
            # ...
            plugins:
                # ...
                - replay:
                    throw_on_missing: false # Default to true
                - record: ~
    plugins:
        record_and_replay: # or vcr
            recorder: filesystem # optionnal
            naming_strategy: service_id.of.naming_strategy # optionnal

Taking the risk that people put record before replay.

Any design preference @dbu?

dbu commented

i think i prefer the all-in-one approach to keep it simpler for the user. if somebody really needs a plugin between the replace and recorder, they can create their own services for the plugins. the 3 modes should also make it easier to switch between modes, and only have the plugins registered that make sense for that mode.

i would name the key in the plugin list vcr, like the repository name.

how easy will this be to configure only in the test environment? the symfony bundle config reference in the documentation should explain how to do that...