Passed
Push — master ( 9acfaa...693f5f )
by Jakub
01:54
created

CollectorTest::testStart()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 7
c 1
b 0
f 1
dl 0
loc 10
rs 10
cc 1
nc 1
nop 0
1
<?php
2
declare(strict_types=1);
3
4
namespace MyTester\CodeCoverage;
5
6
use MyTester\Attributes\TestSuite;
7
use MyTester\CodeCoverageException as Exception;
8
use MyTester\TestCase;
9
10
/**
11
 * Test suite for class Collector
12
 *
13
 * @author Jakub Konečný
14
 */
15
#[TestSuite("Code coverage collector")]
16
class CollectorTest extends TestCase
17
{
18
    public function testStart(): void
19
    {
20
        $this->assertThrowsException(function () {
21
            $collector = new Collector();
22
            $collector->start();
23
        }, Exception::class, "No code coverage engine is available.", Exception::NO_ENGINE_AVAILABLE);
24
25
        $collector = new Collector();
26
        $collector->registerEngine(new DummyEngine());
27
        $collector->start();
28
    }
29
30
    public function testFinish(): void
31
    {
32
        $this->assertThrowsException(function () {
33
            $collector = new Collector();
34
            $collector->finish();
35
        }, Exception::class, "Code coverage collector has not been started.", Exception::COLLECTOR_NOT_STARTED);
36
37
        $collector = new Collector();
38
        $collector->registerEngine(new DummyEngine());
39
        $collector->start();
40
        $result = $collector->finish();
41
        $this->assertType("array", $result);
42
    }
43
}
44