TitleTraitTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B testTitleTrait() 0 28 1
1
<?php
2
/**
3
 * This file is part of the Axstrad library.
4
 *
5
 * (c) Dan Kempster <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @author Dan Kempster <[email protected]>
11
 * @package Axstrad\Common
12
 * @subpackage Tests
13
 */
14
namespace Axstrad\Common\Tests\Traits;
15
16
use Axstrad\Component\Test\TraitTestCase;
17
18
19
/**
20
 * Axstrad\Common\Tests\Traits\TitleTraitTest
21
 *
22
 * covers Axstrad\Common\Traits\TitleTrait::getTitle
23
 * covers Axstrad\Common\Traits\TitleTrait::setTitle
24
 * @group unittest
25
 * @uses Axstrad\Common\Traits\TitleTrait
26
 */
27
class TitleTraitTest extends TraitTestCase
28
{
29
    protected $trait = 'Axstrad\Common\Traits\NameTrait';
30
31
    /**
32
     */
33
    public function testTitleTrait()
34
    {
35
        $this->fixture = $this->getMockForTrait('Axstrad\Common\Traits\TitleTrait');
36
37
        $this->assertNull(
38
            $this->fixture->getTitle(),
39
            '$title doesn\'t start as NULL'
40
        );
41
42
        $this->assertEquals(
43
            $this->fixture,
44
            $this->fixture->setTitle('Bar'),
45
            'setTitle() didn\'t return self'
46
        );
47
48
        $this->assertEquals(
49
            'Bar',
50
            $this->fixture->getTitle()
51
        );
52
53
54
        $this->fixture->setTitle(null);
55
        $this->assertEquals(
56
            '',
57
            $this->fixture->getTitle(),
58
            '$title should be an empty string when null is passed'
59
        );
60
    }
61
}
62