contexts icon indicating copy to clipboard operation
contexts copied to clipboard

Only use SystemContext

Open tophsic opened this issue 10 years ago • 5 comments

To test command lines tool, I do not need http_call services required in Extension::load method.

Do you think it is a good idea to add a parameter to allow to skip http_call loading?

PR is coming if so.

tophsic avatar Dec 01 '15 13:12 tophsic

It’s just a service declaration. If you don’t load a class needs it, no instance is created.

sanpii avatar Dec 01 '15 13:12 sanpii

I should have begin by that

My composer file:

{
    "name": "my/project",
    "type": "project",
    "require": {
        "php": ">=5.4"
    },
    "require-dev": {
        "behatch/contexts": "^2.3"
    }
}

My Behat configuration:

default:
    suites:
        core:
            paths:
                - %paths.base%/features
            contexts:
                - FeatureContext
                - behatch:system:
                    root: "."

    extensions:
        Sanpi\Behatch\Extension: ~
# vendor/bin/behat

  [Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]                   
  The service "behatch.http_call.listener" has a dependency on a non-existent service "mink".  

tophsic avatar Dec 01 '15 13:12 tophsic

Fool I am

default:
    suites:
        core:
            paths:
                - %paths.base%/features
            contexts:
                - FeatureContext
                - Sanpi\Behatch\Context\SystemContext

is working

tophsic avatar Dec 01 '15 13:12 tophsic

Ok, we can load the http_call service only if the mink service exist. What do you think?

sanpii avatar Dec 01 '15 13:12 sanpii

Sure.

For now, only SystemContext is able to work without http_call service, isn'it?

It would be great to split JsonContext to be able to anlayse Json in a local file for example. It is another story.

tophsic avatar Dec 01 '15 13:12 tophsic