Fixed broken example tests

This commit is contained in:
Alex Bilbie
2014-07-22 10:58:15 +01:00
parent f40ada9ac7
commit 7067a35d3a
22 changed files with 2160 additions and 2954 deletions

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
{
}

View File

@@ -1,4 +1,4 @@
class_name: ApiGuy
class_name: ApiTester
modules:
enabled: [PhpBrowser, REST, ApiHelper]
config:

2120
tests/api/ApiTester.php Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
<?php
$I = new ApiGuy($scenario);
$I = new ApiTester($scenario);
$I->wantTo('get all users with all fields');
$I->sendGET('api.php/users?access_token=iamgod');
$I->seeResponseCodeIs(200);

View File

@@ -1,5 +1,5 @@
<?php
$I = new ApiGuy($scenario);
$I = new ApiTester($scenario);
$I->wantTo('get all users with all basic and email fields');
$I->sendGET('api.php/users?access_token=iamphil');
$I->seeResponseCodeIs(200);

View File

@@ -1,5 +1,5 @@
<?php
$I = new ApiGuy($scenario);
$I = new ApiTester($scenario);
$I->wantTo('get all users with basic and photo fields');
$I->sendGET('api.php/users?access_token=iamalex');
$I->seeResponseCodeIs(200);

View File

@@ -1,5 +1,5 @@
<?php
$I = new ApiGuy($scenario);
$I = new ApiTester($scenario);
$I->wantTo('get all users with an invalid access token');
$I->sendGET('api.php/users?access_token=foobar');
$I->seeResponseCodeIs(401);

View File

@@ -1,5 +1,5 @@
<?php
$I = new ApiGuy($scenario);
$I = new ApiTester($scenario);
$I->wantTo('get all users without an access token');
$I->sendGET('api.php/users');
$I->seeResponseCodeIs(400);

View File

@@ -1,5 +1,5 @@
<?php
$I = new ApiGuy($scenario);
$I = new ApiTester($scenario);
$I->wantTo('get all users with header access token');
$I->haveHttpHeader('Authorization', 'Bearer iamgod');
$I->sendGET('api.php/users');

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

View File

@@ -1,18 +0,0 @@
paths:
tests: tests
log: tests/_log
data: tests/_data
helpers: tests/_helpers
settings:
bootstrap: _bootstrap.php
suite_class: \PHPUnit_Framework_TestSuite
colors: true
memory_limit: 1024M
log: true
modules:
config:
Db:
dsn: ''
user: ''
password: ''
dump: tests/_data/dump.sql

View File

@@ -1,8 +0,0 @@
<?php
namespace Codeception\Module;
// here you can define custom functions for ApiGuy
class ApiHelper extends \Codeception\Module
{
}

File diff suppressed because it is too large Load Diff

View File

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