Passed
Push — master ( 592fb0...67cef4 )
by Alec
01:57
created

HasTraitNameable   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 3
dl 0
loc 11
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * User: alec
4
 * Date: 04.12.18
5
 * Time: 0:02
6
 */
7
8
namespace Unit;
9
10
11
use const AlecRabbit\Constants\Accessories\DEFAULT_NAME;
12
use AlecRabbit\Traits\Nameable;
13
use PHPUnit\Framework\TestCase;
14
15
class HasTraitNameable
16
{
17
    use Nameable;
18
19
    /**
20
     * TraitsTesting constructor.
21
     * @param null $name
22
     */
23
    public function __construct($name = null)
24
    {
25
        $this->name = $this->defaultName($name);
26
    }
27
}
28
29
class NameableTest extends TestCase
30
{
31
    /** @var HasTraitNameable */
32
    private $obj;
33
34
    protected function setUp()
35
    {
36
        $this->obj = new HasTraitNameable();
37
    }
38
39
    /** @test */
40
    public function check(): void
41
    {
42
        $this->assertEquals(DEFAULT_NAME, $this->obj->getName());
43
        $this->assertInstanceOf(HasTraitNameable::class, $this->obj->setName('new'));
44
        $this->assertEquals('new', $this->obj->getName());
45
    }
46
47
}