ChecksSingletons   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 0
dl 0
loc 14
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A assertSingleton() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ekvedaras\LaravelTestHelpers\Traits\Helpers;
6
7
use Illuminate\Foundation\Application;
8
9
/**
10
 * Trait ChecksSingletons.
11
 *
12
 * @property-read Application $app
13
 * @method void assertSame($expected, $actual, $message = '')
14
 */
15
trait ChecksSingletons
16
{
17
    /**
18
     * @param string $class
19
     */
20
    protected function assertSingleton(string $class): void
21
    {
22
        $this->assertSame(
23
            $this->app->make($class),
24
            $this->app->make($class),
25
            $class.' must be registered as singleton'
26
        );
27
    }
28
}
29