diff --git a/src/ZendPhpDotEnv/DotEnvLoader.php b/src/ZendPhpDotEnv/DotEnvLoader.php index 42b2a01..f6510d3 100644 --- a/src/ZendPhpDotEnv/DotEnvLoader.php +++ b/src/ZendPhpDotEnv/DotEnvLoader.php @@ -41,7 +41,7 @@ public static function loadFromConstant($constant, $file) try { return DotEnvFactory::createFromConstant($constant, $file)->load(); } catch (InvalidPathException $e) { - throw new InvalidConstantPathException($e->getMessage(), $e->getCode(), $e); + // } } @@ -56,7 +56,7 @@ public static function loadFromEnvironmentVariable($variable, $file) try { return DotEnvFactory::createFromEnvironmentVariable($variable, $file)->load(); } catch (InvalidPathException $e) { - throw new InvalidEnvironmentVariablePathException($e->getMessage(), $e->getCode(), $e); + // } } @@ -70,7 +70,7 @@ public static function loadFromWorkingDirectory($file) try { return DotEnvFactory::createFromWorkingDirectory($file)->load(); } catch (InvalidPathException $e) { - throw new InvalidWorkingDirectoryPathException($e->getMessage(), $e->getCode(), $e); + // } } } diff --git a/tests/ZendPhpDotEnv/DotEnvLoaderTest.php b/tests/ZendPhpDotEnv/DotEnvLoaderTest.php index d1f0327..e832d2b 100644 --- a/tests/ZendPhpDotEnv/DotEnvLoaderTest.php +++ b/tests/ZendPhpDotEnv/DotEnvLoaderTest.php @@ -33,34 +33,4 @@ public function testHasEnvironmentVariable() self::assertTrue($actual); } - - /** - * @expectedException \Abacaphiliac\ZendPhpDotEnv\Exception\InvalidConstantPathException - */ - public function testLoadEnvironmentVariablesFromConstant() - { - self::assertFalse(defined(__FUNCTION__)); - define(__FUNCTION__, __DIR__); - - DotEnvLoader::loadFromConstant(__FUNCTION__, '.testEnv'); - } - - /** - * @expectedException \Abacaphiliac\ZendPhpDotEnv\Exception\InvalidEnvironmentVariablePathException - */ - public function testLoadEnvironmentVariablesFromEnvironmentVariable() - { - self::assertFalse(DotEnvLoader::hasEnvironmentVariable(__FUNCTION__)); - $_ENV[__FUNCTION__] = __DIR__; - - DotEnvLoader::loadFromEnvironmentVariable(__FUNCTION__, '.testEnv'); - } - - /** - * @expectedException \Abacaphiliac\ZendPhpDotEnv\Exception\InvalidWorkingDirectoryPathException - */ - public function testLoadEnvironmentVariablesFromWorkingDirectory() - { - DotEnvLoader::loadFromWorkingDirectory($file = '.testEnv'); - } } diff --git a/tests/ZendPhpDotEnv/ModuleTest.php b/tests/ZendPhpDotEnv/ModuleTest.php deleted file mode 100644 index 2c9cc54..0000000 --- a/tests/ZendPhpDotEnv/ModuleTest.php +++ /dev/null @@ -1,73 +0,0 @@ -loadEnvironmentVariables(); - } - - /** - * @expectedException \Abacaphiliac\ZendPhpDotEnv\Exception\InvalidEnvironmentVariablePathException - */ - public function testModuleLoadsEnvironmentVariablesFromEnvironmentVariable() - { - self::assertFalse(DotEnvLoader::hasEnvironmentVariable(__FUNCTION__)); - $_ENV[__FUNCTION__] = __DIR__; - - $module = new Module($constant = null, $variable = __FUNCTION__, $file = '.testEnv'); - $module->loadEnvironmentVariables(); - } - - /** - * @expectedException \Abacaphiliac\ZendPhpDotEnv\Exception\InvalidWorkingDirectoryPathException - */ - public function testModuleLoadsEnvironmentVariablesFromWorkingDirectory() - { - $module = new Module($constant = null, $variable = null, $file = '.testEnv'); - $module->loadEnvironmentVariables(); - } - - /** - * @expectedException \Abacaphiliac\ZendPhpDotEnv\Exception\InvalidWorkingDirectoryPathException - */ - public function testInitLoadsEnvironmentVariablesFromWorkingDirectory() - { - $serviceLocator = new ServiceManager(); - $serviceLocator->setService('ApplicationConfig', array( - 'module_listener_options' => array(), - 'modules' => array( - 'Abacaphiliac\ZendPhpDotEnv', - ), - )); - $serviceLocator->setFactory('EventManager', new EventManagerFactory()); - $serviceLocator->setService('SharedEventManager', new SharedEventManager()); - $serviceLocator->setFactory('ServiceListener', '\Zend\Mvc\Service\ServiceListenerFactory'); - - $moduleManagerFactory = new ModuleManagerFactory(); - $moduleManager = $moduleManagerFactory->createService($serviceLocator); - - $module = new Module($constant = null, $variable = null, $file = '.testEnv'); - - $module->init($moduleManager); - - $moduleManager->getEventManager()->trigger(new ModuleEvent(ModuleEvent::EVENT_LOAD_MODULE)); - } -}