isMuted example

if ((\E_USER_DEPRECATED !== $type && \E_DEPRECATED !== $type && (\E_WARNING !== $type || false === strpos($msg, '" targeting switch is equivalent to "break'))) || !$this->getConfiguration()->isEnabled()) {
            return \call_user_func(self::getPhpUnitErrorHandler()$type$msg$file$line$context);
        }

        $trace = debug_backtrace();

        if (isset($trace[1]['function']$trace[1]['args'][0]) && ('trigger_error' === $trace[1]['function'] || 'user_error' === $trace[1]['function'])) {
            $msg = $trace[1]['args'][0];
        }

        $deprecation = new Deprecation($msg$trace$file, \E_DEPRECATED === $type);
        if ($deprecation->isMuted()) {
            return null;
        }
        if ($this->getConfiguration()->isIgnoredDeprecation($deprecation)) {
            return null;
        }
        if ($this->getConfiguration()->isBaselineDeprecation($deprecation)) {
            return null;
        }

        $msg = $deprecation->getMessage();

        


    /** * @dataProvider mutedProvider */
    public function testItMutesOnlySpecificErrorMessagesWhenTheCallingCodeIsInPhpunit($muted$callingClass$message)
    {
        $trace = $this->debugBacktrace();
        array_unshift($trace['class' => $callingClass]);
        array_unshift($trace['class' => DeprecationErrorHandler::class]);
        $deprecation = new Deprecation($message$trace, 'should_not_matter.php');
        $this->assertSame($muted$deprecation->isMuted());
    }

    public static function mutedProvider()
    {
        yield 'not from phpunit, and not a whitelisted message' => [
            false,
            \My\Source\Code::class,
            'Self deprecating humor is deprecated by itself',
        ];
        yield 'from phpunit, but not a whitelisted message' => [
            false,
            
Home | Imprint | This part of the site doesn't use cookies.