Skip to content

Add test to ensure WebTestCase does not trigger error #963

@nikophil

Description

@nikophil

I recently had a problem with WebTestCase, while I was testing #943 on a real life project

I needed to make this commit : 9425912

otherwise I had the infamous error:

LogicException: Booting the kernel before calling "Symfony\Bundle\FrameworkBundle\Test\WebTestCase::createClient()" is not supported, the kernel should only be booted once.

The scenario is the following:

  • a test with the kernel runs
  • tearDown() calls ensureKernelShutdown()
  • AFTER THAT Factories::_shutdownFoundry() is called
  • calling Configuration::instance() boots the kernel
  • if the next test is a WebTestCase, it will throw

I'd like to do two things:

  • now that priority for hook methods are a thing, we should add priorities to our hooks
  • add a test which would prevent us if something like this happen in the future

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions