From 617640392220dc5acf42c8e4bc8127b9c9cf3834 Mon Sep 17 00:00:00 2001 From: Gert de Pagter Date: Wed, 6 Nov 2019 15:28:34 +0100 Subject: [PATCH] Add has static analysis test (#149) --- tests/ProjectCodeTest.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/ProjectCodeTest.php b/tests/ProjectCodeTest.php index ef869ea8..e6192090 100644 --- a/tests/ProjectCodeTest.php +++ b/tests/ProjectCodeTest.php @@ -105,6 +105,24 @@ public function testHasThrowsAnnotation($method) } + /** + * @dataProvider provideMethods + * + * @param ReflectionMethod $method + */ + public function testHasCorrespondingStaticAnalysisFile($method) + { + $doc = $method->getDocComment(); + if($doc === false || strpos($doc, '@psalm-assert') === false) { + $this->addToAssertionCount(1); + return; + } + + $this->assertFileExists( + __DIR__ . '/static-analysis/assert-'. $method->getName() . '.php' + ); + } + /** * @return array */ @@ -150,7 +168,5 @@ private function getMethods() } return $methods; - } - }