diff --git a/tests/ReturnTypeTest.php b/tests/ReturnTypeTest.php index de7c52f04..5e299705b 100644 --- a/tests/ReturnTypeTest.php +++ b/tests/ReturnTypeTest.php @@ -287,4 +287,26 @@ class ReturnTypeTest extends PHPUnit_Framework_TestCase $file_checker = new \CodeInspector\FileChecker('somefile.php', $stmts); $file_checker->check(); } + + public function testSwitchReturnTypeWitDefaultException() + { + $stmts = self::$_parser->parse('check(); + } } diff --git a/tests/TypeTest.php b/tests/TypeTest.php index dd37c211f..f62fc6cb7 100644 --- a/tests/TypeTest.php +++ b/tests/TypeTest.php @@ -651,6 +651,99 @@ class TypeTest extends PHPUnit_Framework_TestCase $file_checker->check(); } + /** + * @expectedException CodeInspector\Exception\CodeException + */ + public function testNullableMethodWithGuardedSwitchRedefinitionNoDefault() + { + $stmts = self::$_parser->parse('foo(); + } + }'); + + $file_checker = new \CodeInspector\FileChecker('somefile.php', $stmts); + $file_checker->check(); + } + + /** + * @expectedException CodeInspector\Exception\CodeException + */ + public function testNullableMethodWithGuardedSwitchRedefinitionEmptyDefault() + { + $stmts = self::$_parser->parse('foo(); + } + }'); + + $file_checker = new \CodeInspector\FileChecker('somefile.php', $stmts); + $file_checker->check(); + } + + public function testNullableMethodWithGuardedSwitchRedefinitionDueToException() + { + $stmts = self::$_parser->parse('foo(); + } + }'); + + $file_checker = new \CodeInspector\FileChecker('somefile.php', $stmts); + $file_checker->check(); + } + public function testNullableMethodWithGuardedNestedRedefinitionWithReturn() { $stmts = self::$_parser->parse('