EntityHydratorTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 12
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testHydrate() 0 10 1
1
<?php
2
3
/**
4
 * This file is part of graze/unicontroller-client.
5
 *
6
 * Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * @license https://github.com/graze/unicontroller-client/blob/master/LICENSE.md
12
 * @link https://github.com/graze/unicontroller-client
13
 */
14
15
namespace Graze\UniControllerClient\Test\Unit;
16
17
use Mockery as m;
18
use Graze\UnicontrollerClient\Entity\EntityHydrator;
19
use Graze\UnicontrollerClient\Entity\Entity\EntityInterface;
20
21
class EntityHydratorTest extends \PHPUnit_Framework_TestCase
22
{
23
    public function testHydrate()
24
    {
25
        $entity = m::mock(EntityInterface::class);
26
        $entity->property1 = 'not hydrated';
0 ignored issues
show
Bug introduced by
Accessing property1 on the interface Mockery\MockInterface suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
27
28
        $hydrator = new EntityHydrator();
29
        $entity = $hydrator->hydrate($entity, ['property1' => 'hydrated']);
0 ignored issues
show
Bug introduced by
$entity of type Mockery\MockInterface is incompatible with the type Graze\UnicontrollerClien...\Entity\EntityInterface expected by parameter $entity of Graze\UnicontrollerClien...tityHydrator::hydrate(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

29
        $entity = $hydrator->hydrate(/** @scrutinizer ignore-type */ $entity, ['property1' => 'hydrated']);
Loading history...
30
31
        $this->assertInstanceOf(EntityInterface::class, $entity);
32
        $this->assertEquals('hydrated', $entity->property1);
0 ignored issues
show
Bug introduced by
Accessing property1 on the interface Graze\UnicontrollerClien...\Entity\EntityInterface suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
33
    }
34
}
35