tests/UnitTests/POData/Writers/Atom/AtomODataWriterTest.php
/**
     * test for write top level Bag of Primitive Property.
     */
test for write top level Bag of Primitive Property.
test for write top level Bag of Primitive Property .
Public function testPrimitiveBagProperty(){ 	
    	$odataProperty = new ODataProperty ();
    	$odataBag = new ODataBagContent();
    	$odataProperty->name = 'Emails';
    	$odataProperty->typeName = 'Bag(edm.String)';
    	$odataProperty->value =  $odataBag;
    	$odataBag->propertyContents = array(
    	                              "yash_kothari@persistent.co.in",
    	                              "v-yashk@microsoft.com",
    	                              "yash2712@gmail.com",
    	                              "y2k2712@yahoo.com");
    	$propCont = new ODataPropertyContent();
    	$propCont->properties = array($odataProperty);
	   $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:Emails m:type="Bag(edm.String)" 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:element>yash_kothari@persistent.co.in</d:element>
 <d:element>v-yashk@microsoft.com</d:element>
 <d:element>yash2712@gmail.com</d:element>
 <d:element>y2k2712@yahoo.com</d:element>
</d:Emails>';
	   $this->assertXmlStringEqualsXmlString($this->removeUpdatedTags($expected), $this->removeUpdatedTags($actual));
    }
Public function testPrimitiveBagProperty ( ) { $ odataProperty = new ODataProperty ( ) ; $ odataBag = new ODataBagContent ( ) ; $ odataProperty -> name = 'Emails' ; $ odataProperty -> typeName = 'Bag(edm.String)' ; $ odataProperty -> value = $ odataBag ; $ odataBag -> propertyContents = array ( " yash_kothari@persistent.co.in " , " v-yashk@microsoft.com " , " yash2712@gmail.com " , " y2k2712@yahoo.com " ) ; $ propCont = new ODataPropertyContent ( ) ; $ propCont -> properties = array ( $ odataProperty ) ; $ 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:Emails m:type="Bag(edm.String)" 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:element>yash_kothari@persistent.co.in</d:element>
 <d:element>v-yashk@microsoft.com</d:element>
 <d:element>yash2712@gmail.com</d:element>
 <d:element>y2k2712@yahoo.com</d:element>
</d:Emails>' ; $ this -> assertXmlStringEqualsXmlString ( $ this -> removeUpdatedTags ( $ expected ) , $ this -> removeUpdatedTags ( $ actual ) ) ; }
test for write top level Bag of Primitive Property.
test for write top level Bag of Primitive Property .