* Make sure proper subfleets are returned as part of the user profile #848 * Formatting
This commit is contained in:
@@ -85,6 +85,8 @@ class UserTest extends TestCase
|
||||
/**
|
||||
* Flip the setting for getting all of the user's aircraft restricted
|
||||
* by rank. Make sure that they're all returned
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function testGetAllAircraft()
|
||||
{
|
||||
@@ -135,7 +137,7 @@ class UserTest extends TestCase
|
||||
$this->assertEquals($subfleetACalled->fares[0]['capacity'], $overrides['capacity']);
|
||||
|
||||
/**
|
||||
* Check via API
|
||||
* Check via API, but should only show the single subfleet being returned
|
||||
*/
|
||||
$this->settingsRepo->store('pireps.restrict_aircraft_to_rank', true);
|
||||
|
||||
@@ -146,6 +148,18 @@ class UserTest extends TestCase
|
||||
$subfleetAFromApi = collect($body)->firstWhere('id', $subfleetA['subfleet']->id);
|
||||
$this->assertEquals($subfleetAFromApi['fares'][0]['price'], $overrides['price']);
|
||||
$this->assertEquals($subfleetAFromApi['fares'][0]['capacity'], $overrides['capacity']);
|
||||
|
||||
// Read the user's profile and make sure that subfleet C is not part of this
|
||||
// Should only return a single subfleet (subfleet A)
|
||||
$resp = $this->get('/api/user', [], $user);
|
||||
$resp->assertStatus(200);
|
||||
|
||||
$body = $resp->json('data');
|
||||
$subfleets = $body['rank']['subfleets'];
|
||||
|
||||
$this->assertEquals(1, count($subfleets));
|
||||
$this->assertEquals($subfleets[0]['fares'][0]['price'], $overrides['price']);
|
||||
$this->assertEquals($subfleets[0]['fares'][0]['capacity'], $overrides['capacity']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user