user = factory(User::class)->create(); } public function testVerification() { $response = $this->json('POST', '/api/send-verification', ['phone' => '0123456789']); $response ->assertStatus(200) ->assertJson([ 'success' => true, ]); $response = $this->json('POST', '/api/verify', ['phone' => '0123456789', 'token' => '1234']); $response ->assertStatus(200) ->assertJson([ 'success' => true, ]); $token = $response->json()['token']; } public function testUpdateFFUser() { $this->actingAs($this->user) ->patchJson('/api/user', [ 'freightforwarder', 'password' => 'updated', 'password_confirmation' => 'updated', ]) ->assertSuccessful(); } public function testUpdateImporterUser() { $this->actingAs($this->user) ->patchJson('/api/user', [ 'importer', 'password' => 'updated', 'password_confirmation' => 'updated', ]) ->assertSuccessful(); } }