File tree Expand file tree Collapse file tree 4 files changed +82
-0
lines changed Expand file tree Collapse file tree 4 files changed +82
-0
lines changed Original file line number Diff line number Diff line change 17
17
matrix :
18
18
- DRIVER="xdebug" DEPENDENCIES="high"
19
19
- DRIVER="phpdbg" DEPENDENCIES="high"
20
+ - DRIVER="pcov" DEPENDENCIES="high"
20
21
- DRIVER="xdebug" DEPENDENCIES="low"
21
22
- DRIVER="phpdbg" DEPENDENCIES="low"
23
+ - DRIVER="pcov" DEPENDENCIES="low"
22
24
global :
23
25
- DEFAULT_COMPOSER_FLAGS="--no-interaction --no-ansi --no-progress --no-suggest"
24
26
@@ -30,9 +32,14 @@ install:
30
32
- if [[ "$DEPENDENCIES" = 'high' ]]; then travis_retry composer update $DEFAULT_COMPOSER_FLAGS; fi
31
33
- if [[ "$DEPENDENCIES" = 'low' ]]; then travis_retry composer update $DEFAULT_COMPOSER_FLAGS --prefer-lowest; fi
32
34
35
+ before_script :
36
+ - if [[ "$DRIVER" = 'pcov' ]]; then pecl install channel://pecl.php.net/pcov-0.9.0; fi
37
+ - if [[ "$DRIVER" = 'pcov' ]]; then echo > $HOME/.phpenv/versions/$TRAVIS_PHP_VERSION/etc/conf.d/xdebug.ini; fi
38
+
33
39
script :
34
40
- if [[ "$DRIVER" = 'phpdbg' ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml; fi
35
41
- if [[ "$DRIVER" = 'xdebug' ]]; then vendor/bin/phpunit --coverage-clover=coverage.xml; fi
42
+ - if [[ "$DRIVER" = 'pcov' ]]; then vendor/bin/phpunit --coverage-clover=coverage.xml; fi
36
43
37
44
after_success :
38
45
- bash <(curl -s https://codecov.io/bash)
Original file line number Diff line number Diff line change 14
14
use PHPUnit \Util \Test ;
15
15
use SebastianBergmann \CodeCoverage \Driver \Driver ;
16
16
use SebastianBergmann \CodeCoverage \Driver \PHPDBG ;
17
+ use SebastianBergmann \CodeCoverage \Driver \PCOV ;
17
18
use SebastianBergmann \CodeCoverage \Driver \Xdebug ;
18
19
use SebastianBergmann \CodeCoverage \Node \Builder ;
19
20
use SebastianBergmann \CodeCoverage \Node \Directory ;
@@ -905,6 +906,10 @@ private function selectDriver(Filter $filter): Driver
905
906
return new Xdebug ($ filter );
906
907
}
907
908
909
+ if ($ runtime ->hasPCOV ()) {
910
+ return new PCOV ($ filter );
911
+ }
912
+
908
913
throw new RuntimeException ('No code coverage driver available ' );
909
914
}
910
915
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /*
3
+ * This file is part of the php-code-coverage package.
4
+ *
5
+ * (c) Sebastian Bergmann <[email protected] >
6
+ *
7
+ * For the full copyright and license information, please view the LICENSE
8
+ * file that was distributed with this source code.
9
+ */
10
+ namespace SebastianBergmann \CodeCoverage \Driver ;
11
+
12
+ use SebastianBergmann \CodeCoverage \RuntimeException ;
13
+ use SebastianBergmann \CodeCoverage \Filter ;
14
+
15
+ /**
16
+ * Driver for PCOV code coverage functionality.
17
+ *
18
+ * @codeCoverageIgnore
19
+ */
20
+ final class PCOV implements Driver
21
+ {
22
+ /**
23
+ * @throws RuntimeException
24
+ */
25
+ public function __construct (Filter $ filter = null )
26
+ {
27
+
28
+ }
29
+
30
+ /**
31
+ * Start collection of code coverage information.
32
+ */
33
+ public function start (bool $ determineUnusedAndDead = true ): void
34
+ {
35
+ \pcov \start ();
36
+ }
37
+
38
+ /**
39
+ * Stop collection of code coverage information.
40
+ */
41
+ public function stop (): array
42
+ {
43
+ static $ collected = [];
44
+
45
+ \pcov \stop ();
46
+
47
+ $ includes = \pcov \includes ();
48
+ $ collect = [];
49
+
50
+ if ($ collected == []) {
51
+ $ collect = \pcov \collect (
52
+ \pcov \inclusive, $ includes );
53
+ } else {
54
+ if ($ includes ) {
55
+ $ collect = \pcov \collect (
56
+ \pcov \inclusive,
57
+ \array_merge ($ collected , $ includes ));
58
+ }
59
+ }
60
+
61
+ if ($ collect != []) {
62
+ $ collected = \array_keys ($ collect );
63
+
64
+ \pcov \clear ();
65
+ }
66
+
67
+ return $ collect ;
68
+ }
69
+ }
Original file line number Diff line number Diff line change 11
11
12
12
use SebastianBergmann \CodeCoverage \Driver \Driver ;
13
13
use SebastianBergmann \CodeCoverage \Driver \PHPDBG ;
14
+ use SebastianBergmann \CodeCoverage \Driver \PCOV ;
14
15
use SebastianBergmann \CodeCoverage \Driver \Xdebug ;
15
16
use SebastianBergmann \Environment \Runtime ;
16
17
You can’t perform that action at this time.
0 commit comments