Passed
Push — master ( 8b76af...5f66ea )
by Marcin
03:35
created

it_merges_config_and_publishes_file()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 16
nc 1
nop 0
dl 0
loc 26
rs 9.7333
c 0
b 0
f 0
1
<?php
2
3
namespace Mnabialek\LaravelQuickMigrations\Tests\Providers;
4
5
use ArrayAccess;
6
use Illuminate\Container\Container;
7
use Mnabialek\LaravelQuickMigrations\Providers\ServiceProvider;
8
use Mnabialek\LaravelQuickMigrations\Tests\UnitTestCase;
9
use Mockery;
10
11
class ServiceProviderTest extends UnitTestCase
12
{
13
    /** @test */
14
    public function it_merges_config_and_publishes_file()
15
    {
16
        $app = Mockery::mock(Container::class, ArrayAccess::class);
17
        Container::setInstance($app);
0 ignored issues
show
Bug introduced by
$app of type Mockery\MockInterface is incompatible with the type null|Illuminate\Contracts\Container\Container expected by parameter $container of Illuminate\Container\Container::setInstance(). ( Ignorable by Annotation )

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

17
        Container::setInstance(/** @scrutinizer ignore-type */ $app);
Loading history...
18
19
        $provider = Mockery::mock(ServiceProvider::class)->makePartial()
20
            ->shouldAllowMockingProtectedMethods();
21
        $provider->__construct($app);
22
23
        $baseDir = '/some/sample/directory';
24
25
        $app->shouldReceive('make')->atLeast()->once()
26
            ->with('path.config')->andReturn($baseDir);
27
28
        $configFile = realpath(__DIR__ . '/../../publish/config/quick_migrations.php');
29
        $provider->shouldReceive('mergeConfigFrom')->once()->with(
30
            $configFile,
31
            'quick_migrations'
32
        );
33
34
        $provider->shouldReceive('publishes')->once()->with(
35
            [$configFile => config_path('quick_migrations.php')]
36
        );
37
38
        $provider->register();
39
        $this->assertTrue(true);
40
    }
41
}
42