From f0682941b64e3033297c596e612522d1e1f245aa Mon Sep 17 00:00:00 2001 From: Nick Pellegrino Date: Sat, 19 Jan 2013 17:05:30 -0800 Subject: [PATCH] Testing that PhabricatorEnv::getEnvConfig throws an exception if config option is not found. Summary: Unit test for T2345 Test Plan: Ran unit tests, checked that it passed. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4552 --- .../env/__tests__/PhabricatorEnvTestCase.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/infrastructure/env/__tests__/PhabricatorEnvTestCase.php b/src/infrastructure/env/__tests__/PhabricatorEnvTestCase.php index 13b5d9c5e2..4828b0acb1 100644 --- a/src/infrastructure/env/__tests__/PhabricatorEnvTestCase.php +++ b/src/infrastructure/env/__tests__/PhabricatorEnvTestCase.php @@ -156,4 +156,22 @@ final class PhabricatorEnvTestCase extends PhabricatorTestCase { unset($outer); } + public function testGetEnvExceptions() { + $caught = null; + try { + PhabricatorEnv::getEnvConfig("not.a.real.config.option"); + } catch (Exception $ex) { + $caught = $ex; + } + $this->assertEqual(true, $caught instanceof Exception); + + $caught = null; + try { + PhabricatorEnv::getEnvConfig("test.value"); + } catch (Exception $ex) { + $caught = $ex; + } + $this->assertEqual(false, $caught instanceof Exception); + } + }