tests/IntegrationTests/POData/Misc/MiscTest.php
/**
     * Test content ype header for service document.
     */
Test content ype header for service document.
Test content ype header for service document .
function testContentTypeHeader_ServiceDocument()
	{
        $ch = curl_init();
        $headers = array();
        curl_setopt($ch, CURLOPT_URL, self::BASE_SERIVE_URL);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        $result = curl_exec($ch);
        $info = curl_getinfo($ch);
        curl_close($ch);
        $this->assertTrue(array_key_exists('content_type', $info));
        $this->assertEquals($info['content_type'], 'application/xml;charset=utf-8');
        $ch = curl_init();
        $headers = array();
        curl_setopt($ch, CURLOPT_URL, self::BASE_SERIVE_URL  . '?$format=json');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        $result = curl_exec($ch);
        $info = curl_getinfo($ch);
        curl_close($ch);
        $this->assertTrue(array_key_exists('content_type', $info));
        $this->assertEquals($info['content_type'], 'application/json;charset=utf-8');
	}
function testContentTypeHeader_ServiceDocument ( ) { $ ch = curl_init ( ) ; $ headers = array ( ) ; curl_setopt ( $ ch , CURLOPT_URL , self :: BASE_SERIVE_URL ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( $ ch , CURLOPT_HTTPHEADER , $ headers ) ; $ result = curl_exec ( $ ch ) ; $ info = curl_getinfo ( $ ch ) ; curl_close ( $ ch ) ; $ this -> assertTrue ( array_key_exists ( 'content_type' , $ info ) ) ; $ this -> assertEquals ( $ info [ 'content_type' ] , 'application/xml;charset=utf-8' ) ; $ ch = curl_init ( ) ; $ headers = array ( ) ; curl_setopt ( $ ch , CURLOPT_URL , self :: BASE_SERIVE_URL . '?$format=json' ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( $ ch , CURLOPT_HTTPHEADER , $ headers ) ; $ result = curl_exec ( $ ch ) ; $ info = curl_getinfo ( $ ch ) ; curl_close ( $ ch ) ; $ this -> assertTrue ( array_key_exists ( 'content_type' , $ info ) ) ; $ this -> assertEquals ( $ info [ 'content_type' ] , 'application/json;charset=utf-8' ) ; }
Test content ype header for service document.
Test content ype header for service document .
// Atom service document // JSON service document