Passed
Pull Request — master (#1)
by Harry
02:06
created

testMysqlReturnsMysqlTableDumper()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 14
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Graze\Sprout\Test\Unit\Dump;
4
5
use Graze\ParallelProcess\Pool;
6
use Graze\ParallelProcess\Table;
7
use Graze\Sprout\Config\ConnectionConfigInterface;
8
use Graze\Sprout\Dump\Mysql\MysqlTableDumper;
9
use Graze\Sprout\Dump\TableDumperFactory;
10
use Graze\Sprout\Dump\TableDumperInterface;
11
use Graze\Sprout\Test\TestCase;
12
use Mockery;
13
14
class TableDumperFactoryTest extends TestCase
15
{
16
    public function testMysqlReturnsMysqlTableDumper()
17
    {
18
        $processTable = Mockery::mock(Pool::class);
19
20
        $config = Mockery::mock(ConnectionConfigInterface::class);
21
        $config->shouldReceive('getDriver')
22
               ->andReturn('mysql');
23
24
        $dumperFactory = new TableDumperFactory($processTable);
0 ignored issues
show
Bug introduced by
$processTable of type Mockery\MockInterface is incompatible with the type Graze\ParallelProcess\Pool expected by parameter $processPool of Graze\Sprout\Dump\TableD...rFactory::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

24
        $dumperFactory = new TableDumperFactory(/** @scrutinizer ignore-type */ $processTable);
Loading history...
25
26
        $tableDumper = $dumperFactory->getDumper($config);
0 ignored issues
show
Bug introduced by
$config of type Mockery\MockInterface is incompatible with the type Graze\Sprout\Config\ConnectionConfigInterface expected by parameter $connection of Graze\Sprout\Dump\TableDumperFactory::getDumper(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

26
        $tableDumper = $dumperFactory->getDumper(/** @scrutinizer ignore-type */ $config);
Loading history...
27
28
        $this->assertInstanceOf(TableDumperInterface::class, $tableDumper);
29
        $this->assertInstanceOf(MysqlTableDumper::class, $tableDumper);
30
    }
31
32
    /**
33
     * @expectedException \InvalidArgumentException
34
     */
35
    public function testUnknownThrowsException()
36
    {
37
        $processTable = Mockery::mock(Pool::class);
38
39
        $config = Mockery::mock(ConnectionConfigInterface::class);
40
        $config->shouldReceive('getDriver')
41
               ->andReturn('pgsql');
42
43
        $dumperFactory = new TableDumperFactory($processTable);
0 ignored issues
show
Bug introduced by
$processTable of type Mockery\MockInterface is incompatible with the type Graze\ParallelProcess\Pool expected by parameter $processPool of Graze\Sprout\Dump\TableD...rFactory::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

43
        $dumperFactory = new TableDumperFactory(/** @scrutinizer ignore-type */ $processTable);
Loading history...
44
45
        $dumperFactory->getDumper($config);
0 ignored issues
show
Bug introduced by
$config of type Mockery\MockInterface is incompatible with the type Graze\Sprout\Config\ConnectionConfigInterface expected by parameter $connection of Graze\Sprout\Dump\TableDumperFactory::getDumper(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

45
        $dumperFactory->getDumper(/** @scrutinizer ignore-type */ $config);
Loading history...
46
    }
47
}
48