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

orchestral / testbench-core / 13701481428

06 Mar 2025 02:53PM UTC coverage: 92.525% (+0.01%) from 92.514%
13701481428

Pull #325

github

web-flow
Merge 622dc7b02 into 44556c0e5
Pull Request #325: Remove deprecated `Orchestra\Testbench\Concerns\HandlesAnnotations`

1473 of 1592 relevant lines covered (92.53%)

73.33 hits per line

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

90.91
/src/Features/TestingFeature.php
1
<?php
2

3
namespace Orchestra\Testbench\Features;
4

5
use Closure;
6
use Illuminate\Support\Fluent;
7
use Orchestra\Testbench\Concerns\HandlesAnnotations;
8
use Orchestra\Testbench\Concerns\HandlesAttributes;
9
use Orchestra\Testbench\Pest\WithPest;
10
use PHPUnit\Framework\TestCase as PHPUnitTestCase;
11

12
use function Orchestra\Sidekick\once;
13

14
/**
15
 * @internal
16
 */
17
final class TestingFeature
18
{
19
    /**
20
     * Resolve available testing features for Testbench.
21
     *
22
     * @param  object  $testCase
23
     * @param  (\Closure():(void))|null  $default
24
     * @param  (\Closure():(mixed))|null  $attribute
25
     * @param  (\Closure(\Closure|null):(mixed))|null  $pest
26
     * @return \Illuminate\Support\Fluent<array-key, mixed>
27
     */
28
    public static function run(
29
        object $testCase,
30
        ?Closure $default = null,
31
        ?Closure $attribute = null,
32
        ?Closure $pest = null
33
    ): Fluent {
34
        /** @var \Illuminate\Support\Fluent<string, \Orchestra\Testbench\Features\FeaturesCollection> $result */
35
        $result = new Fluent(['attribute' => new FeaturesCollection]);
190✔
36

37
        $defaultResolver = once($default);
190✔
38

39
        if ($testCase instanceof PHPUnitTestCase) {
190✔
40
            /** @phpstan-ignore staticMethod.notFound */
41
            if ($testCase::usesTestingConcern(HandlesAttributes::class)) {
186✔
42
                $result['attribute'] = value($attribute, $defaultResolver);
185✔
43
            }
44
        }
45

46
        if (
47
            $testCase instanceof PHPUnitTestCase
190✔
48
            && $pest instanceof Closure
190✔
49
            && $testCase::usesTestingConcern(WithPest::class) /** @phpstan-ignore staticMethod.notFound, class.notFound */
190✔
50
        ) {
51
            value($pest, $defaultResolver);
×
52
        }
53

54
        $defaultResolver();
190✔
55

56
        return $result;
190✔
57
    }
58
}
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