TestsCommands   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getCommandTester() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ekvedaras\LaravelTestHelpers\Traits\Helpers;
6
7
use Illuminate\Console\Command;
8
use Illuminate\Foundation\Application;
9
use Symfony\Component\Console\Tester\CommandTester;
10
11
/**
12
 * Trait TestsCommands.
13
 *
14
 * @property-read Application $app
15
 */
16
trait TestsCommands
17
{
18
    /**
19
     * @param string $commandClass
20
     * @return CommandTester
21
     */
22
    protected function getCommandTester(string $commandClass): CommandTester
23
    {
24
        /** @var Command $command */
25
        $command = $this->app->make($commandClass);
26
        $command->setLaravel($this->app);
27
28
        return new CommandTester($command);
29
    }
30
}
31