HEX
Server: Apache
System: Linux webm013.cluster123.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: lesanew (165608)
PHP: 8.3.31
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/lesanew/anestetues2/vendor/roots/acorn/tests/Bootstrap/HandleExceptionsRegistrationTest.php
<?php

use Illuminate\Config\Repository as Config;
use Illuminate\Contracts\Foundation\Application as ApplicationContract;
use Roots\Acorn\Bootstrap\HandleExceptions;
use Roots\Acorn\Tests\Test\TestCase;

use function Roots\Acorn\Tests\mock;

uses(TestCase::class);

beforeAll(function () {
    if (! defined('WP_DEBUG')) {
        define('WP_DEBUG', true);
    }
});

beforeEach(function () {
    /** @var \Mockery\MockInterface|ApplicationContract */
    $this->application = mock(ApplicationContract::class);
    $this->application
        ->shouldIgnoreMissing()
        ->shouldreceive('runningInConsole')
        ->andReturn(false);
    $this->application->config = new Config(['app' => ['debug' => true]]);
    $this->handleExceptions = new HandleExceptions;
});

it('registers error handler', function () {
    set_error_handler(null);

    $this->handleExceptions->bootstrap($this->application);

    expect(set_error_handler(null))->not()->toBeNull();
});

it('registers exception handler', function () {
    set_exception_handler(null);

    $this->handleExceptions->bootstrap($this->application);

    expect(set_exception_handler(null))->not()->toBeNull();
});

it('does not register handlers when debugging is disabled', function () {
    $this->application->config->set('app.debug', false);

    set_error_handler(null);
    set_exception_handler(null);

    $this->handleExceptions->bootstrap($this->application);

    expect(set_error_handler(null))->toBeNull();
    expect(set_exception_handler(null))->toBeNull();
});