Skip to content
This repository has been archived by the owner on Apr 20, 2021. It is now read-only.

Symfony2 extension compatibility #119

Closed
sanpii opened this issue Apr 7, 2015 · 8 comments
Closed

Symfony2 extension compatibility #119

sanpii opened this issue Apr 7, 2015 · 8 comments
Labels
Milestone

Comments

@sanpii
Copy link
Member

sanpii commented Apr 7, 2015

Ok, travis back to green, now we can work on the big issue with Behat/Symfony2Extension (#55, #98, #101, #110 and #118).

All issues is in the rest context, this confirms @stof’s comment:

The rest-context is a huge mistake altogether. Mink is not a REST client (browsers are not REST clients either). There is no point using the Mink driver to perform the REST API calls. It is the wrong tool for the job.

Any idea?

@sanpii sanpii added the bug label Apr 7, 2015
@sanpii sanpii added this to the 2.3 milestone Apr 7, 2015
@sanpii
Copy link
Member Author

sanpii commented Apr 7, 2015

@sanpii
Copy link
Member Author

sanpii commented Apr 21, 2015

I just push a new branch browser-kit fixed this issue. Feedback welcome 😃

@richstandbrook
Copy link

@sanpii I've just pulled the browser-kit branch and run the tests and I'm getting the same error.

Call to undefined method Symfony\Component\HttpKernel\Client::setHeader()

@richstandbrook
Copy link

Any thoughts on this? I am using it along with a https://github.com/laracasts/Behat-Laravel-Extension could there be a conflict? Perhaps I'm not configuring be behatch properly?

default:

  extensions:
    Laracasts\Behat: ~
    Sanpi\Behatch\Extension: ~
    Behat\MinkExtension:
      show_cmd: "/Applications/Safari.app/Contents/MacOS/Safari %s"
      default_session: laravel
      laravel: ~

  suites:
    default:
      contexts:
        - FeatureContext
        - Behat\MinkExtension\Context\MinkContext
        - behatch:json
        - behatch:rest

@richstandbrook
Copy link

Has anyone been able to set headers with the REST context here? I could really use it, I've tried to have a look myself but I can't figure out how to fix it myself.

@fsevestre
Copy link

@sanpii

Like @koorb, we are not able to set headers with the I add :name header equal to :value step.

I tried the browser-kit branch too and I have this issue:

PHP Fatal error:  Call to undefined method Symfony\Bundle\FrameworkBundle\Client::setHeader() in /home/fsevestre/workspace/broadcast-api/broadcast-api/vendor/behatch/contexts/src/HttpCall/Request/Goutte.php on line 64

Symfony 2.7

My behat.yml:

default:
    calls:
        error_reporting: 16383 # E_ALL & ~E_USER_DREPRECATED
    suites:
        default:
            type: symfony_bundle
            bundle: 'AppBundle'
            paths: [ %paths.base%/src/AppBundle/Tests/Features ]
            contexts:
                - AppBundle\Tests\Features\Context\FeatureContext: { doctrine: "@doctrine" }
                - AppBundle\Tests\Features\Context\JsonContext
                - AppBundle\Tests\Features\Context\SecurityContext: { container: "@service_container" }
                - Behat\MinkExtension\Context\MinkContext
                - Knp\FriendlyContexts\Context\AliceContext
                - Sanpi\Behatch\Context\RestContext
    extensions:
        Behat\Symfony2Extension:
            kernel:
              env: "test"
              debug: "true"
        Behat\MinkExtension:
            base_url: "http://broadcast-api.dev"
            sessions:
                default:
                    symfony2: ~
        Sanpi\Behatch\Extension: ~
        Knp\FriendlyContexts\Extension:
            alice:
                fixtures:
                    ...
                dependencies: ~

@teohhanhui
Copy link
Contributor

@koorb @fsevestre The browser-kit branch is outdated as far as I can tell. My PR should work.

@fsevestre
Copy link

👍 Thanks @teohhanhui, I tried your PR and the I add :name header equal to :value step is now working as expected on my app (I can finally remove all my TODOs :))

@sanpii sanpii closed this as completed Apr 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants