Completed
Pull Request — master (#107)
by Alex
05:30
created

TEnumTypeTypeTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testIsEDMSimpleTypeValidNonString() 0 15 2
A testIsTPropertyTypeValidNonString() 0 15 2
A testIsTPropertyTypeValidBlankString() 0 6 1
1
<?php
2
3
namespace AlgoWeb\ODataMetadata\Tests\v3\edm;
4
5
use AlgoWeb\ODataMetadata\MetadataV3\edm\TEnumTypeType;
6
use AlgoWeb\ODataMetadata\Tests\TestCase;
7
8
class TEnumTypeTypeTest extends TestCase
9
{
10
    public function testIsEDMSimpleTypeValidNonString()
11
    {
12
        $expected = "Input must be a string: AlgoWeb\\ODataMetadata\\MetadataV3\\edm\\TEnumTypeType";
13
        $actual = null;
14
15
        $type = new \DateTime();
16
        $foo = new TEnumTypeType();
17
18
        try {
19
            $foo->isEDMSimpleTypeValid($type);
20
        } catch (\InvalidArgumentException $e) {
21
            $actual = $e->getMessage();
22
        }
23
        $this->assertEquals($expected, $actual);
24
    }
25
26
    public function testIsTPropertyTypeValidNonString()
27
    {
28
        $expected = "Input must be a string: AlgoWeb\\ODataMetadata\\MetadataV3\\edm\\TEnumTypeType";
29
        $actual = null;
30
31
        $type = new \DateTime();
32
        $foo = new TEnumTypeType();
33
34
        try {
35
            $foo->isTPropertyTypeValid($type);
36
        } catch (\InvalidArgumentException $e) {
37
            $actual = $e->getMessage();
38
        }
39
        $this->assertEquals($expected, $actual);
40
    }
41
42
    public function testIsTPropertyTypeValidBlankString()
43
    {
44
        $type = " _ ";
45
        $foo = new TEnumTypeType();
46
        $this->assertFalse($foo->isTPropertyTypeValid($type));
47
    }
48
}
49