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

orchestral / testbench-core / 17538372481

08 Sep 2025 03:03AM UTC coverage: 92.096% (-0.4%) from 92.525%
17538372481

push

github

crynobone
Merge branch '10.x' into 11.x

37 of 45 new or added lines in 5 files covered. (82.22%)

2 existing lines in 2 files now uncovered.

1538 of 1670 relevant lines covered (92.1%)

75.87 hits per line

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

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

3
namespace Orchestra\Testbench\Bootstrap;
4

5
use Illuminate\Log\LogManager;
6
use Orchestra\Sidekick\Env;
7
use Orchestra\Testbench\Exceptions\DeprecatedException;
8

9
use function Orchestra\Sidekick\join_paths;
10

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

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

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

37
    /** {@inheritDoc} */
38
    #[\Override]
39
    protected function ensureDeprecationLoggerIsConfigured()
40
    {
41
        with(self::$app->make('config'), static function ($config) {
2✔
42
            /** @var \Illuminate\Contracts\Config\Repository $config */
43
            if ($config->get('logging.channels.deprecations')) {
2✔
UNCOV
44
                return;
×
45
            }
46

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

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

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

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

73
    /** {@inheritDoc} */
74
    #[\Override]
75
    protected function shouldIgnoreDeprecationErrors()
76
    {
77
        return ! class_exists(LogManager::class)
2✔
78
            || ! self::$app->hasBeenBootstrapped()
2✔
79
            || ! (bool) Env::get('LOG_DEPRECATIONS_WHILE_TESTING', true);
2✔
80
    }
81
}
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