test for multiple bids on same flight with block setting enabled

This commit is contained in:
Nabeel Shahzad
2017-12-12 17:26:27 -06:00
parent 5428f4387a
commit da5523e972
5 changed files with 42 additions and 19 deletions

View File

@@ -114,4 +114,24 @@ class FlightTest extends TestCase
$this->assertEquals(0, sizeof($body));
}
/**
*
*/
public function testMultipleBidsSingleFlight()
{
setting('bids.disable_flight_on_bid', true);
$user1 = User::find(1);
$user2 = User::find(2);
$flight_id = $this->addFlight();
$flight = Flight::find($flight_id);
# Put bid on the flight to block it off
$bid = $this->flightSvc->addBid($flight, $user1);
$bidRepeat = $this->flightSvc->addBid($flight, $user2);
$this->assertNull($bidRepeat);
}
}

View File

@@ -19,7 +19,7 @@ abstract class TestCase extends Illuminate\Foundation\Testing\TestCase
protected $connectionsToTransact = ['testing'];
protected static $auth_headers = [
'Authorization' => 'testapikey'
'Authorization' => 'testadminapikey'
];
public function __construct($name = null, array $data = [], $dataName = '') {

View File

@@ -13,19 +13,32 @@ users:
name: Admin User
email: admin@phpvms.net
password: admin
api_key: testapikey
api_key: testadminapikey
airline_id: 1
home_airport_id: KAUS
curr_airport_id: KAUS
rank_id: 1
created_at: now
updated_at: now
- id: 2
name: Test User
email: test@phpvms.net
password: test
api_key: testuserapikey
airline_id: 1
home_airport_id: KJFK
curr_airport_id: KJFK
rank_id: 1
created_at: now
updated_at: now
role_user:
- user_id: 1
role_id: 1
- user_id: 1
role_id: 2
- user_id: 2
role_id: 2
ranks:
- id: 1