Completed
Pull Request — master (#107)
by Alex
05:30
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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testConcurrencyModeNonString() 15 15 2
A testConcurrencyModeFixed() 7 7 1
A testConcurrencyModeNone() 7 7 1

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 View Code Duplication
class TComplexTypePropertyTypeTest extends TestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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