Skip to content

By overriding headers bundle must be added to 'test' environment to make tests work #19

Open

Description

@danaki
Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? no
Version/Branch @dev

I overrided templates/headers like it's described in the documentation to support XSRF tokens via DunglasAngularCsrfBundle in GraphiQL. Now, when I run behat tests I'm getting this error:

In YamlFileLoader.php line 657:

  There is no extension able to load the configuration for "overblog_graphiql" (in /Users/yuri/work/ex/gql/config/packages/graphiql.yaml). Looked for namespace "overblog_graphiql", found "framework", "overblog_graphql", "twig", "doctrine_cache", "doctrine", "doctrine_migrations", "security", "stof_doctrine_extensions", "lexik_jwt_authentication", "nelmio_cors", "dunglas_angular_csrf", "overblog_graphql_types"

My config/packages/graphiql.yml looks like this:

overblog_graphiql:
    template: "GraphiQL/index.html.twig"

To fix this issue I was forced to add 'test' to the list of envs of GraphiQLBundle. This is not a big deal just wanted to let you know may be there is some kind of a better solution for this? Add 'test' to envs by default? Or fix documentation, may be config/packages/dev/graphiql.yml is more correct place for config (not completely sure if it works this way).

And may be overriding a service, writing a class to override headers is better than overriding GraphiQL twig templates (I was forced to code a Twig extension just to put this XSRF token to overriden template)?

Activity

  1. renatomefi commented on May 31, 2018

    @renatomefi
    Contributor

    It seems to me you've done the right thing, by design we've put graphiql only on dev mode to avoid any kind of problems and security issues.
    But since you're integrating it in your tests you have to allow symfony to configure it the way you did.

    I personally never had to add it to my tests, if you come up with a better idea I'm willing to take a look!

  2. danaki commented on May 31, 2018

    @danaki
    Author

    Well, people usually don't need graphiql in their 'test' env, this is why I created this issue. Just because symfony finds an orphaned config it produces this error. There must be something to fix, may be documentation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions