AuthBucket\Bundle\OAuth2Bundle\Tests\ResponseType\CodeResponseTypeHandlerTest::testExceptionCodeBadRedirectUri PHP Method

testExceptionCodeBadRedirectUri() public method

    public function testExceptionCodeBadRedirectUri()
    {
        $parameters = ['response_type' => 'code', 'client_id' => 'http://democlient1.com/', 'redirect_uri' => 'http://democlient1.com/wrong_uri'];
        $server = ['PHP_AUTH_USER' => 'demousername1', 'PHP_AUTH_PW' => 'demopassword1'];
        $client = $this->createClient();
        $crawler = $client->request('GET', '/api/oauth2/authorize', $parameters, [], $server);
        $this->assertSame(400, $client->getResponse()->getStatusCode());
        $this->assertNotNull(json_decode($client->getResponse()->getContent()));
        $tokenResponse = json_decode($client->getResponse()->getContent(), true);
        $this->assertSame('invalid_request', $tokenResponse['error']);
    }