fares & aircraft fares

This commit is contained in:
Nabeel Shahzad
2017-06-10 01:50:00 -05:00
parent f4f0657cb8
commit bacc372985
7 changed files with 92 additions and 10 deletions

View File

@@ -1,33 +1,40 @@
<?php
use App\Models\Aircraft;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
class AircraftTest extends TestCase
{
protected $aircraft,
$aircraft_class;
protected $aircraft, $aircraft_class;
public function setUp() {
parent::setUp();
$this->aircraft = $this->createRepository('AircraftRepository');
$this->aircraft_class = $this->createRepository('AircraftClassRepository');
# add an aircraft_class
factory(App\Models\AircraftClass::class)->create();
}
protected function add_fares(Aircraft $aircraft) {
}
public function testAircraftClasses()
{
factory(App\Models\AircraftClass::class)->create();
# add a few fare classes
$this->aircraft->create([
'aircraft_class_id' => 1,
'icao' => 'B744',
'name' => 'Boeing 747',
'icao' => 'B777',
'name' => 'Boeing 777',
]);
$aircraft = App\Models\Aircraft::where('icao', 'B744')->first();
$this->assertEquals('B744', $aircraft->icao, 'ICAO matching');
$aircraft = Aircraft::where('icao', 'B777')->first();
$this->assertEquals('B777', $aircraft->icao, 'ICAO matching');
$this->assertEquals('H', $aircraft->class->code, 'Check belongsTo relationship');
// check to see if the fares are properly applied to this aircraft
$this->add_fares($aircraft);
}
}