Completed
Branch v1 (ffe92e)
by Julián
02:44
created

ParameterTraitTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 3
c 1
b 1
f 0
lcom 1
cbo 2
dl 0
loc 33
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testDefaults() 0 5 1
A testAccessorsMutators() 0 14 1
1
<?php
2
/**
3
 * Push notification services abstraction (http://github.com/juliangut/tify)
4
 *
5
 * @link https://github.com/juliangut/tify for the canonical source repository
6
 *
7
 * @license https://github.com/juliangut/tify/blob/master/LICENSE
8
 */
9
10
namespace Jgut\Tify\Tests;
11
12
use Jgut\Tify\ParameterTrait;
13
14
/**
15
 * ParameterTrait tests.
16
 */
17
class ParameterTraitTest extends \PHPUnit_Framework_TestCase
18
{
19
    /**
20
     * @var \Jgut\Tify\ParameterTrait
21
     */
22
    protected $parameterBag;
23
24
    public function setUp()
25
    {
26
        $this->parameterBag = $this->getMockForTrait(ParameterTrait::class);
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getMockForTrait(\...\ParameterTrait::class) of type object<PHPUnit_Framework_MockObject_MockObject> is incompatible with the declared type object<Jgut\Tify\ParameterTrait> of property $parameterBag.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
27
    }
28
29
    public function testDefaults()
30
    {
31
        self::assertNull($this->parameterBag->getParameter('any_parameter'));
32
        self::assertEmpty($this->parameterBag->getParameters());
33
    }
34
35
    public function testAccessorsMutators()
36
    {
37
        $this->parameterBag->setParameter('first', true);
38
        self::assertTrue($this->parameterBag->hasParameter('first'));
39
        self::assertTrue($this->parameterBag->hasParameter('first'));
40
        self::assertCount(1, $this->parameterBag->getParameters());
41
42
        $this->parameterBag->setParameters([
43
            'second' => 'second',
44
            'third' => 'third',
45
        ]);
46
        self::assertTrue($this->parameterBag->hasParameter('second'));
47
        self::assertCount(2, $this->parameterBag->getParameters());
48
    }
49
}
50