Skip to content
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

[8.x] Fixes attempt to log deprecations on mocks #41057

Merged
merged 1 commit into from Feb 16, 2022

Conversation

nunomaduro
Copy link
Member

@nunomaduro nunomaduro commented Feb 16, 2022

This pull request fixes an issue that may happen when testing code looks like so:

    public function test_example()
    {
        Log::spy();

        // Error: Call to a member function warning() on null
        str_contains(null, null);
    }

In other words, the framework, and the attempt to log the deprecation, tries to resolve the Log instance that is a mock in this case. Now, because in tests, we only want to raise deprecations as errors when using the withoutDeprecationHandling, we can safely disable deprecation logs on unit tests.

This needs to be included on L9 too.

Fixes #40942 (comment), and Mior's issue on Nova this morning:

Screenshot 2022-02-16 at 16 19 47

@taylorotwell taylorotwell merged commit 96bb4d4 into 8.x Feb 16, 2022
@taylorotwell taylorotwell deleted the fix/mocking-log-facade-when-deprecations-happe branch February 16, 2022 16:47
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

Successfully merging this pull request may close these issues.

None yet

2 participants