Passed
Push — master ( 2be253...46260f )
by Jean Paul
01:26
created

StepLoaderTest::testGetExtractorNoStepName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 6
rs 10
1
<?php declare( strict_types = 1 );
2
3
namespace Coco\SourceWatcher\Tests\Core;
4
5
use Coco\SourceWatcher\Core\Extractor;
6
use Coco\SourceWatcher\Core\SourceWatcherException;
7
use Coco\SourceWatcher\Core\StepLoader;
8
use PHPUnit\Framework\TestCase;
9
10
/**
11
 * Class StepLoaderTest
12
 * @package Coco\SourceWatcher\Tests\Core
13
 */
14
class StepLoaderTest extends TestCase
15
{
16
    public function testGetExtractor () : void
17
    {
18
        try {
19
            $stepLoader = new StepLoader();
20
            $extractor = $stepLoader->getStep( Extractor::class, "csv" );
21
            $this->assertNotNull( $extractor );
22
        } catch ( SourceWatcherException $sourceWatcherException ) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
23
24
        }
25
    }
26
27
    public function testGetExtractorValidated () : void
28
    {
29
        try {
30
            $stepLoader = new StepLoader();
31
            $extractor = $stepLoader->getStep( Extractor::class, "csv" );
32
            $this->assertInstanceOf( Extractor::class, $extractor );
33
        } catch ( SourceWatcherException $sourceWatcherException ) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
34
35
        }
36
    }
37
38
    public function testGetExtractorNoParentClassName () : void
39
    {
40
        $this->expectException( SourceWatcherException::class );
41
42
        $stepLoader = new StepLoader();
43
        $stepLoader->getStep( "", "csv" );
44
    }
45
46
    public function testGetExtractorNoStepName () : void
47
    {
48
        $this->expectException( SourceWatcherException::class );
49
50
        $stepLoader = new StepLoader();
51
        $stepLoader->getStep( Extractor::class, "" );
52
    }
53
54
    public function testGetNonExistingParentStep () : void
55
    {
56
        $this->expectException( SourceWatcherException::class );
57
58
        $stepLoader = new StepLoader();
59
        $stepLoader->getStep( "Sequencer", "csv" );
60
    }
61
62
    public function testGetNonExistingStepName () : void
63
    {
64
        try {
65
            $stepLoader = new StepLoader();
66
            $extractor = $stepLoader->getStep( Extractor::class, "rainbow" );
67
            $this->assertNull( $extractor );
68
        } catch ( SourceWatcherException $sourceWatcherException ) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
69
70
        }
71
    }
72
}
73