openstackid/tests/OAuth2UserServiceApiTest.php
Sebastian Marcet 6b0d6c36af IDP Upgrade from Laravel 4.X to 5.X
In order to migrate IDP from LV 4.x to
latest LV version, following task were performed:

* Updated namespace to be complain with PSR-4
* General Refactoring: moved all DB access code
  from services to repositories.
* Migration to LV 5.X: these migration guides
  were applied
  - https://laravel.com/docs/5.3/upgrade#upgrade-5.0
  - https://laravel.com/docs/5.3/upgrade#upgrade-5.1.0
  - https://laravel.com/docs/5.3/upgrade#upgrade-5.2.0
* Improved caching: added repositories decorators
  in order to add REDIS cache to queries, entities

Change-Id: I8edf9f5fce6585129701c88bb88332f242307534
2016-11-17 18:37:40 -03:00

55 lines
1.5 KiB
PHP

<?php
use OAuth2\ResourceServer\IUserService;
/**
* Class OAuth2UserServiceApiTest
*/
class OAuth2UserServiceApiTest extends OAuth2ProtectedApiTest {
/**
* @covers OAuth2UserApiController::get()
*/
public function testGetInfo(){
$response = $this->action("GET", "Api\OAuth2\OAuth2UserApiController@me",
array(),
array(),
array(),
array(),
array("HTTP_Authorization" => " Bearer " .$this->access_token));
$this->assertResponseStatus(200);
$content = $response->getContent();
$user_info = json_decode($content);
}
public function testGetInfoCORS(){
$response = $this->action("GET", "Api\OAuth2\OAuth2UserApiController@me",
array(),
array(),
array(),
array(),
array(
"HTTP_Authorization" => " Bearer " .$this->access_token,
'HTTP_Origin' => array('www.test.com'),
'HTTP_Host' => 'local.openstackid.openstack.org',
'HTTP_Access-Control-Request-Method' => 'GET',
));
$this->assertResponseStatus(200);
$content = $response->getContent();
}
protected function getScopes()
{
$scope = array(
IUserService::UserProfileScope_Address,
IUserService::UserProfileScope_Email,
IUserService::UserProfileScope_Profile
);
return $scope;
}
}