list trips

add, remove flights
This commit is contained in:
Richard Morgan
2017-05-14 22:08:50 -04:00
parent 09fa83af8b
commit 42dc785735
19 changed files with 228 additions and 0 deletions

14
codeception.yml Normal file
View File

@@ -0,0 +1,14 @@
actor: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
settings:
bootstrap: _bootstrap.php
colors: true
memory_limit: 1024M
extensions:
enabled:
- Codeception\Extension\RunFailed

2
tests/_bootstrap.php Executable file
View File

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

1
tests/_data/dump.sql Executable file
View File

@@ -0,0 +1 @@
/* Replace this file with actual dump of your database */

2
tests/_output/.gitignore vendored Executable file
View File

@@ -0,0 +1,2 @@
*
!.gitignore

View File

@@ -0,0 +1,26 @@
<?php
/**
* Inherited Methods
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void execute($callable)
* @method void expectTo($prediction)
* @method void expect($prediction)
* @method void amGoingTo($argumentation)
* @method void am($role)
* @method void lookForwardTo($achieveValue)
* @method void comment($description)
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
*
* @SuppressWarnings(PHPMD)
*/
class AcceptanceTester extends \Codeception\Actor
{
use _generated\AcceptanceTesterActions;
/**
* Define custom actions here
*/
}

View File

@@ -0,0 +1,26 @@
<?php
/**
* Inherited Methods
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void execute($callable)
* @method void expectTo($prediction)
* @method void expect($prediction)
* @method void amGoingTo($argumentation)
* @method void am($role)
* @method void lookForwardTo($achieveValue)
* @method void comment($description)
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
*
* @SuppressWarnings(PHPMD)
*/
class FunctionalTester extends \Codeception\Actor
{
use _generated\FunctionalTesterActions;
/**
* Define custom actions here
*/
}

View File

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

View File

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

10
tests/_support/Helper/Unit.php Executable file
View File

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

26
tests/_support/UnitTester.php Executable file
View File

@@ -0,0 +1,26 @@
<?php
/**
* Inherited Methods
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void execute($callable)
* @method void expectTo($prediction)
* @method void expect($prediction)
* @method void amGoingTo($argumentation)
* @method void am($role)
* @method void lookForwardTo($achieveValue)
* @method void comment($description)
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
*
* @SuppressWarnings(PHPMD)
*/
class UnitTester extends \Codeception\Actor
{
use _generated\UnitTesterActions;
/**
* Define custom actions here
*/
}

2
tests/_support/_generated/.gitignore vendored Executable file
View File

@@ -0,0 +1,2 @@
*
!.gitignore

12
tests/acceptance.suite.yml Executable file
View File

@@ -0,0 +1,12 @@
# Codeception Test Suite Configuration
#
# Suite for acceptance tests.
# Perform tests in browser using the WebDriver or PhpBrowser.
# If you need both WebDriver and PHPBrowser tests - create a separate suite.
class_name: AcceptanceTester
modules:
enabled:
- PhpBrowser:
url: http://localhost/myapp
- \Helper\Acceptance

View File

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

14
tests/functional.suite.yml Executable file
View File

@@ -0,0 +1,14 @@
# Codeception Test Suite Configuration
#
# Suite for functional (integration) tests
# Emulate web requests and make application process them
# Include one of framework modules (Symfony2, Yii2, Laravel5) to use it
class_name: FunctionalTester
modules:
enabled:
# add framework module here
- \Helper\Functional
- Asserts
- Lumen:
cleanup: true

View File

@@ -0,0 +1,23 @@
<?php
namespace Trips;
use App\Libraries\Trips\Models\Flights;
use \FunctionalTester;
class FlightModelCest
{
public function _before(FunctionalTester $I)
{
}
public function _after(FunctionalTester $I)
{
}
// tests
public function canSave(FunctionalTester $I)
{
$trip = new Flights(['destination' => 'YUL']);
$trip->save();
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace Trips;
use App\Libraries\Trips\Models\Flights;
use App\Libraries\Trips\Models\Trips;
use \FunctionalTester;
class TripModelCest
{
public function _before(FunctionalTester $I)
{
}
public function _after(FunctionalTester $I)
{
}
// tests
public function canSave(FunctionalTester $I)
{
$trip = new Trips(['name' => 'My First Trip']);
$I->assertTrue($trip->save());
}
public function canSaveFlightRelation(FunctionalTester $I)
{
$flight = $I->have(Flights::class)->first();
$trip = $I->have(Trips::class)->first();
$I->assertInstanceOf(Trips::class, $trip);
$trip->flights()->attach($flight->id);
$I->assertEquals($flight->id, $trip->flights()->first()->id);
}
}

View File

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

9
tests/unit.suite.yml Executable file
View File

@@ -0,0 +1,9 @@
# Codeception Test Suite Configuration
#
# Suite for unit (internal) tests.
class_name: UnitTester
modules:
enabled:
- Asserts
- \Helper\Unit

2
tests/unit/_bootstrap.php Executable file
View File

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