• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

orchestral / testbench-core / 26984816479

04 Jun 2026 11:03PM UTC coverage: 91.403% (-0.01%) from 91.413%
26984816479

push

github

web-flow
[12.x] Compatibility againsts laravel/framework#60380 (#414)

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>

12 of 17 new or added lines in 1 file covered. (70.59%)

1531 of 1675 relevant lines covered (91.4%)

78.2 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

82.14
/src/Bootstrap/HandleExceptions.php
1
<?php
2

3
namespace Orchestra\Testbench\Bootstrap;
4

5
use Illuminate\Contracts\Config\Repository as ConfigRepository;
6
use Illuminate\Log\LogManager;
7
use Orchestra\Sidekick\Env;
8
use Orchestra\Testbench\Exceptions\DeprecatedException;
9

10
use function Orchestra\Sidekick\Filesystem\join_paths;
11

12
/**
13
 * @internal
14
 */
15
final class HandleExceptions extends \Illuminate\Foundation\Bootstrap\HandleExceptions
16
{
17
    /**
18
     * {@inheritDoc}
19
     *
20
     * @throws \Orchestra\Testbench\Exceptions\DeprecatedException
21
     */
22
    #[\Override]
23
    public function handleDeprecationError($message, $file, $line, $level = E_DEPRECATED)
24
    {
25
        rescue(function () use ($message, $file, $line, $level) {
2✔
26
            parent::handleDeprecationError($message, $file, $line, $level);
2✔
27
        }, null, false);
2✔
28

29
        $testbenchConvertDeprecationsToExceptions = (bool) Env::get(
2✔
30
            'TESTBENCH_CONVERT_DEPRECATIONS_TO_EXCEPTIONS', false
2✔
31
        );
2✔
32

33
        if ($testbenchConvertDeprecationsToExceptions === true) {
2✔
34
            throw new DeprecatedException($message, $level, $file, $line);
1✔
35
        }
36
    }
37

38
    /** {@inheritDoc} */
39
    #[\Override]
40
    protected function ensureDeprecationLoggerIsConfigured(ConfigRepository $config)
41
    {
42
        if ($config->get('logging.channels.deprecations')) {
2✔
NEW
43
            return;
×
44
        }
45

46
        /** @var array{channel?: string, trace?: bool}|string|null $options */
47
        $options = $config->get('logging.deprecations');
2✔
48
        $trace = Env::get('LOG_DEPRECATIONS_TRACE', false);
2✔
49

50
        if (\is_array($options)) {
2✔
51
            $driver = $options['channel'] ?? 'null';
2✔
52
            $trace = $options['trace'] ?? true;
2✔
53
        } else {
NEW
54
            $driver = $options ?? 'null';
×
55
        }
56

57
        if ($driver === 'single') {
2✔
NEW
58
            $config->set('logging.channels.deprecations', array_merge($config->get('logging.channels.single'), [
×
NEW
59
                'path' => self::$app->storagePath(join_paths('logs', 'deprecations.log')),
×
NEW
60
            ]));
×
61
        } else {
62
            $config->set('logging.channels.deprecations', $config->get("logging.channels.{$driver}"));
2✔
63
        }
64

65
        $config->set('logging.deprecations', [
2✔
66
            'channel' => 'deprecations',
2✔
67
            'trace' => $trace,
2✔
68
        ]);
2✔
69
    }
70

71
    /** {@inheritDoc} */
72
    #[\Override]
73
    protected function shouldIgnoreDeprecationErrors()
74
    {
75
        return ! class_exists(LogManager::class)
2✔
76
            || ! self::$app->hasBeenBootstrapped()
2✔
77
            || ! (bool) Env::get('LOG_DEPRECATIONS_WHILE_TESTING', true);
2✔
78
    }
79
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc