Passed
Push — master ( cc8c81...54f85c )
by Alex
05:02
created

testEntitysAndPropertiesAndNavigationPropertiesAndRoleDIRECTION()   C

Complexity

Conditions 12
Paths 64

Size

Total Lines 145
Code Lines 121

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 145
rs 5.034
cc 12
eloc 121
nc 64
nop 0

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace AlgoWeb\ODataMetadata\Tests;
4
5
use AlgoWeb\ODataMetadata\IsOK;
6
use AlgoWeb\ODataMetadata\MetadataManager;
7
use AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer;
8
use AlgoWeb\ODataMetadata\MetadataV3\edm\Schema;
9
use AlgoWeb\ODataMetadata\MetadataV3\edm\TAssociationType;
10
use AlgoWeb\ODataMetadata\MetadataV3\edm\TComplexTypePropertyType;
11
use AlgoWeb\ODataMetadata\MetadataV3\edm\TComplexTypeType;
12
use AlgoWeb\ODataMetadata\MetadataV3\edm\TEntityPropertyType;
13
use AlgoWeb\ODataMetadata\MetadataV3\edm\TEntityTypeType;
14
use AlgoWeb\ODataMetadata\MetadataV3\edm\TFunctionReturnTypeType;
15
use AlgoWeb\ODataMetadata\MetadataV3\edm\TFunctionType;
16
use AlgoWeb\ODataMetadata\MetadataV3\edm\TNavigationPropertyType;
17
use AlgoWeb\ODataMetadata\MetadataV3\edm\TTextType;
18
use AlgoWeb\ODataMetadata\MetadataV3\edmx\Edmx;
19
use Mockery as m;
20
21
class MetadataManagerNavigationTest extends \PHPUnit_Framework_TestCase
22
{
23
    public function testEntitysAndPropertiesAndNavigationPropertiesAndRoleDIRECTION()
24
    {
25
        $msg = null;
26
        $metadataManager = new MetadataManager();
27
        $result = null;
28
29
        list($CategoryType, $result) = $metadataManager->addEntityType("Category");
30
        $this->assertNotFalse($CategoryType, "Etype is false not type " . $metadataManager->getLastError());
31
        $metadataManager->addPropertyToEntityType($CategoryType, "CategoryID", "Int32", null, false, true, "Identity");
32
        $metadataManager->addPropertyToEntityType($CategoryType, "CategoryName", "String");
33
        $metadataManager->addPropertyToEntityType($CategoryType, "Description", "String");
34
        $metadataManager->addPropertyToEntityType($CategoryType, "Picture", "Binary");
35
        $this->assertTrue($metadataManager->getEdmx()->isOK($msg), $msg);
36
37
        list($CustomerDemographicType, $result) = $metadataManager->addEntityType("CustomerDemographic");
38
        $metadataManager->addPropertyToEntityType($CustomerDemographicType, "CustomerTypeID", "String", null, false, true);
0 ignored issues
show
Compatibility introduced by
$CustomerDemographicType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
39
        $metadataManager->addPropertyToEntityType($CustomerDemographicType, "CustomerDesc", "String");
0 ignored issues
show
Compatibility introduced by
$CustomerDemographicType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
40
        $this->assertTrue($metadataManager->getEdmx()->isOK($msg), $msg);
41
42
        list($CustomerType, $result) = $metadataManager->addEntityType("Customer");
43
        $metadataManager->addPropertyToEntityType($CustomerType, "CustomerID", "String", null, false, true);
0 ignored issues
show
Compatibility introduced by
$CustomerType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
44
        $metadataManager->addPropertyToEntityType($CustomerType, "CompanyName", "String");
0 ignored issues
show
Compatibility introduced by
$CustomerType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
45
        $metadataManager->addPropertyToEntityType($CustomerType, "ContactName", "String");
0 ignored issues
show
Compatibility introduced by
$CustomerType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
46
        $metadataManager->addPropertyToEntityType($CustomerType, "ContactTitle", "String");
0 ignored issues
show
Compatibility introduced by
$CustomerType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
47
        $metadataManager->addPropertyToEntityType($CustomerType, "Address", "String");
0 ignored issues
show
Compatibility introduced by
$CustomerType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
48
        $metadataManager->addPropertyToEntityType($CustomerType, "City", "String");
0 ignored issues
show
Compatibility introduced by
$CustomerType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
49
        $metadataManager->addPropertyToEntityType($CustomerType, "Region", "String");
0 ignored issues
show
Compatibility introduced by
$CustomerType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
50
        $metadataManager->addPropertyToEntityType($CustomerType, "PostalCode", "String");
0 ignored issues
show
Compatibility introduced by
$CustomerType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
51
        $metadataManager->addPropertyToEntityType($CustomerType, "Country", "String");
0 ignored issues
show
Compatibility introduced by
$CustomerType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
52
        $metadataManager->addPropertyToEntityType($CustomerType, "Phone", "String");
0 ignored issues
show
Compatibility introduced by
$CustomerType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
53
        $metadataManager->addPropertyToEntityType($CustomerType, "Fax", "String");
0 ignored issues
show
Compatibility introduced by
$CustomerType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
54
        $this->assertTrue($metadataManager->getEdmx()->isOK($msg), $msg);
55
56
        list($EmployeeType, $result) = $metadataManager->addEntityType("Employee");
57
        $metadataManager->addPropertyToEntityType($EmployeeType, "EmployeeID", "Int32", null, false, true, "Identity");
0 ignored issues
show
Compatibility introduced by
$EmployeeType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
58
        $metadataManager->addPropertyToEntityType($EmployeeType, "LastName", "String");
0 ignored issues
show
Compatibility introduced by
$EmployeeType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
59
        $metadataManager->addPropertyToEntityType($EmployeeType, "FirstName", "String");
0 ignored issues
show
Compatibility introduced by
$EmployeeType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
60
        $metadataManager->addPropertyToEntityType($EmployeeType, "Title", "String");
0 ignored issues
show
Compatibility introduced by
$EmployeeType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
61
        $metadataManager->addPropertyToEntityType($EmployeeType, "TitleOfCourtesy", "String");
0 ignored issues
show
Compatibility introduced by
$EmployeeType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
62
        $metadataManager->addPropertyToEntityType($EmployeeType, "BirthDate", "DateTime");
0 ignored issues
show
Compatibility introduced by
$EmployeeType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
63
        $metadataManager->addPropertyToEntityType($EmployeeType, "HireDate", "DateTime");
0 ignored issues
show
Compatibility introduced by
$EmployeeType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
64
        $metadataManager->addPropertyToEntityType($EmployeeType, "Address", "String");
0 ignored issues
show
Compatibility introduced by
$EmployeeType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
65
        $metadataManager->addPropertyToEntityType($EmployeeType, "City", "String");
0 ignored issues
show
Compatibility introduced by
$EmployeeType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
66
        $metadataManager->addPropertyToEntityType($EmployeeType, "Region", "String");
0 ignored issues
show
Compatibility introduced by
$EmployeeType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
67
        $metadataManager->addPropertyToEntityType($EmployeeType, "PostalCode", "String");
0 ignored issues
show
Compatibility introduced by
$EmployeeType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
68
        $metadataManager->addPropertyToEntityType($EmployeeType, "Country", "String");
0 ignored issues
show
Compatibility introduced by
$EmployeeType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
69
        $metadataManager->addPropertyToEntityType($EmployeeType, "HomePhone", "String");
0 ignored issues
show
Compatibility introduced by
$EmployeeType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
70
        $metadataManager->addPropertyToEntityType($EmployeeType, "Extension", "String");
0 ignored issues
show
Compatibility introduced by
$EmployeeType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
71
        $metadataManager->addPropertyToEntityType($EmployeeType, "Photo", "Binary");
0 ignored issues
show
Compatibility introduced by
$EmployeeType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
72
        $metadataManager->addPropertyToEntityType($EmployeeType, "Notes", "String");
0 ignored issues
show
Compatibility introduced by
$EmployeeType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
73
        $metadataManager->addPropertyToEntityType($EmployeeType, "ReportsTo", "Int32");
0 ignored issues
show
Compatibility introduced by
$EmployeeType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
74
        $metadataManager->addPropertyToEntityType($EmployeeType, "PhotoPath", "String");
0 ignored issues
show
Compatibility introduced by
$EmployeeType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
75
        $this->assertTrue($metadataManager->getEdmx()->isOK($msg), $msg);
76
77
        list($Order_DetailType, $result) = $metadataManager->addEntityType("Order_Detail");
78
        $metadataManager->addPropertyToEntityType($Order_DetailType, "OrderID", "Int32", null, false, true);
0 ignored issues
show
Compatibility introduced by
$Order_DetailType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
79
        $metadataManager->addPropertyToEntityType($Order_DetailType, "ProductID", "Int32", null, false, true);
0 ignored issues
show
Compatibility introduced by
$Order_DetailType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
80
        $metadataManager->addPropertyToEntityType($Order_DetailType, "UnitPrice", "Decimal");
0 ignored issues
show
Compatibility introduced by
$Order_DetailType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
81
        $metadataManager->addPropertyToEntityType($Order_DetailType, "Quantity", "Int16");
0 ignored issues
show
Compatibility introduced by
$Order_DetailType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
82
        $metadataManager->addPropertyToEntityType($Order_DetailType, "Discount", "Single");
0 ignored issues
show
Compatibility introduced by
$Order_DetailType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
83
        $this->assertTrue($metadataManager->getEdmx()->isOK($msg), $msg);
84
85
        list($OrderType, $result) = $metadataManager->addEntityType("Order");
86
        $metadataManager->addPropertyToEntityType($OrderType, "OrderID", "Int32", null, false, true, "Identity");
0 ignored issues
show
Compatibility introduced by
$OrderType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
87
        $metadataManager->addPropertyToEntityType($OrderType, "CustomerID", "String");
0 ignored issues
show
Compatibility introduced by
$OrderType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
88
        $metadataManager->addPropertyToEntityType($OrderType, "EmployeeID", "Int32");
0 ignored issues
show
Compatibility introduced by
$OrderType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
89
        $metadataManager->addPropertyToEntityType($OrderType, "OrderDate", "DateTime");
0 ignored issues
show
Compatibility introduced by
$OrderType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
90
        $metadataManager->addPropertyToEntityType($OrderType, "RequiredDate", "DateTime");
0 ignored issues
show
Compatibility introduced by
$OrderType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
91
        $metadataManager->addPropertyToEntityType($OrderType, "ShippedDate", "DateTime");
0 ignored issues
show
Compatibility introduced by
$OrderType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
92
        $metadataManager->addPropertyToEntityType($OrderType, "ShipVia", "DateTime");
0 ignored issues
show
Compatibility introduced by
$OrderType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
93
        $metadataManager->addPropertyToEntityType($OrderType, "Freight", "Decimal");
0 ignored issues
show
Compatibility introduced by
$OrderType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
94
        $metadataManager->addPropertyToEntityType($OrderType, "ShipName", "String");
0 ignored issues
show
Compatibility introduced by
$OrderType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
95
        $metadataManager->addPropertyToEntityType($OrderType, "ShipAddress", "String");
0 ignored issues
show
Compatibility introduced by
$OrderType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
96
        $metadataManager->addPropertyToEntityType($OrderType, "ShipCity", "String");
0 ignored issues
show
Compatibility introduced by
$OrderType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
97
        $metadataManager->addPropertyToEntityType($OrderType, "ShipRegion", "String");
0 ignored issues
show
Compatibility introduced by
$OrderType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
98
        $metadataManager->addPropertyToEntityType($OrderType, "ShipPostalCode", "String");
0 ignored issues
show
Compatibility introduced by
$OrderType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
99
        $metadataManager->addPropertyToEntityType($OrderType, "ShipCountry", "String");
0 ignored issues
show
Compatibility introduced by
$OrderType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
100
        $this->assertTrue($metadataManager->getEdmx()->isOK($msg), $msg);
101
102
        list($ProductType, $result) = $metadataManager->addEntityType("Product");
103
        $metadataManager->addPropertyToEntityType($ProductType, "ProductID", "Int32", null, false, true, "Identity");
0 ignored issues
show
Compatibility introduced by
$ProductType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
104
        $metadataManager->addPropertyToEntityType($ProductType, "ProductName", "String");
0 ignored issues
show
Compatibility introduced by
$ProductType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
105
        $metadataManager->addPropertyToEntityType($ProductType, "SupplierID", "Int32");
0 ignored issues
show
Compatibility introduced by
$ProductType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
106
        $metadataManager->addPropertyToEntityType($ProductType, "CategoryID", "Int32");
0 ignored issues
show
Compatibility introduced by
$ProductType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
107
        $metadataManager->addPropertyToEntityType($ProductType, "QuantityPerUnit", "String");
0 ignored issues
show
Compatibility introduced by
$ProductType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
108
        $metadataManager->addPropertyToEntityType($ProductType, "UnitPrice", "Decimal");
0 ignored issues
show
Compatibility introduced by
$ProductType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
109
        $metadataManager->addPropertyToEntityType($ProductType, "UnitsInStock", "Int16");
0 ignored issues
show
Compatibility introduced by
$ProductType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
110
        $metadataManager->addPropertyToEntityType($ProductType, "UnitsOnOrder", "Int16");
0 ignored issues
show
Compatibility introduced by
$ProductType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
111
        $metadataManager->addPropertyToEntityType($ProductType, "ReorderLevel", "Int16");
0 ignored issues
show
Compatibility introduced by
$ProductType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
112
        $metadataManager->addPropertyToEntityType($ProductType, "Discontinued", "Boolean");
0 ignored issues
show
Compatibility introduced by
$ProductType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
113
        $this->assertTrue($metadataManager->getEdmx()->isOK($msg), $msg);
114
115
        $expectedRelation = "Data.Category_Products_Product_Category";
116
        list($principalNav, ) = $metadataManager->addNavigationPropertyToEntityType(
117
            $CategoryType, "*", "Products", $ProductType, "1", "Category", ["CategoryID"], ["CategoryID"]
0 ignored issues
show
Compatibility introduced by
$ProductType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
118
        );
119
        $this->assertEquals($expectedRelation, $principalNav->getRelationship());
120
        $metadataManager->addNavigationPropertyToEntityType(
121
            $Order_DetailType, "1", "Order", $ProductType, "*", "Order_Details", ["OrderID"], ["CategoryID"]
0 ignored issues
show
Compatibility introduced by
$ProductType of type object<AlgoWeb\ODataMetadata\IsOK> is not a sub-type of object<AlgoWeb\ODataMeta...V3\edm\TEntityTypeType>. It seems like you assume a child class of the class AlgoWeb\ODataMetadata\IsOK to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
122
        );
123
//        <NavigationProperty Name="Order_Details" Relationship="NorthwindModel.FK_Order_Details_Products" ToRole="Order_Details" FromRole="Products"/>
124
125
126
        $msg = null;
127
        $edmx = $metadataManager->getEdmx();
128
        $this->assertTrue($edmx->isOK($msg), $msg);
129
        $this->assertNull($msg);
130
131
        $d = $metadataManager->getEdmxXML();
132
        $CategoryEType = null;
133
        $dom = new \DOMDocument();
134
        $dom->loadXML($d);
135
        foreach ($dom->getElementsByTagName("EntityType") as $eType) {
136
            foreach ($eType->attributes as $aType) {
137
                if ($aType->name == "Name" && $aType->value == "Category") {
138
                    $CategoryEType = $eType;
139
                }
140
            }
141
        }
142
        $this->assertNotNull($CategoryEType, "Count not find the category entity Type to get the navigation property");
143
        $this->assertEquals("Products", $CategoryEType->getElementsByTagName("NavigationProperty")[0]->getAttribute("Name"), "the product relationship was not found");
144
        $ProductRelationship = $CategoryEType->getElementsByTagName("NavigationProperty")[0]->getAttribute("Relationship");
145
        $ProductToRole = $CategoryEType->getElementsByTagName("NavigationProperty")[0]->getAttribute("ToRole");
146
        $ProductFromRole = $CategoryEType->getElementsByTagName("NavigationProperty")[0]->getAttribute("FromRole");
147
        $associationType = null;
148
        foreach ($dom->getElementsByTagName("Association") as $eType) {
149
            foreach ($eType->attributes as $aType) {
150
                if ($aType->name == "Name" && 'Data.'.$aType->value == $ProductRelationship) {
151
                    $associationType = $eType;
152
                }
153
            }
154
        }
155
        $this->assertNotNull($associationType, "count not find a matching assocation for the category");
156
        foreach ($associationType->getElementsByTagName("End") as $childNode) {
157
            if ($childNode->getAttribute("Role") == $ProductToRole) {
158
                $this->assertEquals("Data.Product", $childNode->getAttribute("Type"));
159
                $this->assertEquals("1", $childNode->getAttribute("Multiplicity"));
160
            } elseif ($childNode->getAttribute("Role") == $ProductFromRole) {
161
                $this->assertEquals("Data.Category", $childNode->getAttribute("Type"));
162
                $this->assertEquals("*", $childNode->getAttribute("Multiplicity"));
163
            } else {
164
                throw new \Exception("Some how we ended up with an end role that was not in the NavigationProperty");
165
            }
166
        }
167
    }
168
}
169