8000 [Session] session.storage.metadata_bag is non-existent for test env in 5.3 · Issue #40282 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Session] session.storage.metadata_bag is non-existent for test env in 5.3 #40282

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

Closed
jrushlow opened this issue Feb 23, 2021 · 2 comments · Fixed by #40285
Closed

[Session] session.storage.metadata_bag is non-existent for test env in 5.3 #40282

jrushlow opened this issue Feb 23, 2021 · 2 comments · Fixed by #40285

Comments

@jrushlow
Copy link
Contributor
jrushlow commented Feb 23, 2021

Symfony version(s) affected: main

Description
In the test environment when creating a KernelBrowser a dependency error is thrown:

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException : The service "session.storage.mock_file" has a dependency on a non-existent service "session.storage.metadata_bag".

How to reproduce

class SomeTest extends WebTestCase
{
    public function testTest(): void
    {
        $client = self::createClient();
        self::assertInstanceOf(KernelBrowser::class, $client);
    }
}

Possible Solution
for framework.session.storage_factory_id use session.storage.factory.mock_file instead if session.storage.mock_file

Additional context
There are a dozen or so tests failing in MakerBundle partly due to this. CI Results -> https://github.com/symfony/maker-bundle/runs/1954376810?check_suite_focus=true. If we need a simple reproducer, I can whip one up based off of one of the failing maker tests.

@jderusse
Copy link
Member

I think symfony/recipes#905 fixes this issue (can you pelase confirm it @jrushlow ?)

When user provides a framework.session.storage_factory_id, the FrameworkExtension removes some services (like session.storage.metadata_bag), but let the session.storage.mock_file service. (I opened #40285 to fix this). This should not have been an issue, because this service shouldn't have been used and should have been removed. EXCEPT I also made a typo in the flex recipes (fixed by symfony/recipes#905) which configures framework.session.storage_factory_id AND use the session.storage.mock_file service. This is the issue you are facing.

Maker bundle use the flex recipes, that's why I say that the flex PR fixes the issue in maker-bundle

@jrushlow
Copy link
Contributor Author

I just reviewed a recent test run in MakerBundle (post #40285 being merged) and it appears the issue is resolved on the PHP 7.4 && 8.x dev tests. The remaining issues on those branches are unrelated to this issue. thanks @jderusse!

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 a pull request may close this issue.

2 participants
0