Fix tests for new datatypes

This commit is contained in:
Nabeel Shahzad
2018-05-03 15:36:26 -05:00
parent 23f1a8225a
commit f8965f1785
3 changed files with 10 additions and 6 deletions

View File

@@ -348,11 +348,9 @@ class AcarsTest extends TestCase
$response->assertStatus(400);
# Post an ACARS update
$acars = factory(App\Models\Acars::class)->make(
[
'id' => null,
]
)->toArray();
$acars = factory(App\Models\Acars::class)->make(['pirep_id' => $pirep_id])->toArray();
$acars = $this->transformData($acars);
$update = ['positions' => [$acars]];
$response = $this->post($uri, $update);

View File

@@ -116,9 +116,13 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
* @param array $data
* @return array
*/
protected function transformData(array $data): array
protected function transformData($data)
{
foreach($data as $key => $value) {
if(is_object($value)) {
$value = $this->transformData($value);
}
if (is_subclass_of($value, App\Interfaces\Unit::class)) {
$data[$key] = $value->__toString();
}