Skip to content

[Bug][BrowserKit] #20815

Open
Open
@GrinWay

Description

@GrinWay

I already wanted to file a bug because of unexpected behaviour I was dealing with for the last DAY
but as it turns out it just NOT documented behaviour

BrowserKit docs tells nothing about KernelBrowser::disableReboot() method

I was thinking a lot why all of my mocks just disappeared and test started using real services, real http_clients...

All the container was rebooted after the first request because of the default behaviour that HAS NOT BEEN DOCUMENTED YET

I'm crying

Activity

GrinWay

GrinWay commented on Mar 24, 2025

@GrinWay
ContributorAuthor
RisingSunLight42

RisingSunLight42 commented on Mar 28, 2025

@RisingSunLight42
Contributor

Only later I found "https://symfony.com/doc/current/testing.html#multiple-requests-in-one-test"

I apologize...

@GrinWay since you found this, is your issue still relevant?

GrinWay

GrinWay commented on Mar 28, 2025

@GrinWay
ContributorAuthor

Not at all, I just used KernelBrowser::disableReboot() and as expected kernel stopped rebooting and all of my mocks remained as well

xabbuh

xabbuh commented on Mar 28, 2025

@xabbuh
Member

What do you think could be changed in the docs to make the behaviour more clear?

GrinWay

GrinWay commented on Mar 28, 2025

@GrinWay
ContributorAuthor

Wow I did not even expect that you'll ask this

First of all I'm pleasantly surprised by your question :)

Well, to tell the truth it would be nice at least to refer to this "https://symfony.com/doc/current/testing.html#multiple-requests-in-one-test" link exactly in the BrowserKit component docs in a separate small testing section.

I guess called like [Testing][Browser client default behaviour]
And in this section show that:

By default browser client is intended to be used once, because after that the whole service container will be rebooted because of the kernel rebooting it means that all of your mocked services will get lost, to avoid that and use request several times per a test call the KernelBrowser::disableReboot() method.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @xabbuh@carsonbot@RisingSunLight42@GrinWay

        Issue actions

          [Bug][BrowserKit] · Issue #20815 · symfony/symfony-docs