From 1c1bad02243e3dfbf6edbfd41e5d2a81879314ca Mon Sep 17 00:00:00 2001 From: Greg Bowler Date: Wed, 5 Dec 2018 16:24:04 +0000 Subject: [PATCH] Test ProtectedGlobal offsetUnset --- test/unit/ProtectedGlobalTest.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/unit/ProtectedGlobalTest.php b/test/unit/ProtectedGlobalTest.php index 2c490e2..267153d 100644 --- a/test/unit/ProtectedGlobalTest.php +++ b/test/unit/ProtectedGlobalTest.php @@ -73,4 +73,21 @@ public function testOffsetUnsetThrowsException() { self::expectException(ProtectedGlobalException::class); unset($sut["something"]); } + + public function testOffsetUnset() { + $whiteList = [ + "name" => "test", + "country" => "United Kingdom", + ]; + $sut = new ProtectedGlobal($whiteList); + + $exception = null; + + try { + unset($sut["name"]); + } + catch(\Exception $exception) {} + + self::assertNull($exception); + } } \ No newline at end of file