Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

TEST: Error while testing symfony5.1.2 #37510

Copy link
Copy link
Closed
@featuriz

Description

@featuriz
Issue body actions

Symfony version(s) affected: 5.1.2

Description

App\Tests\Controller\SecurityControllerTest::testLogout()
TypeError: Argument 3 passed to Symfony\Component\Security\Http\RememberMe\AbstractRememberMeServices::logout() must implement interface Symfony\Component\Security\Core\Authentication\Token\TokenInterface, null given, called in xx\vendor\symfony\security-http\EventListener\RememberMeLogoutListener.php on line 47

How to reproduce
I'm working on simple symfony crud website from a fresh symfony5.0. I build it from "Create your own framework guide from symfony site".
This worked up to now.
Today I updated to https://symfony.com/doc/current/security/experimental_authenticators.html
Then I had this problem only while testing. But run on browser its fine good - no error.

Possible Solution
Currently I don't know

Additional context
Error thrown by test:

App\Tests\Controller\SecurityControllerTest::testLogout()
TypeError: Argument 3 passed to Symfony\Component\Security\Http\RememberMe\AbstractRememberMeServices::logout() must implement interface Symfony\Component\Security\Core\Authentication\Token\TokenInterface, null given, called in E:\WORK\xx\vendor\symfony\security-http\EventListener\RememberMeLogoutListener.php on line 47
E:\WORK\xx\vendor\symfony\security-http\RememberMe\AbstractRememberMeServices.php:161
E:\WORK\xx\vendor\symfony\security-http\EventListener\RememberMeLogoutListener.php:47
E:\WORK\xx\vendor\symfony\event-dispatcher\EventDispatcher.php:270
E:\WORK\xx\vendor\symfony\event-dispatcher\EventDispatcher.php:230
E:\WORK\xx\vendor\symfony\event-dispatcher\EventDispatcher.php:59
E:\WORK\xx\vendor\symfony\security-http\Firewall\LogoutListener.php:122
E:\WORK\xx\vendor\symfony\security-bundle\Debug\WrappedLazyListener.php:48
E:\WORK\xx\vendor\symfony\security-http\Firewall\AbstractListener.php:27
E:\WORK\xx\vendor\symfony\security-bundle\Debug\TraceableFirewallListener.php:62
E:\WORK\xx\vendor\symfony\security-http\Firewall.php:84
E:\WORK\xx\vendor\symfony\event-dispatcher\Debug\WrappedListener.php:117
E:\WORK\xx\vendor\symfony\event-dispatcher\EventDispatcher.php:230
E:\WORK\xx\vendor\symfony\event-dispatcher\EventDispatcher.php:59
E:\WORK\xx\vendor\symfony\event-dispatcher\Debug\TraceableEventDispatcher.php:151
E:\WORK\xx\vendor\symfony\http-kernel\HttpKernel.php:133
E:\WORK\xx\vendor\symfony\http-kernel\HttpKernel.php:79
E:\WORK\xx\vendor\symfony\http-kernel\Kernel.php:196
E:\WORK\xx\vendor\symfony\http-kernel\HttpKernelBrowser.php:63
E:\WORK\xx\vendor\symfony\framework-bundle\KernelBrowser.php:159
E:\WORK\xx\vendor\symfony\browser-kit\AbstractBrowser.php:384
E:\WORK\xx\tests\Controller\SecurityControllerTest.php:40

My test file code:

    public function testLogout() {
        $this->client->request('GET', '/security/logout');
        $this->assertSame(Response::HTTP_FOUND, $this->client->getResponse()->getStatusCode());
        $url = self::$container->get('router')->generate('app_home', array(), false); // FALSE RETURNS FULL URL
        $this->assertTrue($this->client->getResponse()->isRedirect($url));
        $this->client->followRedirect();
        $this->assertSame(Response::HTTP_OK, $this->client->getResponse()->getStatusCode());
        $this->assertPageTitleContains('Welcome | ' . $this->getWSTitle());
    }

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.