Passed
Pull Request — master (#126)
by David
05:10
created

AddTraitTest::testConstruct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace TheCodingMachine\TDBM\Utils\Annotation;
4
5
use BadMethodCallException;
6
use PHPUnit\Framework\TestCase;
7
use TheCodingMachine\TDBM\Fixtures\Traits\TestUserTrait;
8
use TheCodingMachine\TDBM\Utils\GeneratorListenerInterface;
9
10
class AddTraitTest extends TestCase
11
{
12
13
    public function testConstruct(): void
14
    {
15
        $this->expectException(BadMethodCallException::class);
16
        new AddTrait(['foo' => 'bar']);
17
    }
18
19
    public function testGetName(): void
20
    {
21
        $trait = new AddTrait(['name' => TestUserTrait::class]);
22
        $this->assertSame('\\'.TestUserTrait::class, $trait->getName());
23
    }
24
25
    public function testModifiers(): void
26
    {
27
        $trait = new AddTrait(['name' => TestUserTrait::class, 'modifiers' => ['A::foo insteadof B', 'A::bar as baz']]);
28
        $this->assertSame(['A::foo' => 'B'], $trait->getInsteadOf());
29
        $this->assertSame(['A::bar' => 'baz'], $trait->getAs());
30
    }
31
}
32