use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Configuration\FrameworkConfiguration;
use Org\Mxchange\CoreFramework\Configuration\NoConfigEntryException;
-use Org\Mxchange\CoreFramework\Loader\ClassLoader;
use Org\Mxchange\CoreFramework\Generic\NullPointerException;
use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
// Import PHPUnit stuff
-use PHPUnit\Framework\Error\Notice;
use PHPUnit\Framework\TestCase;
// Import SPL stuff
// Init instance
self::$configInstance = FrameworkBootstrap::getConfigurationInstance();
- /*
- * Disable strict naming-convention check in own class loader, because
- * PHP_Invoker doesn't have namespaces.
- */
- ClassLoader::enableStrictNamingConventionCheck(FALSE);
-
// Trace message
//* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);
}
$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
*/
$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.
$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
*/
$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.
$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)
*/
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
*/
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
*/