AuthBucket\Bundle\OAuth2Bundle\Tests\ResponseType\TokenResponseTypeHandlerTest::testGoodToken PHP 메소드

testGoodToken() 공개 메소드

public testGoodToken ( )
    public function testGoodToken()
    {
        // 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'];
        $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());
        $parameters = ['response_type' => 'token', 'client_id' => 'http://democlient1.com/', 'redirect_uri' => 'http://democlient1.com/redirect_uri', 'scope' => 'demoscope1', '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());
        $parameters = ['response_type' => 'token', 'client_id' => 'http://democlient3.com/', 'redirect_uri' => 'http://democlient3.com/redirect_uri', 'scope' => 'demoscope1 demoscope2 demoscope3', 'state' => $session->getId()];
        $server = ['PHP_AUTH_USER' => 'demousername3', 'PHP_AUTH_PW' => 'demopassword3'];
        $client = $this->createClient();
        $crawler = $client->request('GET', '/api/oauth2/authorize', $parameters, [], $server);
        $this->assertTrue($client->getResponse()->isRedirect());
        $parameters = ['response_type' => 'token', 'client_id' => 'http://democlient3.com/', 'redirect_uri' => 'http://democlient3.com/redirect_uri', 'scope' => 'demoscope1 demoscope2 demoscope3', 'state' => $session->getId()];
        $server = ['PHP_AUTH_USER' => 'demousername3', 'PHP_AUTH_PW' => 'demopassword3'];
        $client = $this->createClient();
        $crawler = $client->request('GET', '/api/oauth2/authorize', $parameters, [], $server);
        $this->assertTrue($client->getResponse()->isRedirect());
    }