AuthBucket\Bundle\OAuth2Bundle\Tests\ResponseType\TokenResponseTypeHandlerTest::testErrorTokenUnauthorizedScope PHP Méthode

testErrorTokenUnauthorizedScope() public méthode

    public function testErrorTokenUnauthorizedScope()
    {
        // Start session manually.
        $session = new Session(new MockFileSessionStorage());
        $session->start();
        $parameters = ['response_type' => 'token', 'client_id' => 'http://democlient1.com/', 'redirect_uri' => 'http://democlient1.com/redirect_uri', 'scope' => 'demoscope4', 'state' => $session->getId()];
        $server = ['PHP_AUTH_USER' => 'demousername1', 'PHP_AUTH_PW' => 'demopassword1'];
        $client = $this->createClient();
        $crawler = $client->request('GET', '/api/oauth2/authorize', $parameters, [], $server);
        $this->assertTrue($client->getResponse()->isRedirect());
        $authResponse = Request::create($client->getResponse()->headers->get('Location'), 'GET');
        $tokenResponse = $authResponse->query->all();
        $this->assertSame('invalid_scope', $tokenResponse['error']);
    }