Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add recipe for zenstruck/browser #1349

Merged
merged 1 commit into from
Oct 20, 2024
Merged

Conversation

kbond
Copy link
Member

@kbond kbond commented Oct 19, 2024

Q A
License MIT
Doc issue/PR n/a

Companion to zenstruck/browser#156

I've been working on making it easier to get started using zenstruck/browser and symfony/panther together. Basically, adding a way to avoid this "hack".

The fix in browser does the following:

  1. Ensure a new webserver is always started by unsetting SYMFONY_PROJECT_DEFAULT_ROUTE_URL. This env var is added by the Symfony CLI when a server is running for the current project. For the most part, I think this is the user's dev environment which they don't want to run their tests on.
  2. Set PANTHER_APP_ENV to APP_ENV to ensure the arrange/setup phase of your tests work with the same kernel Panther's webserver does. I know Add PANTHER_APP_ENV in .env.test #643 specifically added PANTHER_APP_ENV=panther - a separate env to avoid mocked sessions but... I don't seem to be having this problem - Panther appears to work with mock_file session storage just fine. I've tested session auth and form submits (CSRF). Maybe something has changed since PANTHER_APP_ENV was introduced? Let me know if I'm missing something here!

To avoid BC breaks, zenstruck/browser requires you to opt-in but I think this should be the recipe default.

@symfony-recipes-bot symfony-recipes-bot enabled auto-merge (squash) October 19, 2024 20:26
Copy link

Thanks for the PR 😍

How to test these changes in your application

  1. Define the SYMFONY_ENDPOINT environment variable:

    # On Unix-like (BSD, Linux and macOS)
    export SYMFONY_ENDPOINT=https://raw.githubusercontent.com/symfony/recipes/flex/pull-1349/index.json
    # On Windows
    SET SYMFONY_ENDPOINT=https://raw.githubusercontent.com/symfony/recipes/flex/pull-1349/index.json
  2. Install the package(s) related to this recipe:

    composer req 'symfony/flex:^1.16'
    composer req 'zenstruck/browser:^1.9'
  3. Don't forget to unset the SYMFONY_ENDPOINT environment variable when done:

    # On Unix-like (BSD, Linux and macOS)
    unset SYMFONY_ENDPOINT
    # On Windows
    SET SYMFONY_ENDPOINT=

Diff between recipe versions

In order to help with the review stage, I'm in charge of computing the diff between the various versions of patched recipes.
I'm going keep this comment up to date with any updates of the attached patch.

@fabpot fabpot disabled auto-merge October 20, 2024 08:25
@fabpot fabpot merged commit 9698b84 into symfony:main Oct 20, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants