list trips
add, remove flights
This commit is contained in:
14
codeception.yml
Normal file
14
codeception.yml
Normal 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
2
tests/_bootstrap.php
Executable file
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
// This is global bootstrap for autoloading
|
||||
1
tests/_data/dump.sql
Executable file
1
tests/_data/dump.sql
Executable file
@@ -0,0 +1 @@
|
||||
/* Replace this file with actual dump of your database */
|
||||
2
tests/_output/.gitignore
vendored
Executable file
2
tests/_output/.gitignore
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
26
tests/_support/AcceptanceTester.php
Executable file
26
tests/_support/AcceptanceTester.php
Executable 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
|
||||
*/
|
||||
}
|
||||
26
tests/_support/FunctionalTester.php
Executable file
26
tests/_support/FunctionalTester.php
Executable 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
|
||||
*/
|
||||
}
|
||||
10
tests/_support/Helper/Acceptance.php
Executable file
10
tests/_support/Helper/Acceptance.php
Executable 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
|
||||
{
|
||||
|
||||
}
|
||||
10
tests/_support/Helper/Functional.php
Executable file
10
tests/_support/Helper/Functional.php
Executable 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
10
tests/_support/Helper/Unit.php
Executable 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
26
tests/_support/UnitTester.php
Executable 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
2
tests/_support/_generated/.gitignore
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
12
tests/acceptance.suite.yml
Executable file
12
tests/acceptance.suite.yml
Executable 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
|
||||
2
tests/acceptance/_bootstrap.php
Executable file
2
tests/acceptance/_bootstrap.php
Executable 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
14
tests/functional.suite.yml
Executable 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
|
||||
23
tests/functional/Trips/FlightModelCest.php
Executable file
23
tests/functional/Trips/FlightModelCest.php
Executable 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();
|
||||
}
|
||||
}
|
||||
35
tests/functional/Trips/TripModelCest.php
Executable file
35
tests/functional/Trips/TripModelCest.php
Executable 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);
|
||||
}
|
||||
}
|
||||
2
tests/functional/_bootstrap.php
Executable file
2
tests/functional/_bootstrap.php
Executable 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
9
tests/unit.suite.yml
Executable 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
2
tests/unit/_bootstrap.php
Executable file
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
// Here you can initialize variables that will be available to your tests
|
||||
Reference in New Issue
Block a user