First commit of Codeception files

This commit is contained in:
Alex Bilbie 2015-04-05 17:05:49 +01:00
parent 1e39f1d84a
commit 7a3670523d
9 changed files with 2439 additions and 0 deletions

10
codeception.yml Normal file
View File

@ -0,0 +1,10 @@
actor: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
helpers: tests/_support
settings:
bootstrap: _bootstrap.php
colors: true
memory_limit: 1024M

2
tests/_bootstrap.php Normal file
View File

@ -0,0 +1,2 @@
<?php
// This is global bootstrap for autoloading

0
tests/_output/.gitignore vendored Normal file
View File

View File

@ -0,0 +1 @@
{"error":{"message":"The requested scope is invalid, unknown, or malformed. Check the \"basic\" scope.","trace":["#0 \/Users\/alexbilbie\/Projects\/oauth2-server\/src\/Grant\/ClientCredentialsGrant.php(77): League\\OAuth2\\Server\\Grant\\AbstractGrant->validateScopes('basic', Object(League\\OAuth2\\Server\\Entities\\ClientEntity))","#1 \/Users\/alexbilbie\/Projects\/oauth2-server\/src\/Server.php(117): League\\OAuth2\\Server\\Grant\\ClientCredentialsGrant->getAccessTokenAsType(Object(Symfony\\Component\\HttpFoundation\\Request), Object(League\\OAuth2\\Server\\ResponseTypes\\BearerTokenResponseType), Object(DateInterval))","#2 \/Users\/alexbilbie\/Projects\/oauth2-server\/examples\/client-credentials\/index.php(19): League\\OAuth2\\Server\\Server->getAccessTokenResponse(Object(Symfony\\Component\\HttpFoundation\\Request))","#3 [internal function]: {closure}(Object(Symfony\\Component\\HttpFoundation\\Request), Object(Symfony\\Component\\HttpFoundation\\Response), Array)","#4 \/Users\/alexbilbie\/Projects\/oauth2-server\/examples\/vendor\/league\/route\/src\/Strategy\/AbstractStrategy.php(55): call_user_func_array(Object(Closure), Array)","#5 \/Users\/alexbilbie\/Projects\/oauth2-server\/examples\/vendor\/league\/route\/src\/Strategy\/RequestResponseStrategy.php(19): League\\Route\\Strategy\\AbstractStrategy->invokeController(Object(Closure), Array)","#6 \/Users\/alexbilbie\/Projects\/oauth2-server\/examples\/vendor\/league\/route\/src\/Dispatcher.php(112): League\\Route\\Strategy\\RequestResponseStrategy->dispatch(Object(Closure), Array)","#7 \/Users\/alexbilbie\/Projects\/oauth2-server\/examples\/vendor\/league\/route\/src\/Dispatcher.php(73): League\\Route\\Dispatcher->handleFound(Object(Closure), Object(League\\Route\\Strategy\\RequestResponseStrategy), Array)","#8 \/Users\/alexbilbie\/Projects\/oauth2-server\/examples\/vendor\/alexbilbie\/proton\/src\/Application.php(251): League\\Route\\Dispatcher->dispatch('POST', '\/access_token')","#9 \/Users\/alexbilbie\/Projects\/oauth2-server\/examples\/vendor\/alexbilbie\/proton\/src\/Application.php(300): Proton\\Application->handle(Object(Symfony\\Component\\HttpFoundation\\Request))","#10 \/Users\/alexbilbie\/Projects\/oauth2-server\/examples\/client-credentials\/index.php(23): Proton\\Application->run()","#11 {main}"]}}

View File

@ -0,0 +1,10 @@
<?php
namespace Codeception\Module;
// here you can define custom actions
// all public methods declared in helper class will be available in $I
class ApiHelper extends \Codeception\Module
{
}

8
tests/api.suite.yml Normal file
View File

@ -0,0 +1,8 @@
class_name: ApiTester
modules:
enabled: [PhpBrowser, REST]
config:
PhpBrowser:
url: 'http://localhost:7777/'
REST:
url: 'http://localhost:7777/'

2389
tests/api/ApiTester.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
<?php
$I = new ApiTester($scenario);
$I->wantTo('get an access token using the client credentials grant');
$I->sendPOST(
'access_token',
[
'grant_type' => 'client_credentials',
'client_id' => 'myawesomeapp',
'client_secret' => 'abc123',
'scope' => 'basic'
]
);
$I->canSeeResponseCodeIs(200);
$I->canSeeResponseIsJson();
$I->seeResponseJsonMatchesJsonPath('$.token_type');
$I->seeResponseJsonMatchesJsonPath('$.expires_in');
$I->seeResponseJsonMatchesJsonPath('$.access_token');

2
tests/api/_bootstrap.php Normal file
View File

@ -0,0 +1,2 @@
<?php
// Here you can initialize variables that will be available to your tests