ServiceProviderTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 17
c 1
b 0
f 0
dl 0
loc 29
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A it_merges_config_and_publishes_file() 0 26 1
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\LegacyMockInterface|Mockery\MockInterface is incompatible with the type Illuminate\Contracts\Container\Container|null 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);
0 ignored issues
show
Bug introduced by
The method __construct() does not exist on Mockery\LegacyMockInterface. It seems like you code against a sub-type of Mockery\LegacyMockInterface such as Mockery\Mock. ( Ignorable by Annotation )

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

21
        $provider->/** @scrutinizer ignore-call */ 
22
                   __construct($app);
Loading history...
22
23
        $baseDir = '/some/sample/directory';
24
25
        $app->shouldReceive('configPath')->atLeast()->once()
26
            ->with('quick_migrations.php')->andReturn($baseDir.'/quick_migrations.php');
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();
0 ignored issues
show
Bug introduced by
The method register() does not exist on Mockery\LegacyMockInterface. It seems like you code against a sub-type of Mockery\LegacyMockInterface such as Mockery\Mock. ( Ignorable by Annotation )

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

38
        $provider->/** @scrutinizer ignore-call */ 
39
                   register();
Loading history...
39
        $this->assertTrue(true);
40
    }
41
}
42