tests/UnitTests/POData/UriProcessor/UriProcessorTest.php
/**
     * Test with request uri where TargetKind is NONE. TargetKind will be
     * NONE for service directory, metadata and batch.
     */
Test with request uri where TargetKind is NONE. TargetKind will be
NONE for service directory, metadata and batch.
Test with request uri where TargetKind is NONE . TargetKind will be NONE for service directory metadata and batch .
public function testUriProcessorWithRequestUriOfNoneTargetSourceKind()
    {
        $hostInfo = array(
            'AbsoluteRequestUri' => new Url('http://localhost:8083/NorthWindDataService.svc'),
            'AbsoluteServiceUri' => new Url('http://localhost:8083/NorthWindDataService.svc'),
            'QueryString' => null
        );
        $host = new ServiceHostTestFake($hostInfo);
        $dataService = new NorthWindService2();
        $dataService->setHost($host);
        $uriProcessor = $dataService->handleRequest();
        $requestDescription = $uriProcessor->getRequest();
        $this->assertEquals($requestDescription->getTargetSource(), TargetSource::NONE);
        $this->assertEquals($requestDescription->getTargetKind(), TargetKind::SERVICE_DIRECTORY());
        $hostInfo = array(
            'AbsoluteRequestUri' => new Url('http://localhost:8083/NorthWindDataService.svc/$metadata'),
            'AbsoluteServiceUri' => new Url('http://localhost:8083/NorthWindDataService.svc'),
            'QueryString' => null
        );
        $host = new ServiceHostTestFake($hostInfo);
        $dataService = new NorthWindService2();
        $dataService->setHost($host);
        $uriProcessor = $dataService->handleRequest();
        $requestDescription = $uriProcessor->getRequest();
        $this->assertEquals($requestDescription->getTargetSource(), TargetSource::NONE);
        $this->assertEquals($requestDescription->getTargetKind(), TargetKind::METADATA());
        $hostInfo = array(
            'AbsoluteRequestUri' => new Url('http://localhost:8083/NorthWindDataService.svc/$batch'),
            'AbsoluteServiceUri' => new Url('http://localhost:8083/NorthWindDataService.svc'),
            'QueryString' => null
        );
        $host = new ServiceHostTestFake($hostInfo);
        $dataService = new NorthWindService2();
        $dataService->setHost($host);
        $uriProcessor = $dataService->handleRequest();
        $requestDescription = $uriProcessor->getRequest();
        $this->assertEquals($requestDescription->getTargetSource(), TargetSource::NONE);
        $this->assertEquals($requestDescription->getTargetKind(), TargetKind::BATCH());
    }
public function testUriProcessorWithRequestUriOfNoneTargetSourceKind ( ) { $ hostInfo = array ( 'AbsoluteRequestUri' => new Url ( 'http://localhost:8083/NorthWindDataService.svc' ) , 'AbsoluteServiceUri' => new Url ( 'http://localhost:8083/NorthWindDataService.svc' ) , 'QueryString' => null ) ; $ host = new ServiceHostTestFake ( $ hostInfo ) ; $ dataService = new NorthWindService2 ( ) ; $ dataService -> setHost ( $ host ) ; $ uriProcessor = $ dataService -> handleRequest ( ) ; $ requestDescription = $ uriProcessor -> getRequest ( ) ; $ this -> assertEquals ( $ requestDescription -> getTargetSource ( ) , TargetSource :: NONE ) ; $ this -> assertEquals ( $ requestDescription -> getTargetKind ( ) , TargetKind :: SERVICE_DIRECTORY ( ) ) ; $ hostInfo = array ( 'AbsoluteRequestUri' => new Url ( 'http://localhost:8083/NorthWindDataService.svc/$metadata' ) , 'AbsoluteServiceUri' => new Url ( 'http://localhost:8083/NorthWindDataService.svc' ) , 'QueryString' => null ) ; $ host = new ServiceHostTestFake ( $ hostInfo ) ; $ dataService = new NorthWindService2 ( ) ; $ dataService -> setHost ( $ host ) ; $ uriProcessor = $ dataService -> handleRequest ( ) ; $ requestDescription = $ uriProcessor -> getRequest ( ) ; $ this -> assertEquals ( $ requestDescription -> getTargetSource ( ) , TargetSource :: NONE ) ; $ this -> assertEquals ( $ requestDescription -> getTargetKind ( ) , TargetKind :: METADATA ( ) ) ; $ hostInfo = array ( 'AbsoluteRequestUri' => new Url ( 'http://localhost:8083/NorthWindDataService.svc/$batch' ) , 'AbsoluteServiceUri' => new Url ( 'http://localhost:8083/NorthWindDataService.svc' ) , 'QueryString' => null ) ; $ host = new ServiceHostTestFake ( $ hostInfo ) ; $ dataService = new NorthWindService2 ( ) ; $ dataService -> setHost ( $ host ) ; $ uriProcessor = $ dataService -> handleRequest ( ) ; $ requestDescription = $ uriProcessor -> getRequest ( ) ; $ this -> assertEquals ( $ requestDescription -> getTargetSource ( ) , TargetSource :: NONE ) ; $ this -> assertEquals ( $ requestDescription -> getTargetKind ( ) , TargetKind :: BATCH ( ) ) ; }
Test with request uri where TargetKind is NONE.
Test with request uri where TargetKind is NONE .
//Request for service directory //Request for metadata //Request for batch