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

api-platform / core / 10014117656

19 Jul 2024 08:44PM UTC coverage: 7.856% (-56.3%) from 64.185%
10014117656

push

github

soyuka
Merge branch 'sf/remove-flag'

0 of 527 new or added lines in 83 files covered. (0.0%)

10505 existing lines in 362 files now uncovered.

12705 of 161727 relevant lines covered (7.86%)

26.85 hits per line

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

0.0
/tests/Behat/CoverageContext.php
1
<?php
2

3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <dunglas@gmail.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
declare(strict_types=1);
13

14
namespace ApiPlatform\Tests\Behat;
15

16
use Behat\Behat\Context\Context;
17
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
18
use SebastianBergmann\CodeCoverage\CodeCoverage;
19
use SebastianBergmann\CodeCoverage\Driver\Selector;
20
use SebastianBergmann\CodeCoverage\Filter;
21
use SebastianBergmann\CodeCoverage\Report\PHP;
22
use Symfony\Component\Finder\Finder;
23

24
/**
25
 * Behat coverage.
26
 *
27
 * @author eliecharra
28
 * @author Kévin Dunglas <dunglas@gmail.com>
29
 * @copyright Adapted from https://gist.github.com/eliecharra/9c8b3ba57998b50e14a6
30
 */
31
final class CoverageContext implements Context
32
{
33
    /**
34
     * @var CodeCoverage
35
     */
36
    private static $coverage;
37

38
    /**
39
     * @BeforeSuite
40
     */
41
    public static function setup(): void
42
    {
43
        $filter = new Filter();
×
NEW
44
        $finder =
×
NEW
45
            (new Finder())
×
NEW
46
            ->in(__DIR__.'/../../src')
×
NEW
47
            ->exclude([
×
NEW
48
                'src/Core/Bridge/Symfony/Maker/Resources/skeleton',
×
NEW
49
                'tests/Fixtures/app/var',
×
NEW
50
                'docs/guides',
×
NEW
51
                'docs/var',
×
NEW
52
                'src/Doctrine/Orm/Tests/var',
×
NEW
53
                'src/Doctrine/Odm/Tests/var',
×
NEW
54
            ])
×
NEW
55
            ->append([
×
NEW
56
                'tests/Fixtures/app/console',
×
NEW
57
            ])
×
NEW
58
            ->files()
×
NEW
59
            ->name('*.php');
×
60

NEW
61
        foreach ($finder as $file) {
×
NEW
62
            $filter->includeFile((string) $file);
×
63
        }
64

NEW
65
        self::$coverage = new CodeCoverage((new Selector())->forLineCoverage($filter), $filter);
×
66
    }
67

68
    /**
69
     * @AfterSuite
70
     */
71
    public static function teardown(): void
72
    {
73
        $feature = getenv('FEATURE') ?: 'behat';
×
74
        (new PHP())->process(self::$coverage, __DIR__."/../../build/coverage/coverage-$feature.cov");
×
75
    }
76

77
    /**
78
     * @BeforeScenario
79
     */
80
    public function before(BeforeScenarioScope $scope): void
81
    {
82
        self::$coverage->start("{$scope->getFeature()->getTitle()}::{$scope->getScenario()->getTitle()}");
×
83
    }
84

85
    /**
86
     * @AfterScenario
87
     */
88
    public function after(): void
89
    {
90
        self::$coverage->stop();
×
91
    }
92
}
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