AuthBucket\Bundle\OAuth2Bundle\Tests\GrantType\AuthorizationCodeGrantTypeHandlerTest::testErrorAuthCodeNoCode PHP Method

testErrorAuthCodeNoCode() public method

    public function testErrorAuthCodeNoCode()
    {
        $request = new Request();
        $parameters = ['grant_type' => 'authorization_code', 'redirect_uri' => 'http://democlient1.com/redirect_uri'];
        $server = ['PHP_AUTH_USER' => 'http://democlient1.com/', 'PHP_AUTH_PW' => 'demosecret1'];
        $client = $this->createClient();
        $crawler = $client->request('POST', '/api/oauth2/token', $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']);
    }