Completed
Push — master ( 7c0e42...8c347f )
by André
14:17
created

ValueObjectTestTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A assertPropertiesCorrect() 0 10 2
1
<?php
2
3
/**
4
 * This file is part of the eZ Publish Kernel package.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 */
9
namespace eZ\Publish\API\Repository\Tests\Values;
10
11
use eZ\Publish\API\Repository\Values\ValueObject;
12
13
trait ValueObjectTestTrait
14
{
15
    /**
16
     * Asserts that properties given in $expectedValues are correctly set in
17
     * $mockedValueObject.
18
     *
19
     * @param mixed[] $expectedValues
20
     * @param \eZ\Publish\API\Repository\Values\ValueObject $actualValueObject
21
     */
22
    public function assertPropertiesCorrect(array $expectedValues, ValueObject $actualValueObject)
23
    {
24
        foreach ($expectedValues as $propertyName => $propertyValue) {
25
            self::assertSame(
26
                $propertyValue,
27
                $actualValueObject->$propertyName,
28
                sprintf('Property %s value is incorrect', $propertyName)
29
            );
30
        }
31
    }
32
}
33