Passed
Push — testing ( 57c125...199f7f )
by Hennik
03:23
created

BuilderTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 13
c 0
b 0
f 0
dl 0
loc 26
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testReturnsCorrectBlueprintForMysql() 0 11 1
A testReturnsCorrectBlueprintForPostgres() 0 11 1
1
<?php
2
3
namespace Schema;
4
5
use BaseTestCase;
6
use LaravelSpatial\MysqlConnection;
7
use LaravelSpatial\PostgresConnection;
8
use LaravelSpatial\Schema\Blueprint;
9
use LaravelSpatial\Schema\Builder;
10
use Mockery;
11
12
class BuilderTest extends BaseTestCase
13
{
14
    public function testReturnsCorrectBlueprintForMysql()
15
    {
16
        $connection = Mockery::mock(MysqlConnection::class);
17
        $connection->shouldReceive('getSchemaGrammar')->once()->andReturn(null);
18
19
        $mock = Mockery::mock(Builder::class, [$connection]);
20
        $mock->makePartial()->shouldAllowMockingProtectedMethods();
21
        $blueprint = $mock->createBlueprint('test', function() {
22
        });
23
24
        $this->assertInstanceOf(Blueprint::class, $blueprint);
25
    }
26
27
    public function testReturnsCorrectBlueprintForPostgres()
28
    {
29
        $connection = Mockery::mock(PostgresConnection::class);
30
        $connection->shouldReceive('getSchemaGrammar')->once()->andReturn(null);
31
32
        $mock = Mockery::mock(Builder::class, [$connection]);
33
        $mock->makePartial()->shouldAllowMockingProtectedMethods();
34
        $blueprint = $mock->createBlueprint('test', function() {
35
        });
36
37
        $this->assertInstanceOf(Blueprint::class, $blueprint);
38
    }
39
}
40