KnpU\OAuth2ClientBundle\Tests\Client\OAuth2ClientTest::testGetAccessTokenFromPOST PHP Method

testGetAccessTokenFromPOST() public method

    public function testGetAccessTokenFromPOST()
    {
        $this->request->request->set('code', 'CODE_ABC');
        $expectedToken = $this->prophesize('League\\OAuth2\\Client\\Token\\AccessToken');
        $this->provider->getAccessToken('authorization_code', ['code' => 'CODE_ABC'])->willReturn($expectedToken->reveal());
        $client = new OAuth2Client($this->provider->reveal(), $this->requestStack);
        $client->setAsStateless();
        $actualToken = $client->getAccessToken();
        $this->assertSame($expectedToken->reveal(), $actualToken);
    }