File tree Expand file tree Collapse file tree 5 files changed +32
-13
lines changed
Expand file tree Collapse file tree 5 files changed +32
-13
lines changed Original file line number Diff line number Diff line change @@ -5,3 +5,4 @@ coverage.json
55bin
66.php_cs.cache
77.vscode /
8+ build /logs /*
Original file line number Diff line number Diff line change 11<?php // kahlan-config.php
22
3- use App \Kernel ;
43use Kahlan \Filter \Filters ;
4+ use Kahlan \Reporter \Coverage ;
5+ use Kahlan \Reporter \Coverage \Driver \Xdebug ;
56
6- Filters::apply ($ this , 'bootstrap ' , function ($ next ) {
7-
8- require __DIR__ . '/vendor/autoload.php ' ;
9-
10- $ root = $ this ->suite ()->root ();
11- $ root ->beforeAll (function () {
12- // allow('spl_autoload_register')->toBeCalled()->andReturn(null);
13- });
14-
15- return $ next ();
7+ Filters::apply ($ this , 'coverage ' , function ($ next ) {
8+ if (! extension_loaded ('xdebug ' )) {
9+ return ;
10+ }
1611
12+ $ reporters = $ this ->reporters ();
13+ $ coverage = new Coverage ([
14+ 'verbosity ' => $ this ->commandLine ()->get ('coverage ' ),
15+ 'driver ' => new Xdebug (),
16+ 'path ' => $ this ->commandLine ()->get ('src ' ),
17+ 'exclude ' => [
18+ 'src/HeroAutoload.php ' ,
19+ ],
20+ 'colors ' => ! $ this ->commandLine ()->get ('no-colors ' )
21+ ]);
22+ $ reporters ->add ('coverage ' , $ coverage );
1723});
Original file line number Diff line number Diff line change @@ -14,6 +14,18 @@ public static function handle(string $class)
1414 return ;
1515 }
1616
17+ if (\in_array (
18+ $ class ,
19+ [
20+ 'error_reporting ' ,
21+ 'error_get_last ' ,
22+ 'ErrorHeroModuleLogger ' ,
23+ 'ZendDeveloperTools \\ProfilerEvent ' ,
24+ ]
25+ )) {
26+ return ;
27+ }
28+
1729 throw new RuntimeException (sprintf (
1830 'class %s not found ' ,
1931 $ class
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ public function phpError(MvcEvent $e) : void
5757 {
5858 \register_shutdown_function ([$ this , 'execOnShutdown ' ]);
5959 \set_error_handler ([$ this , 'phpErrorHandler ' ]);
60- // \spl_autoload_register([HeroAutoload::class, 'handle']);
60+ \spl_autoload_register ([HeroAutoload::class, 'handle ' ]);
6161 }
6262
6363 public function exceptionError (MvcEvent $ e ) : void
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ public function phpError() : void
6161 {
6262 \register_shutdown_function ([$ this , 'execOnShutdown ' ]);
6363 \set_error_handler ([$ this , 'phpErrorHandler ' ]);
64- // \spl_autoload_register([HeroAutoload::class, 'handle']);
64+ \spl_autoload_register ([HeroAutoload::class, 'handle ' ]);
6565 }
6666
6767 /**
You can’t perform that action at this time.
0 commit comments