ChecksSingletons::assertSingleton()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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