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

dg / bypass-finals / 43917424139

16 Nov 2026 05:20PM UTC coverage: 82.414% (-1.4%) from 83.835%
43917424139

Pull #82

github

web-flow
Merge 4c1a2bc49 into 295d8549a
Pull Request #82: Path masks: support '!' exceptions in denyPaths/allowPaths (#81)

12 of 13 new or added lines in 2 files covered. (92.31%)

8 existing lines in 2 files now uncovered.

239 of 290 relevant lines covered (82.41%)

0.82 hits per line

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

65.0
/src/PHPUnitExtension.php
1
<?php declare(strict_types=1);
2

3
namespace DG\BypassFinals;
4

5
use DG\BypassFinals;
6
use PHPUnit\Runner\Extension\{Extension, Facade, ParameterCollection};
7
use PHPUnit\TextUI\Configuration\Configuration;
8
use function in_array;
9

10

11
final class PHPUnitExtension implements Extension
12
{
13
        public function bootstrap(
14
                Configuration $configuration,
15
                Facade $facade,
16
                ParameterCollection $parameters,
17
        ): void
18
        {
19
                if ($parameters->has('allowPaths')) {
1 ✔
20
                        BypassFinals::allowPaths($this->parsePathList($parameters->get('allowPaths')));
1 ✔
21
                }
22

23
                if ($parameters->has('denyPaths')) {
1 ✔
24
                        BypassFinals::denyPaths($this->parsePathList($parameters->get('denyPaths')));
1 ✔
25
                }
26

27
                // registered last, so that no '!' exception from phpunit.xml can override it
28
                BypassFinals::denyPaths([
1 ✔
29
                        '*/vendor/phpunit/*',
1 ✔
30
                ]);
31

32
                $bypassReadOnly = !$parameters->has('bypassReadOnly') || $this->parseBoolean($parameters->get('bypassReadOnly'));
1 ✔
33
                $bypassFinal = !$parameters->has('bypassFinal') || $this->parseBoolean($parameters->get('bypassFinal'));
1 ✔
34
                BypassFinals::enable($bypassReadOnly, $bypassFinal);
1 ✔
35

36
                if ($parameters->has('cacheDirectory')) {
1 ✔
UNCOV
37
                        BypassFinals::setCacheDirectory($parameters->get('cacheDirectory'));
×
38
                }
39
        }
1 ✔
40

41

42
        /** @return list<string> */
43
        private function parsePathList(string $value): array
44
        {
45
                return array_values(array_filter(array_map(trim(...), explode(';', $value))));
1 ✔
46
        }
47

48

49
        private function parseBoolean(string $value): bool
50
        {
UNCOV
51
                $value = strtolower($value);
×
UNCOV
52
                if (in_array($value, ['1', 'true', 'yes'], true)) {
×
UNCOV
53
                        return true;
×
UNCOV
54
                } elseif (in_array($value, ['0', 'false', 'no'], true)) {
×
UNCOV
55
                        return false;
×
56
                } else {
UNCOV
57
                        throw new \InvalidArgumentException("Invalid boolean-like value: $value");
×
58
                }
59
        }
60
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc