tests/UnitTests/POData/Writers/Atom/AtomODataWriterTest.php
/**
     * test for write top level Complex property.
     */
test for write top level Complex property.
test for write top level Complex property .
public function testComplexProperty(){
        $pr1 = new ODataProperty();
    	$pr1->name = "FlatNo.";
    	$pr1->typeName = null;
    	$pr1->value = "31";
        $pr2 = new ODataProperty();
    	$pr2->name = "StreetName";
    	$pr2->typeName = null;
    	$pr2->value = "Ankur";
        $pr3 = new ODataProperty();
    	$pr3->name = "City";
    	$pr3->typeName = null;
    	$pr3->value = "Ahmedabad";
	    $propCont1 = new ODataPropertyContent();
    	$propCont1->properties = array($pr1, $pr2, $pr3);
    	$prop = new ODataProperty();
    	$prop->name = "Address";
    	$prop->typeName = "Complex.Address";
    	$prop->value = $propCont1;
    	$propCont = new ODataPropertyContent();
    	$propCont->properties = array($prop);
	    $writer = new AtomODataWriter('http://localhost/NorthWind.svc');
	    $result = $writer->write($propCont);
	    $this->assertSame($writer, $result);
	    $actual = $writer->getOutput();
    	$expected = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<d:Address m:type="Complex.Address" xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
 <d:FlatNo.>31</d:FlatNo.>
 <d:StreetName>Ankur</d:StreetName>
 <d:City>Ahmedabad</d:City>
</d:Address>';
	    $this->assertXmlStringEqualsXmlString($expected, $actual);
    }
public function testComplexProperty ( ) { $ pr1 = new ODataProperty ( ) ; $ pr1 -> name = " FlatNo. " ; $ pr1 -> typeName = null ; $ pr1 -> value = " 31 " ; $ pr2 = new ODataProperty ( ) ; $ pr2 -> name = " StreetName " ; $ pr2 -> typeName = null ; $ pr2 -> value = " Ankur " ; $ pr3 = new ODataProperty ( ) ; $ pr3 -> name = " City " ; $ pr3 -> typeName = null ; $ pr3 -> value = " Ahmedabad " ; $ propCont1 = new ODataPropertyContent ( ) ; $ propCont1 -> properties = array ( $ pr1 , $ pr2 , $ pr3 ) ; $ prop = new ODataProperty ( ) ; $ prop -> name = " Address " ; $ prop -> typeName = " Complex.Address " ; $ prop -> value = $ propCont1 ; $ propCont = new ODataPropertyContent ( ) ; $ propCont -> properties = array ( $ prop ) ; $ writer = new AtomODataWriter ( 'http://localhost/NorthWind.svc' ) ; $ result = $ writer -> write ( $ propCont ) ; $ this -> assertSame ( $ writer , $ result ) ; $ actual = $ writer -> getOutput ( ) ; $ expected = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<d:Address m:type="Complex.Address" xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
 <d:FlatNo.>31</d:FlatNo.>
 <d:StreetName>Ankur</d:StreetName>
 <d:City>Ahmedabad</d:City>
</d:Address>' ; $ this -> assertXmlStringEqualsXmlString ( $ expected , $ actual ) ; }
test for write top level Complex property.
test for write top level Complex property .