/** * To get Namespace name for the data source, * Note: Wrapper for IMetadataProvider::getContainerNamespace method implementation * * @return string that contains the namespace name. * * @throws ODataException Exception if implementation returns empty container namespace * */ public function getContainerNamespace() { $containerNamespace = $this->metaProvider->getContainerNamespace(); if (empty($containerNamespace)) { throw new ODataException(Messages::providersWrapperContainerNamespaceMustNotBeNullOrEmpty(), 500); } return $containerNamespace; }
public function testGetContainerNamespaceThrowsWhenEmpty() { Phockito::when($this->mockMetadataProvider->getContainerNamespace())->return(''); $wrapper = $this->getMockedWrapper(); try { $wrapper->getContainerNamespace(); $this->fail("Expected exception not thrown"); } catch (ODataException $ex) { $this->assertEquals(Messages::providersWrapperContainerNamespaceMustNotBeNullOrEmpty(), $ex->getMessage()); $this->assertEquals(500, $ex->getStatusCode()); } }