use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Http\Firewall\ContextListener;
use Symfony\Contracts\Service\ServiceLocatorTrait;
class ContextListenerTest extends TestCase
{ public function testItRequiresContextKey() { $this->
expectException(\InvalidArgumentException::
class);
$this->
expectExceptionMessage('$contextKey must not be empty'
);
new ContextListener( $this->
createMock(TokenStorageInterface::
class),
[],
''
);
} public function testUserProvidersNeedToImplementAnInterface() { $this->
expectException(\InvalidArgumentException::
class);
$this->
expectExceptionMessage('User provider "stdClass" must implement "Symfony\Component\Security\Core\User\UserProviderInterface'
);
$this->
handleEventWithPreviousSession([new \
stdClass()]);
}