Passed
Push — master ( 59e1a5...f37dc8 )
by Christopher
05:53
created

TComplexTypePropertyTypeTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace AlgoWeb\ODataMetadata\Tests\v3\edm;
4
5
use AlgoWeb\ODataMetadata\MetadataV3\edm\TComplexTypePropertyType;
6
use AlgoWeb\ODataMetadata\Tests\TestCase;
7
8
class TComplexTypePropertyTypeTest extends TestCase
9
{
10
    public function testConcurrencyModeNonString()
11
    {
12
        $foo = new TComplexTypePropertyType();
13
14
        $mode = new \DateTime();
15
        $expected = 'Input must be a string: AlgoWeb\\ODataMetadata\\MetadataV3\\edm\\TComplexTypePropertyType';
16
        $actual = null;
17
18
        try {
19
            $foo->isTConcurrencyModeValid($mode);
20
        } catch (\InvalidArgumentException $e) {
21
            $actual = $e->getMessage();
22
        }
23
        $this->assertEquals($expected, $actual);
24
    }
25
26
    public function testConcurrencyModeFixed()
27
    {
28
        $foo = new TComplexTypePropertyType();
29
30
        $mode = 'Fixed';
31
        $this->assertTrue($foo->isTConcurrencyModeValid($mode));
32
    }
33
34
    public function testConcurrencyModeNone()
35
    {
36
        $foo = new TComplexTypePropertyType();
37
38
        $mode = 'None';
39
        $this->assertTrue($foo->isTConcurrencyModeValid($mode));
40
    }
41
}
42