diff --git a/tests/ThrowsAnnotationTest.php b/tests/ThrowsAnnotationTest.php index d13fd8415..576d5cfb6 100644 --- a/tests/ThrowsAnnotationTest.php +++ b/tests/ThrowsAnnotationTest.php @@ -125,6 +125,29 @@ class ThrowsAnnotationTest extends TestCase $this->analyzeFile('somefile.php', $context); } + /** + * @return void + */ + public function testNoThrowWhenSuppressingInline() + { + Config::getInstance()->check_for_throws_docblock = true; + + $this->addFile( + 'somefile.php', + 'analyzeFile('somefile.php', $context); + } + /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage MissingThrowsDocblock diff --git a/tests/ThrowsInGlobalScopeTest.php b/tests/ThrowsInGlobalScopeTest.php index f3d042fa1..631d76116 100644 --- a/tests/ThrowsInGlobalScopeTest.php +++ b/tests/ThrowsInGlobalScopeTest.php @@ -188,4 +188,115 @@ class ThrowsInGlobalScopeTest extends TestCase $this->analyzeFile('somefile.php', $context); } + + /** + * @return void + */ + public function testUncaughtThrowWhenSuppressing() + { + Config::getInstance()->check_for_throws_in_global_scope = true; + + $this->addFile( + 'somefile.php', + 'analyzeFile('somefile.php', $context); + } + + /** + * @return void + */ + public function testUncaughtThrowInNamespaceWhenSuppressing() + { + Config::getInstance()->check_for_throws_in_global_scope = true; + + $this->addFile( + 'somefile.php', + 'analyzeFile('somefile.php', $context); + } + + /** + * @return void + */ + public function testUncaughtDocumentedThrowCallWhenSuppressing() + { + Config::getInstance()->check_for_throws_in_global_scope = true; + + $this->addFile( + 'somefile.php', + 'analyzeFile('somefile.php', $context); + } + + /** + * @return void + */ + public function testUncaughtDocumentedThrowCallInNamespaceWhenSuppressing() + { + Config::getInstance()->check_for_throws_in_global_scope = true; + + $this->addFile( + 'somefile.php', + 'analyzeFile('somefile.php', $context); + } }