X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=tests%2Fframework%2Fconfig%2FFrameworkConfigurationTest.php;h=fb65b3f8dee3cb4f06580fab74dc33c7286dd3ad;hb=108f2391252a823f0e26b2c3e9e18843ce224ecd;hp=4de7bbccd70c528dbdbb0f982c1cb0c78e83620b;hpb=5da8f717122568335b8a8ab230fa0de17e983fab;p=core.git diff --git a/tests/framework/config/FrameworkConfigurationTest.php b/tests/framework/config/FrameworkConfigurationTest.php index 4de7bbcc..fb65b3f8 100644 --- a/tests/framework/config/FrameworkConfigurationTest.php +++ b/tests/framework/config/FrameworkConfigurationTest.php @@ -1,22 +1,22 @@ + * Copyright (C) 2017 - 2020 - Core Developer Team * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -64,13 +64,7 @@ class FrameworkConfigurationTest extends TestCase { parent::setUpBeforeClass(); // Init instance - self::$configInstance = FrameworkConfiguration::getSelfInstance(); - - /* - * Disable strict naming-convention check in own class loader, because - * PHP_Invoker doesn't have namespaces. - */ - ClassLoader::enableStrictNamingConventionCheck(FALSE); + self::$configInstance = FrameworkBootstrap::getConfigurationInstance(); // Trace message //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__); @@ -84,7 +78,7 @@ class FrameworkConfigurationTest extends TestCase { $className = self::$configInstance->__toString(); // Should be equal - $this->assertEquals('CoreFramework\Configuration\FrameworkConfiguration', $className); + $this->assertEquals('Org\Mxchange\CoreFramework\Configuration\FrameworkConfiguration', $className); } /** @@ -92,7 +86,7 @@ class FrameworkConfigurationTest extends TestCase { */ public function testGettingSelfConfigInstance () { // Get instance - $dummyInstance = FrameworkConfiguration::getSelfInstance(); + $dummyInstance = FrameworkBootstrap::getConfigurationInstance(); // Should be equal to own instance $this->assertEquals(self::$configInstance, $dummyInstance); @@ -103,7 +97,7 @@ class FrameworkConfigurationTest extends TestCase { */ public function testEqualsConfigInstance () { // Get instance - $dummyInstance = FrameworkConfiguration::getSelfInstance(); + $dummyInstance = new FrameworkConfiguration(); // Should return TRUE $this->assertTrue(self::$configInstance->equals($dummyInstance)); @@ -114,7 +108,7 @@ class FrameworkConfigurationTest extends TestCase { */ public function testHashCodeConfigInstance () { // Get instance - $dummyInstance = FrameworkConfiguration::getSelfInstance(); + $dummyInstance = FrameworkBootstrap::getConfigurationInstance(); // Get hash code from both $hashCodeExpected = self::$configInstance->hashCode(); @@ -152,7 +146,7 @@ class FrameworkConfigurationTest extends TestCase { */ public function testSameConfigurationArrayGetter () { // Get instance - $dummyInstance = FrameworkConfiguration::getSelfInstance(); + $dummyInstance = FrameworkBootstrap::getConfigurationInstance(); // Get it from both instances $config1 = self::$configInstance->getConfigurationArray(); @@ -162,28 +156,6 @@ class FrameworkConfigurationTest extends TestCase { $this->assertEquals($config1, $config2); } - /** - * Tests if a proper exception is thrown when check for a NULL key - */ - public function testCheckingNullConfigKey () { - // Will throw this exception - $this->expectException(NullPointerException::class); - - // Test it - $dummy = self::$configInstance->isConfigurationEntrySet(NULL); - } - - /** - * Tests if a proper exception is thrown when checking a boolean key - */ - public function testCheckingBooleanConfigKey () { - // Will throw this exception - $this->expectException(InvalidArgumentException::class); - - // Test it - $dummy = self::$configInstance->isConfigurationEntrySet(FALSE); - } - /** * Tests if a proper exception is thrown when checking an empty key */ @@ -195,64 +167,6 @@ class FrameworkConfigurationTest extends TestCase { $dummy = self::$configInstance->isConfigurationEntrySet(''); } - /** - * Tests if a proper exception is thrown when checking an array key - */ - public function testCheckingArrayConfigKey () { - // Will throw this exception - $this->expectException(InvalidArgumentException::class); - - // Test it - $dummy = self::$configInstance->isConfigurationEntrySet(array()); - } - - /** - * Tests if a proper exception is thrown when checking a decimal key - */ - public function testCheckingDecimalConfigKey () { - // Will throw this exception - $this->expectException(InvalidArgumentException::class); - - // Test it - $dummy = self::$configInstance->isConfigurationEntrySet(12345); - } - - /** - * Tests if a proper exception is thrown when checking a float key - */ - public function testCheckingFloatConfigKey () { - // Will throw this exception - $this->expectException(InvalidArgumentException::class); - - // Test it - $dummy = self::$configInstance->isConfigurationEntrySet(123.45); - } - - /** - * Tests if a proper exception is thrown when checking an object key - */ - public function testCheckingObjectConfigKey () { - // Will throw this exception - $this->expectException(InvalidArgumentException::class); - - // Test it - $dummy = self::$configInstance->isConfigurationEntrySet($this); - } - - /** - * Tests if a proper exception is thrown when checking a resource key - */ - public function testCheckingResourceConfigKey () { - // Will throw this exception - $this->expectException(InvalidArgumentException::class); - - // Init some resource - $resource = fopen(__FILE__, 'r'); - - // Test it - $dummy = self::$configInstance->isConfigurationEntrySet($resource); - } - /** * Tests if checking an existing (well-known) key can be found and returns * TRUE. @@ -270,28 +184,6 @@ class FrameworkConfigurationTest extends TestCase { $this->assertFalse(self::$configInstance->isConfigurationEntrySet('__non_existing_key__')); } - /** - * Tests if a proper exception is thrown when getting a NULL key - */ - public function testGettingNullConfigKey () { - // Will throw this exception - $this->expectException(NullPointerException::class); - - // Test it - $dummy = self::$configInstance->getConfigEntry(NULL); - } - - /** - * Tests if a proper exception is thrown when getting a boolean key - */ - public function testGettingBooleanConfigKey () { - // Will throw this exception - $this->expectException(InvalidArgumentException::class); - - // Test it - $dummy = self::$configInstance->getConfigEntry(FALSE); - } - /** * Tests if a proper exception is thrown when getting an empty key */ @@ -303,64 +195,6 @@ class FrameworkConfigurationTest extends TestCase { $dummy = self::$configInstance->getConfigEntry(''); } - /** - * Tests if a proper exception is thrown when getting a decimal key - */ - public function testGettingDecimalConfigKey () { - // Will throw this exception - $this->expectException(InvalidArgumentException::class); - - // Test it - $dummy = self::$configInstance->getConfigEntry(12345); - } - - /** - * Tests if a proper exception is thrown when getting a float key - */ - public function testGettingFloatConfigKey () { - // Will throw this exception - $this->expectException(InvalidArgumentException::class); - - // Test it - $dummy = self::$configInstance->getConfigEntry(123.45); - } - - /** - * Tests if a proper exception is thrown when getting an array key - */ - public function testGettingArrayConfigKey () { - // Will throw this exception - $this->expectException(InvalidArgumentException::class); - - // Test it - $dummy = self::$configInstance->getConfigEntry(array()); - } - - /** - * Tests if a proper exception is thrown when getting an object key - */ - public function testGettingObjectConfigKey () { - // Will throw this exception - $this->expectException(InvalidArgumentException::class); - - // Test it - $dummy = self::$configInstance->getConfigEntry($this); - } - - /** - * Tests if a proper exception is thrown when getting a resource key - */ - public function testGettingResourceConfigKey () { - // Will throw this exception - $this->expectException(InvalidArgumentException::class); - - // Init some resource - $resource = fopen(__FILE__, 'r'); - - // Test it - $dummy = self::$configInstance->getConfigEntry($resource); - } - /** * Tests if getting a non-existing key will cause a proper exception been * thrown. @@ -384,28 +218,6 @@ class FrameworkConfigurationTest extends TestCase { $this->assertDirectoryIsReadable($value); } - /** - * Tests setting a NULL key (value doesn't matter) - */ - public function testSettingNullConfigKey () { - // Will throw this exception - $this->expectException(NullPointerException::class); - - // Test it - self::$configInstance->setConfigEntry(NULL, 'foo'); - } - - /** - * Tests setting a boolean key (value doesn't matter) - */ - public function testSettingBooleanConfigKey () { - // Will throw this exception - $this->expectException(InvalidArgumentException::class); - - // Test it - self::$configInstance->setConfigEntry(FALSE, 'foo'); - } - /** * Tests setting an empty key (value doesn't matter) */ @@ -417,64 +229,6 @@ class FrameworkConfigurationTest extends TestCase { self::$configInstance->setConfigEntry('', 'foo'); } - /** - * Tests setting a decimal key (value doesn't matter) - */ - public function testSettingDecimalConfigKey () { - // Will throw this exception - $this->expectException(InvalidArgumentException::class); - - // Test it - self::$configInstance->setConfigEntry(12345, 'foo'); - } - - /** - * Tests setting a float key (value doesn't matter) - */ - public function testSettingFloatConfigKey () { - // Will throw this exception - $this->expectException(InvalidArgumentException::class); - - // Test it - self::$configInstance->setConfigEntry(123.45, 'foo'); - } - - /** - * Tests setting an array key (value doesn't matter) - */ - public function testSettingArrayConfigKey () { - // Will throw this exception - $this->expectException(InvalidArgumentException::class); - - // Test it - self::$configInstance->setConfigEntry(array(), 'foo'); - } - - /** - * Tests setting an object key (value doesn't matter) - */ - public function testSettingObjectConfigKey () { - // Will throw this exception - $this->expectException(InvalidArgumentException::class); - - // Test it - self::$configInstance->setConfigEntry($this, 'foo'); - } - - /** - * Tests setting a resource key (value doesn't matter) - */ - public function testSettingResourceConfigKey () { - // Will throw this exception - $this->expectException(InvalidArgumentException::class); - - // Init some resource - $resource = fopen(__FILE__, 'r'); - - // Test it - self::$configInstance->setConfigEntry($resource, 'foo'); - } - /** * Tests setting a valid key but array for value */ @@ -511,86 +265,6 @@ class FrameworkConfigurationTest extends TestCase { self::$configInstance->setConfigEntry('foo', $resource); } - /** - * Tests unsetting NULL key - */ - public function testUnsettingNullConfigKey () { - // Will throw this exception - $this->expectException(NullPointerException::class); - - // Test it - self::$configInstance->unsetConfigEntry(NULL); - } - - /** - * Tests unsetting boolean key - */ - public function testUnsettingBooleanConfigKey () { - // Will throw this exception - $this->expectException(InvalidArgumentException::class); - - // Test it - self::$configInstance->unsetConfigEntry(FALSE); - } - - /** - * Tests unsetting decimal key - */ - public function testUnsettingDecimalConfigKey () { - // Will throw this exception - $this->expectException(InvalidArgumentException::class); - - // Test it - self::$configInstance->unsetConfigEntry(12345); - } - - /** - * Tests unsetting float key - */ - public function testUnsettingFloatConfigKey () { - // Will throw this exception - $this->expectException(InvalidArgumentException::class); - - // Test it - self::$configInstance->unsetConfigEntry(123.45); - } - - /** - * Tests unsetting array key - */ - public function testUnsettingArrayConfigKey () { - // Will throw this exception - $this->expectException(InvalidArgumentException::class); - - // Test it - self::$configInstance->unsetConfigEntry(array()); - } - - /** - * Tests unsetting object key - */ - public function testUnsettingObjectConfigKey () { - // Will throw this exception - $this->expectException(InvalidArgumentException::class); - - // Test it - self::$configInstance->unsetConfigEntry($this); - } - - /** - * Tests unsetting resource key - */ - public function testUnsettingResourceConfigKey () { - // Will throw this exception - $this->expectException(InvalidArgumentException::class); - - // Init some resource - $resource = fopen(__FILE__, 'r'); - - // Test it - self::$configInstance->unsetConfigEntry($resource); - } - /** * Tests unsetting an empty key */