コード例 #1
0
 public function testGeneratesExtendedRequests()
 {
     $testConfig = $this->tokenRequestMinimal;
     $o = new OAuth2($testConfig);
     $o->setGrantType('urn:my_test_grant_type');
     $o->setExtensionParams(['my_param' => 'my_value']);
     // Generate the request and confirm that it's correct.
     $req = $o->generateCredentialsRequest();
     $this->assertInstanceOf('Psr\\Http\\Message\\RequestInterface', $req);
     $this->assertEquals('POST', $req->getMethod());
     $fields = Psr7\parse_query((string) $req->getBody());
     $this->assertEquals('my_value', $fields['my_param']);
     $this->assertEquals('urn:my_test_grant_type', $fields['grant_type']);
 }