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

orchestral / testbench-core / 14871325940

06 May 2025 10:58PM UTC coverage: 92.826% (-0.05%) from 92.875%
14871325940

push

github

crynobone
Merge branch '7.x' into 8.x

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

3 of 4 new or added lines in 2 files covered. (75.0%)

1488 of 1603 relevant lines covered (92.83%)

70.15 hits per line

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

50.0
/src/PHPUnit/TestCase.php
1
<?php
2

3
namespace Orchestra\Testbench\PHPUnit;
4

5
use Orchestra\Testbench\Concerns\HandlesAssertions;
6
use Orchestra\Testbench\Concerns\InteractsWithMockery;
7
use Orchestra\Testbench\Exceptions\DeprecatedException;
8
use Throwable;
9

10
use function Orchestra\Sidekick\phpunit_version_compare;
11

12
if (phpunit_version_compare('10.1', '>=')) {
13
    class TestCase extends \PHPUnit\Framework\TestCase
14
    {
15
        use HandlesAssertions;
16
        use InteractsWithMockery;
17

18
        /** {@inheritDoc} */
19
        #[\Override]
20
        protected function tearDown(): void
21
        {
22
            $this->tearDownTheTestEnvironmentUsingMockery();
20✔
23
        }
24

25
        /**
26
         * {@inheritDoc}
27
         *
28
         * @codeCoverageIgnore
29
         */
30
        #[\Override]
31
        protected function transformException(Throwable $error): Throwable
32
        {
33
            /** @var \Illuminate\Testing\TestResponse|null $response */
34
            $response = static::$latestResponse ?? null;
35

36
            if (! \is_null($response)) {
37
                $response->transformNotSuccessfulException($error);
38
            }
39

40
            return $error;
41
        }
42
    }
43
} else {
44
    class TestCase extends \PHPUnit\Framework\TestCase
45
    {
46
        use HandlesAssertions;
47
        use InteractsWithMockery;
48

49
        /** {@inheritDoc} */
50
        #[\Override]
51
        protected function tearDown(): void
52
        {
NEW
53
            $this->tearDownTheTestEnvironmentUsingMockery();
×
54
        }
55

56
        /**
57
         * {@inheritDoc}
58
         *
59
         * @codeCoverageIgnore
60
         */
61
        #[\Override]
62
        protected function runTest(): mixed
63
        {
64
            $result = null;
65

66
            /** @var \Illuminate\Testing\TestResponse|null $response */
67
            $response = static::$latestResponse ?? null;
68

69
            try {
70
                $result = parent::runTest();
71
            } catch (DeprecatedException $error) {
72
                throw $error;
73
            } catch (Throwable $error) {
74
                if (! \is_null($response)) {
75
                    $response->transformNotSuccessfulException($error);
76
                }
77

78
                throw $error;
79
            }
80

81
            return $result;
82
        }
83
    }
84
}
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