CurrentUser example

$this->assertSame([$user]$resolver->resolve(Request::create('/')$metadata));
    }

    public function testResolveSucceedsWithSubclassType()
    {
        $user = new InMemoryUser('username', 'password');
        $token = new UsernamePasswordToken($user, 'provider');
        $tokenStorage = new TokenStorage();
        $tokenStorage->setToken($token);

        $resolver = new UserValueResolver($tokenStorage);
        $metadata = new ArgumentMetadata('foo', InMemoryUser::class, false, false, null, false, [new CurrentUser()]);

        $this->assertSame([$user]$resolver->resolve(Request::create('/')$metadata));
    }

    public function testResolveSucceedsWithNullableParamAndNoUser()
    {
        $token = new NullToken();
        $tokenStorage = new TokenStorage();
        $tokenStorage->setToken($token);

        $resolver = new UserValueResolver($tokenStorage);
        
Home | Imprint | This part of the site doesn't use cookies.