3ec64c989b
* Add flight level field to PIREP field closes #401 * Default value for distance 0 closes #400 * Block airline deletion if assets exist #367 * Formatting * Move some of the base exception classes * Fix skin references to use settings table * Set default for theme name if setting is wrong
43 lines
1.0 KiB
PHP
43 lines
1.0 KiB
PHP
<?php
|
|
|
|
use App\Services\AirlineService;
|
|
|
|
class AirlineTest extends TestCase
|
|
{
|
|
protected $airlineSvc;
|
|
|
|
public function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
$this->addData('base');
|
|
|
|
$this->airlineSvc = app(AirlineService::class);
|
|
}
|
|
|
|
/**
|
|
* Try deleting an airline which has flights/other assets that exist
|
|
*/
|
|
public function testDeleteAirlineWithFlight()
|
|
{
|
|
$airline = factory(App\Models\Airline::class)->create();
|
|
factory(App\Models\Flight::class)->create([
|
|
'airline_id' => $airline->id,
|
|
]);
|
|
|
|
$this->assertFalse($this->airlineSvc->canDeleteAirline($airline));
|
|
}
|
|
|
|
/**
|
|
* Try deleting an airline with existing PIREPs
|
|
*/
|
|
public function testDeleteAirlineWithPirep()
|
|
{
|
|
$airline = factory(App\Models\Airline::class)->create();
|
|
factory(App\Models\Pirep::class)->create([
|
|
'airline_id' => $airline->id,
|
|
]);
|
|
|
|
$this->assertFalse($this->airlineSvc->canDeleteAirline($airline));
|
|
}
|
|
}
|