* @package generis */ use oat\generis\test\TestCase; class NamespaceTest extends TestCase { public function setUp(): void { } /** * Tes if the model is correctly loaded, especially the manager singleton */ public function testModel() { $namespaceManager = common_ext_NamespaceManager::singleton(); $this->assertInstanceOf('common_ext_NamespaceManager', $namespaceManager); //$this->assertReference($namespaceManager, common_ext_NamespaceManager::singleton()); $tempNamesapce = new common_ext_Namespace(); $this->assertInstanceOf('common_ext_Namespace', $tempNamesapce); } /** * test the manager retrieving methods and the namespace setters/getters */ public function testBehaviour() { $namespaceManager = common_ext_NamespaceManager::singleton(); $namespaces = $namespaceManager->getAllNamespaces(); $this->assertTrue(count($namespaces) > 0); foreach ($namespaces as $namespace) { $this->assertInstanceOf('common_ext_Namespace', $namespace); } $localNs = $namespaceManager->getLocalNamespace(); $this->assertInstanceOf('common_ext_Namespace', $localNs); $otherLocalNs = $namespaceManager->getNamespace($localNs->getModelId()); $this->assertInstanceOf('common_ext_Namespace', $otherLocalNs); $this->assertEquals((string)$otherLocalNs, (string)$localNs); } }