File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -398,6 +398,29 @@ public function doNotCacheStaticAnalysis(): void
398398 $ this ->cacheDirectory = null ;
399399 }
400400
401+ /**
402+ * @throws CacheNotConfiguredException
403+ */
404+ public function warmCache (): void
405+ {
406+ if (!$ this ->cachesStaticAnalysis ()) {
407+ throw new CacheNotConfiguredException (
408+ 'The cache has not been configured using cacheStaticAnalysis() '
409+ );
410+ }
411+
412+ $ coveredFileAnalyser = $ this ->coveredFileAnalyser ();
413+ $ uncoveredFileAnalyser = $ this ->uncoveredFileAnalyser ();
414+
415+ foreach ($ this ->filter ->files () as $ file ) {
416+ /* @noinspection UnusedFunctionResultInspection */
417+ $ coveredFileAnalyser ->linesOfCodeFor ($ file );
418+
419+ /* @noinspection UnusedFunctionResultInspection */
420+ $ uncoveredFileAnalyser ->executableLinesIn ($ file );
421+ }
422+ }
423+
401424 /**
402425 * @psalm-param class-string $className
403426 */
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types=1 );
2+ /*
3+ * This file is part of phpunit/php-code-coverage.
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 ;
11+
12+ use RuntimeException ;
13+
14+ final class CacheNotConfiguredException extends RuntimeException implements Exception
15+ {
16+ }
You can’t perform that action at this time.
0 commit comments