示例#1
0
 public function testGetContainerNameThrowsWhenEmpty()
 {
     Phockito::when($this->mockMetadataProvider->getContainerName())->return('');
     $wrapper = $this->getMockedWrapper();
     try {
         $wrapper->getContainerName();
         $this->fail("Expected exception not thrown");
     } catch (ODataException $ex) {
         $this->assertEquals(Messages::providersWrapperContainerNameMustNotBeNullOrEmpty(), $ex->getMessage());
         $this->assertEquals(500, $ex->getStatusCode());
     }
 }
示例#2
0
 /**     
  * To get the Container name for the data source,
  * Note: Wrapper for IMetadataProvider::getContainerName method
  * implementation
  * 
  * @return string that contains the name of the container
  * 
  * @throws ODataException Exception if implementation returns empty container name
  *
  */
 public function getContainerName()
 {
     $containerName = $this->metaProvider->getContainerName();
     if (empty($containerName)) {
         throw new ODataException(Messages::providersWrapperContainerNameMustNotBeNullOrEmpty(), 500);
     }
     return $containerName;
 }