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

orchestral / testbench-core / 7313545426

24 Dec 2023 08:38AM UTC coverage: 91.422% (-0.007%) from 91.429%
7313545426

push

github

crynobone
wip

2 of 3 new or added lines in 1 file covered. (66.67%)

1151 of 1259 relevant lines covered (91.42%)

48.9 hits per line

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

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

37
        if ($testCase instanceof PHPUnitTestCase) {
124✔
38
            /** @phpstan-ignore-next-line */
39
            if ($testCase::usesTestingConcern(HandlesAnnotations::class)) {
120✔
40
                value($annotation);
119✔
41
            }
42

43
            /** @phpstan-ignore-next-line */
44
            if ($testCase::usesTestingConcern(HandlesAttributes::class)) {
120✔
45
                $result['attribute'] = value($attribute);
119✔
46
            }
47

48
        }
49
        
50
        /** @phpstan-ignore-next-line */
51
        if ($testCase instanceof PHPUnitTestCase && $testCase::usesTestingConcern(WithPest::class)) {
124✔
NEW
52
            $pest instanceof Closure ? value($pest, $default) : value($default);
×
53
        } else {
54
            value($default);
124✔
55
        }
56

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