Skip to content

Commit 307e2da

Browse files
committed
Add acceptance, re-structure tests, add base tests and mockery module
1 parent 45943c0 commit 307e2da

36 files changed

+192
-23
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
"require-dev": {
1313
"codeception/codeception": "2.3.x-dev",
14-
"mockery/mockery": "1.0",
14+
"codeception/mockery-module": "0.2.3",
1515
"barryvdh/laravel-ide-helper": "2.4.1",
1616
"symfony/dom-crawler": "~3.0",
1717
"symfony/css-selector": "~3.0"
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
4+
/**
5+
* Inherited Methods
6+
* @method void wantToTest($text)
7+
* @method void wantTo($text)
8+
* @method void execute($callable)
9+
* @method void expectTo($prediction)
10+
* @method void expect($prediction)
11+
* @method void amGoingTo($argumentation)
12+
* @method void am($role)
13+
* @method void lookForwardTo($achieveValue)
14+
* @method void comment($description)
15+
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
16+
*
17+
* @SuppressWarnings(PHPMD)
18+
*/
19+
class AcceptanceTester extends \Codeception\Actor
20+
{
21+
use _generated\AcceptanceTesterActions;
22+
23+
/**
24+
* Define custom actions here
25+
*/
26+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
namespace Helper;
3+
4+
// here you can define custom actions
5+
// all public methods declared in helper class will be available in $I
6+
7+
class Acceptance extends \Codeception\Module
8+
{
9+
10+
}

tests/acceptance.suite.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
actor: AcceptanceTester
2+
modules:
3+
enabled:
4+
- \Helper\Acceptance

tests/acceptance/_bootstrap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?php

tests/acceptance/testLoginCept.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
$I = new AcceptanceTester($scenario);
3+
$I->wantTo('perform actions and see result');

tests/api/PostsResourceCept.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
/** @var \Codeception\Scenario $scenario */
3+
$I = new ApiTester($scenario);
4+
$I->sendPOST("/api/posts", [
5+
'title' => 'Game of Rings',
6+
'body' => 'By George Tolkien'
7+
]);
8+
$I->seeResponseCodeIs(200);
9+
$I->seeResponseIsJson();
10+
$I->seeResponseContainsJson([
11+
'title' => 'Game of Rings'
12+
]);

tests/functional.suite.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ modules:
66
- REST:
77
depends: Laravel5
88
- Laravel5:
9-
environment_file: .env.testing
9+
environment_file: .env.testing
10+
- Mockery

tests/functional/ArtisanCest.php

Lines changed: 0 additions & 14 deletions
This file was deleted.

tests/functional/ApplicationHandlerCept.php renamed to tests/functional/Cept/ApplicationHandlerCept.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
/** @var \Codeception\Scenario $scenario */
23
$I = new FunctionalTester($scenario);
34

45
$I->haveApplicationHandler(function($app) {

0 commit comments

Comments
 (0)