From 339132ac838da0044a37eb0fe9835851cfef53bc Mon Sep 17 00:00:00 2001 From: Luke Visinoni Date: Sun, 8 Jan 2017 07:20:31 -0800 Subject: [PATCH] Added some tests to ensure the helper functions throw exceptions at the appropriate times - refs #47 --- tests/FunctionsTest.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/FunctionsTest.php b/tests/FunctionsTest.php index 61c2ab9..37e5ade 100644 --- a/tests/FunctionsTest.php +++ b/tests/FunctionsTest.php @@ -13,6 +13,7 @@ use ArrayIterator; use Closure; use Exception; +use InvalidArgumentException; use function Noz\collect, Noz\invoke, @@ -293,4 +294,20 @@ public function testNormalizeOffsetThrowsExceptionForInvalidOffset() { normalize_offset('chooochooo'); } + + /** + * @expectedException InvalidArgumentException + */ + public function testNormalizeOffsetWillThrowExceptionIfPassedNegativeOffsetWithoutCount() + { + normalize_offset(-10, null); + } + + /** + * @expectedException RuntimeException + */ + public function testGetCountThrowsExceptionOnInvalidInput() + { + normalize_offset('chooochooo'); + } }