tests/UnitTests/POData/Providers/Metadata/ResourceClassesTest.php
/**
     * Test ResourceAssociationType class
     * Note: ResourceAssociationType is an internal class used for metadata generation, not suppose to used by the developers 
     */
Test ResourceAssociationType class
Note: ResourceAssociationType is an internal class used for metadata generation, not suppose to used by the developers
Test ResourceAssociationType class Note : ResourceAssociationType is an internal class used for metadata generation not suppose to used by the developers
public function testResourceAssociationType()
    {
        $customerResType = $this->_getCustomerResourceType();
        $orderResType = $this->_getOrderResourceType();
        $customerReferenceProperty = new ResourceProperty('Customer', null, ResourcePropertyKind::RESOURCE_REFERENCE, $customerResType);
        $ordersReferenceSetProperty = new ResourceProperty('Orders', null, ResourcePropertyKind::RESOURCESET_REFERENCE, $orderResType);
        $customerResType->addProperty($ordersReferenceSetProperty);
        $orderResType->addProperty($customerReferenceProperty);
        $customerToOrderAssoEnd1 = new ResourceAssociationTypeEnd('Orders', $customerResType, $ordersReferenceSetProperty, $customerReferenceProperty);
        $customerToOrderAssoEnd2 = new ResourceAssociationTypeEnd('Customers', $orderResType, $customerReferenceProperty, $ordersReferenceSetProperty);
        $customerToOrderAssoType = new ResourceAssociationType('FK_Orders_Customers', 'Northwind', $customerToOrderAssoEnd1, $customerToOrderAssoEnd2);
        $this->assertEquals($customerToOrderAssoType->getName(), 'FK_Orders_Customers');
        $this->assertEquals($customerToOrderAssoType->getFullName(), 'Northwind.FK_Orders_Customers');
        $actual = $customerToOrderAssoType->getResourceAssociationTypeEnd($customerResType, $ordersReferenceSetProperty);
        $this->assertSame($customerToOrderAssoEnd1, $actual);
        $actual = $customerToOrderAssoType->getRelatedResourceAssociationSetEnd($customerResType, $ordersReferenceSetProperty);
        $this->assertSame($customerToOrderAssoEnd2, $actual);
    }
public function testResourceAssociationType ( ) { $ customerResType = $ this -> _getCustomerResourceType ( ) ; $ orderResType = $ this -> _getOrderResourceType ( ) ; $ customerReferenceProperty = new ResourceProperty ( 'Customer' , null , ResourcePropertyKind :: RESOURCE_REFERENCE , $ customerResType ) ; $ ordersReferenceSetProperty = new ResourceProperty ( 'Orders' , null , ResourcePropertyKind :: RESOURCESET_REFERENCE , $ orderResType ) ; $ customerResType -> addProperty ( $ ordersReferenceSetProperty ) ; $ orderResType -> addProperty ( $ customerReferenceProperty ) ; $ customerToOrderAssoEnd1 = new ResourceAssociationTypeEnd ( 'Orders' , $ customerResType , $ ordersReferenceSetProperty , $ customerReferenceProperty ) ; $ customerToOrderAssoEnd2 = new ResourceAssociationTypeEnd ( 'Customers' , $ orderResType , $ customerReferenceProperty , $ ordersReferenceSetProperty ) ; $ customerToOrderAssoType = new ResourceAssociationType ( 'FK_Orders_Customers' , 'Northwind' , $ customerToOrderAssoEnd1 , $ customerToOrderAssoEnd2 ) ; $ this -> assertEquals ( $ customerToOrderAssoType -> getName ( ) , 'FK_Orders_Customers' ) ; $ this -> assertEquals ( $ customerToOrderAssoType -> getFullName ( ) , 'Northwind.FK_Orders_Customers' ) ; $ actual = $ customerToOrderAssoType -> getResourceAssociationTypeEnd ( $ customerResType , $ ordersReferenceSetProperty ) ; $ this -> assertSame ( $ customerToOrderAssoEnd1 , $ actual ) ; $ actual = $ customerToOrderAssoType -> getRelatedResourceAssociationSetEnd ( $ customerResType , $ ordersReferenceSetProperty ) ; $ this -> assertSame ( $ customerToOrderAssoEnd2 , $ actual ) ; }
Test ResourceAssociationType class
 Note: ResourceAssociationType is an internal class used for metadata generation, not suppose to used by the developers
Test ResourceAssociationType class Note : ResourceAssociationType is an internal class used for metadata generation not suppose to used by the developers
//Creates a one-to-many relationship from Customer to  Order entity