Passed
Push — master ( ed297f...604ea4 )
by Giuliano
04:39
created

UseThemeCommandTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testMakeValidTheme() 0 14 1
A getSuccessMessage() 0 3 1
1
<?php
2
3
namespace Maestriam\Samurai\Tests\Feature\Console;
4
5
use Maestriam\Samurai\Support\Samurai;
6
use Maestriam\Samurai\Tests\TestCase;
7
8
class UseThemeCommandTest extends TestCase
9
{    
10
    public function testMakeValidTheme()
11
    {
12
        $theme = $this->theme('bands/saxon')->findOrCreate();
13
        $cmd = sprintf("samurai:use %s", $theme->package());
14
        
15
        $message = $this->getSuccessMessage($theme->package());
16
17
        $this->artisan($cmd)
18
             ->assertExitCode(0)
19
             ->expectsOutput($message);
20
21
        $current = Samurai::base()->current();
0 ignored issues
show
Bug introduced by
The method base() does not exist on Maestriam\Samurai\Support\Samurai. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

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

21
        $current = Samurai::/** @scrutinizer ignore-call */ base()->current();
Loading history...
22
        
23
        $this->assertEquals($current->package(), $theme->package());
24
    }
25
26
    public function getSuccessMessage(string $name) : string
27
    {
28
        return sprintf('Theme [%s] is current and ready to use.', $name);
29
    }
30
31
}