AuthorTestCase::testLoadDefaultAuthor()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 7
rs 10
1
<?php
2
3
namespace Maestriam\Samurai\Tests\Unit\Entities\Vendor;
4
5
use Maestriam\Samurai\Entities\Author;
6
use Maestriam\Samurai\Foundation\ConfigKeeper;
7
use Maestriam\Samurai\Tests\TestCase;
8
9
/**
10
 * Testes de funcionalidades de definir/receber informações do vendor do tema
11
 */
12
class AuthorTestCase extends TestCase
13
{
14
    /**
15
     * Testa se a classe retorna as propriedades básicas do autor
16
     * com o tipo correto
17
     *
18
     * @return void
19
     */
20
    public function testAuthorProperties()
21
    {        
22
        $signture = 'Giuliano Sampaio <[email protected]>';
23
        
24
        $author = new Author();
25
26
        $author->set($signture);
27
28
        $this->assertAuthorProperties($author);
29
    }   
30
31
    /** 
32
     * Testa se consegue carregar as informações do autor definido
33
     * no arquivo de configuração do pacote
34
     *
35
     * @return void
36
     */
37
    public function testLoadDefaultAuthor()
38
    {
39
        $author = new Author();
40
        
41
        $default = $author->default();
42
43
        $this->assertDefaultAuthor($default);
44
        
45
    } 
46
47
    /**
48
     * Te
49
     *
50
     * @return void
51
     */
52
    private function assertAuthorProperties(Author $author)
53
    {
54
        $this->assertIsString($author->name());
55
        $this->assertIsString($author->email());
56
    }
57
58
    /**
59
     * Undocumented function
60
     *
61
     * @param Author $author
62
     * @return void
63
     */
64
    private function assertDefaultAuthor(Author $author)
65
    {
66
        $config = new ConfigKeeper();
67
        $default = $config->author();
68
69
        $this->assertEquals($default->name, $author->name());
70
        $this->assertEquals($default->email, $author->email());
71
    }
72
}