Skip to content

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.

3 participants