Sonarqube - Not Covered By Test on Lumen

Hi,

I am using Sonarqube version 9.9.0 and it’s deployed using Docker. I am trying to increase the coverage. The following block gives error of Not covered by tests and I have already written test cases from every aspect which cover every validation error. However, the error after sonar scan still persist. Please refer to the screenshot below.

Please guide seniors, your cooperation in this regard would be highly cherished. I would really admire if someone would connect with me on Anydesk/Teamviewer.

Thanks,


Hey there.

Have you followed the documentation on importing PHP coverage?

1 Like

Use I followed the documentation the issue resolved in a middleware. However, it’s not remove the error on other controllers. I have already created test cases which cover every case of method but it’s still not working. I would be glad if you will connect with me over Anydesk/Teamviewer as it is a big blocker.

Hey there.

This is a Community Forum. If you need to continue troubleshooting, I suggest attaching more screenshots, logs, etc.

It’s not clear to me what fixed one issue that isn’t resolving it in other cases.

And, it’s important to remember that SonarQube relies entirely on the coverage reports it is being passed. If those coverage reports don’t represent the files/code as being covered, neither will SonarQube. And you’ll have to troubleshoot that with the coverage tool.

1 Like

Ok Leave that, please just tell me how should I write the unit test against the following code which will remove the red line error as shown in screenshot.

$request->merge(['user_id' => $request->user()->id]);

$validator = Validator::make( $request->all(), [ 'device_uuid' => 'required', 'platform' => 'required', 'os_version' => 'required', 'notification_token' => 'required', 'user_id' => 'required|only_numeric|exists:sensitive.users,id' ] );

Moreover, below are the logs of Sonarqube.


Hey there.

I can’t tell you how to write your unit tests – I’m sorry.