zenstruck / browser

A fluent interface for your Symfony functional tests.
MIT License
185 stars 17 forks source link

document how to use when testing within a bundle #152

Closed tacman closed 4 weeks ago

tacman commented 1 month ago

I have a bundle that exposes a few controllers that I'm not sure how to test (from within the bundle).

https://github.com/symfony/symfony/discussions/57600#discussioncomment-9925933

Might that be possible with this library? In particular, I'm not sure how to configure the routes, so that I can go to

$this->browser()
        ->visit('/my-bundle/admin')
        ->assertSuccessful()

Thanks.

kbond commented 4 weeks ago

We do this in live components. You basically have to setup a test kernel for your bundle.

tacman commented 4 weeks ago

Thanks, I'll use LiveComponents as a model and work from there.