NameTraitTest::testNameTrait()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 26
rs 8.8571
cc 1
eloc 16
nc 1
nop 0
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\NameTraitTest
21
 *
22
 * covers Axstrad\Common\Traits\NameTrait::getName
23
 * covers Axstrad\Common\Traits\NameTrait::setName
24
 * @group unittest
25
 * @uses Axstrad\Common\Traits\NameTrait
26
 */
27
class NameTraitTest extends TraitTestCase
28
{
29
    protected $trait = 'Axstrad\Common\Traits\NameTrait';
30
31
    /**
32
     */
33
    public function testNameTrait()
34
    {
35
        $this->assertNull(
36
            $this->fixture->getName(),
37
            '$name doesn\'t start as NULL'
38
        );
39
40
        $this->assertEquals(
41
            $this->fixture,
42
            $this->fixture->setName('Bar'),
43
            'setName() didn\'t return self'
44
        );
45
46
        $this->assertEquals(
47
            'Bar',
48
            $this->fixture->getName()
49
        );
50
51
52
        $this->fixture->setName(null);
53
        $this->assertEquals(
54
            '',
55
            $this->fixture->getName(),
56
            '$name should be an empty string when null is passed'
57
        );
58
    }
59
}
60