tests/UnitTests/POData/Writers/Atom/AtomODataWriterTest.php
/**
	 * Test for write top level Collection of URL item.
	 */
Test for write top level Collection of URL item.
Test for write top level Collection of URL item .
public function testODataURLCollectionItem()
    {
    	$url1 = new ODataURL();
    	$url1->url = 'http://www.odata.org/developers/protocols/atom-format';
    	$url2 = new ODataURL();
    	$url2->url = 'http://www.odata.org/developers/protocols/json-format';
		$urls = new ODataURLCollection();
		$urls->urls = array($url1, $url2);
		$nextPageLink = new ODataLink ();
    	$nextPageLink->name = "Next";
    	$nextPageLink->title = "";
    	$nextPageLink->type = "";
    	$nextPageLink->url = "Next Link Url";
    	$urls->nextPageLink = $nextPageLink;
		$urls->count = 10;
	    $writer = new AtomODataWriter('http://localhost/NorthWind.svc');
		$result = $writer->write($urls);
	    $this->assertSame($writer, $result);
	    $actual = $writer->getOutput();
	    $expected = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<links xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices" 
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
 <m:count>10</m:count>
 <uri>http://www.odata.org/developers/protocols/atom-format</uri>
 <uri>http://www.odata.org/developers/protocols/json-format</uri>
 <link rel="Next" href="Next Link Url"/>
</links>';
	    $this->assertXmlStringEqualsXmlString($expected, $actual);
    }
public function testODataURLCollectionItem ( ) { $ url1 = new ODataURL ( ) ; $ url1 -> url = 'http://www.odata.org/developers/protocols/atom-format' ; $ url2 = new ODataURL ( ) ; $ url2 -> url = 'http://www.odata.org/developers/protocols/json-format' ; $ urls = new ODataURLCollection ( ) ; $ urls -> urls = array ( $ url1 , $ url2 ) ; $ nextPageLink = new ODataLink ( ) ; $ nextPageLink -> name = " Next " ; $ nextPageLink -> title = " " ; $ nextPageLink -> type = " " ; $ nextPageLink -> url = " Next Link Url " ; $ urls -> nextPageLink = $ nextPageLink ; $ urls -> count = 10 ; $ writer = new AtomODataWriter ( 'http://localhost/NorthWind.svc' ) ; $ result = $ writer -> write ( $ urls ) ; $ this -> assertSame ( $ writer , $ result ) ; $ actual = $ writer -> getOutput ( ) ; $ expected = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<links xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices" 
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
 <m:count>10</m:count>
 <uri>http://www.odata.org/developers/protocols/atom-format</uri>
 <uri>http://www.odata.org/developers/protocols/json-format</uri>
 <link rel="Next" href="Next Link Url"/>
</links>' ; $ this -> assertXmlStringEqualsXmlString ( $ expected , $ actual ) ; }
Test for write top level Collection of URL item.
Test for write top level Collection of URL item .