Make sure stdclass is returned in flight fields
This commit is contained in:
parent
a58237b04b
commit
0fa00206ce
@ -18,17 +18,17 @@ class Flight extends Resource
|
||||
private function setFields()
|
||||
{
|
||||
/** @var \Illuminate\Support\Collection $field_values */
|
||||
$return_values = new stdClass();
|
||||
$field_values = $this->field_values;
|
||||
if (empty($field_values) || $field_values->count() === 0) {
|
||||
return new stdClass();
|
||||
return $return_values;
|
||||
}
|
||||
|
||||
$fields = [];
|
||||
foreach ($field_values as $field) {
|
||||
$fields[$field->name] = $field->value;
|
||||
$return_values->{$field->name} = $field->value;
|
||||
}
|
||||
|
||||
return $fields;
|
||||
return $return_values;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -113,12 +113,20 @@ class FlightTest extends TestCase
|
||||
*/
|
||||
public function testSearchFlight()
|
||||
{
|
||||
/** @var \App\Models\User user */
|
||||
$this->user = factory(User::class)->create();
|
||||
$flight = $this->addFlight($this->user);
|
||||
|
||||
/** @var \App\Services\FlightService $flightSvc */
|
||||
$flightSvc = app(FlightService::class);
|
||||
$flightSvc->updateCustomFields($flight, [
|
||||
['name' => '0', 'value' => 'value'],
|
||||
]);
|
||||
|
||||
// search specifically for a flight ID
|
||||
$query = 'flight_id='.$flight->id;
|
||||
$req = $this->get('/api/flights/search?'.$query);
|
||||
$body = $req->json(['data']);
|
||||
$req->assertStatus(200);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user