Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[HttpKernel] Issue with multiple requests in tests #46206

Closed
@adrienfr

Description

@adrienfr

Symfony version(s) affected

5.4.8

Description

Hi,

After upgrading to 5.4.8, I have an issue with several PHPUnit tests where multiple requests are made.
I found that the following pull request is most likely responsible for the change.

Here is an example of a failing test (last assertion fails on 5.4.8 but was valid on 5.4.7):

public function testCountUserUnreadConversations()
{
    // Not logued
    $this->client->request('GET', '/count', [], [], ['HTTP_X-Requested-With' => 'XMLHttpRequest']);
    $this->assertFalse($this->client->getResponse()->isSuccessful());
    // No Ajax
    $this->client->loginUser($this->user);
    $this->client->request('GET', '/count');
    $this->assertFalse($this->client->getResponse()->isSuccessful());
    // Ok
    $this->client->request('GET', '/count', [], [], ['HTTP_X-Requested-With' => 'XMLHttpRequest']);
    $this->assertTrue($this->client->getResponse()->isSuccessful());
}

@trsteel88 you might have some knowledge about this behavior?

How to reproduce

Here is a small reproducer.
Note: there is an EventListener which add a key/value setting in every session (currency).
Without this EventListener, there is no issue on 5.4.8, I think that's why few people might encounter the same issue and why test on Symfony repository are all green.

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions