8000 [FrameworkBundle] ensure TestBrowserToken::$firewallName is serialized by kbond · Pull Request #40544 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[FrameworkBundle] ensure TestBrowserToken::$firewallName is serialized #40544

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

Merged
merged 1 commit into from
Mar 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[FrameworkBundle] ensure TestBrowserToken::$firewallName is serialized
  • Loading branch information
kbond committed Mar 22, 2021
commit 8ba12ece57ad4e7c5a4de6cd4ae3d4f7b91e17d2
12 changes: 12 additions & 0 deletions src/Symfony/Bundle/FrameworkBundle/Test/TestBrowserToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,16 @@ public function getCredentials()
{
return null;
}

public function __serialize(): array
{
return [$this->firewallName, parent::__serialize()];
}

public function __unserialize(array $data): void
{
[$this->firewallName, $parentData] = $data;

parent::__unserialize($parentData);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Symfony\Bundle\FrameworkBundle\Tests\Test;

use PHPUnit\Framework\TestCase;
use Symfony\Bundle\FrameworkBundle\Test\TestBrowserToken;

final class TestBrowserTokenTest extends TestCase
{
public function testCanBeSerializedAndUnserialized()
{
$token = unserialize(serialize(new TestBrowserToken()));

$this->assertSame('main', $token->getFirewallName());
}
}
0