From 469cee1b80ab88fcadef368d8f1cb3f9fabee52d Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Sat, 18 Mar 2017 12:21:52 -0400 Subject: [PATCH] Add a bunch of elseif tests to fix --- tests/TypeAlgebraTest.php | 98 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/tests/TypeAlgebraTest.php b/tests/TypeAlgebraTest.php index d6854025b..ad19386d6 100644 --- a/tests/TypeAlgebraTest.php +++ b/tests/TypeAlgebraTest.php @@ -312,4 +312,102 @@ class TypeAlgebraTest extends PHPUnit_Framework_TestCase $file_checker = new FileChecker('somefile.php', $this->project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); } + + /** + * @return void + */ + public function testTwoVarLogicNotNestedWithElseif() + { + $stmts = self::$parser->parse('project_checker, $stmts); + $file_checker->visitAndAnalyzeMethods(); + } + + /** + * @expectedException \Psalm\Exception\CodeException + * @expectedExceptionMessage InvalidReturnType + * @return void + */ + public function testTwoVarLogicNotNestedWithElseifNegatedInIf() + { + $stmts = self::$parser->parse('project_checker, $stmts); + $file_checker->visitAndAnalyzeMethods(); + } + + /** + * @return void + */ + public function testTwoVarLogicNotNestedWithElseifCorrectlyNegatedInElseIf() + { + $stmts = self::$parser->parse('project_checker, $stmts); + $file_checker->visitAndAnalyzeMethods(); + } + + /** + * @return void + */ + public function testTwoVarLogicNotNestedWithElseifCorrectlyReinforcedInIf() + { + $stmts = self::$parser->parse('project_checker, $stmts); + $file_checker->visitAndAnalyzeMethods(); + } }