GetEnvKeyTest::testDefaultGetEnvKey()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 9
rs 10
1
<?php
2
3
namespace Maestriam\Samurai\Tests\Unit\Foundation\ConfigKeeper;
4
5
use Maestriam\Samurai\Foundation\ConfigKeeper;
6
7
/**
8
 * Testes de funcionalidades básicas apresentadas no README.md
9
 */
10
class GetEnvKeyTest extends ConfigKeeperTestCase
11
{
12
    /**
13
     * Tenta recuperar a chave que será inserida
14
     * no arquivo de ambiente
15
     *
16
     * @return void
17
     */
18
    public function testGetEnvKey()
19
    {
20
        $envkey = $this->getEnvKey();        
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $envkey is correct as $this->getEnvKey() targeting Maestriam\Samurai\Tests\...erTestCase::getEnvKey() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
21
        $config = $this->getConfigKeeper();
22
23
        $this->assertIsString($config->env());
24
        $this->assertEquals($envkey, $config->env());
25
    }
26
27
    /**
28
     * Verifica se consegue pegar env_key caso não esteja definida
29
     * no arquivo de configuração do pacote.
30
     * Por padrão, deve retornar o CURRENT_THEME
31
     *
32
     * @return void
33
     */
34
    public function testDefaultGetEnvKey()
35
    {
36
        $this->eraseEnvKey();
37
38
        $envkey = 'CURRENT_THEME';        
39
        $config = $this->getConfigKeeper();
40
41
        $this->assertIsString($config->env());
42
        $this->assertEquals($envkey, $config->env());
43
    }
44
}