Level 4
For anyone coming across this here is a working version
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
$path = "$root/tests/files/locations-test.csv";
$original_name = 'locations-test.csv';
$file = new UploadedFile($path, $original_name, filesize($path), 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', null, true);
$user = User::find(1);
$this->actingAs($user)
->withSession(['using_company' => 1, 'using_company_name' => 'KiwiDC'])
->call('POST', '/api/v1/locations/bulk', [], [], ['excel' => $file], ['Accept' => 'application/json']);
$this->seeInDatabase('locations',
['name' => 'Phils Test', 'city' => 'Cape Town', 'company_id' => 1]);
$this->assertResponseOk();