Skip to content

Test coverage does not mark unserialized closures as covered #1067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
bernardwiesner opened this issue Mar 25, 2025 · 0 comments
Open

Test coverage does not mark unserialized closures as covered #1067

bernardwiesner opened this issue Mar 25, 2025 · 0 comments

Comments

@bernardwiesner
Copy link

I am using laravel's Bus batch to dispatch jobs, and they use closures that get serialized and un-serialized

https://laravel.com/docs/11.x/queues#dispatching-batches

Example:
https://github.com/laravel/framework/blob/46ac7829eba556031fa5f540f3771d52fa4117a2/src/Illuminate/Bus/PendingBatch.php#L173

    public function then($callback)
    {
        $this->options['then'][] = $callback instanceof Closure
            ? new SerializableClosure($callback)
            : $callback;

        return $this;
    }

This results in the code coverage marking the then closure as not covered. Is there any workaround to cover such code blocks that get serialized and un-serialized and then are executed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant