m> ' ) ); $this->project_analyzer->progress = new EchoProgress(); ob_start(); $this->project_analyzer->checkDir('tests/fixtures/DummyProject'); $output = ob_get_clean(); $this->assertSame('Scanning files...' . "\n" . 'Analyzing files...' . "\n\n", $output); $this->assertSame(0, \Psalm\IssueBuffer::getErrorCount()); $this->assertSame( 'Psalm was able to infer types for 100% of the codebase', $this->project_analyzer->getCodebase()->analyzer->getTypeInferenceSummary( $this->project_analyzer->getCodebase() ) ); } public function testCheckPaths(): void { $this->project_analyzer = $this->getProjectAnalyzerWithConfig( Config::loadFromXML( (string)getcwd(), ' ' ) ); $this->project_analyzer->progress = new EchoProgress(); ob_start(); // checkPaths expects absolute paths, // otherwise it's unable to match them against configured folders $this->project_analyzer->checkPaths([ realpath(getcwd() . '/tests/fixtures/DummyProject/Bar.php'), realpath(getcwd() . '/tests/fixtures/DummyProject/SomeTrait.php'), ]); $output = ob_get_clean(); $this->assertSame('Scanning files...' . "\n" . 'Analyzing files...' . "\n\n", $output); $this->assertSame(0, \Psalm\IssueBuffer::getErrorCount()); $this->assertSame( 'Psalm was able to infer types for 100% of the codebase', $this->project_analyzer->getCodebase()->analyzer->getTypeInferenceSummary( $this->project_analyzer->getCodebase() ) ); } public function testCheckFile(): void { $this->project_analyzer = $this->getProjectAnalyzerWithConfig( Config::loadFromXML( (string)getcwd(), ' ' ) ); $this->project_analyzer->progress = new EchoProgress(); ob_start(); // checkPaths expects absolute paths, // otherwise it's unable to match them against configured folders $this->project_analyzer->checkPaths([ realpath(getcwd() . '/tests/fixtures/DummyProject/Bar.php'), realpath(getcwd() . '/tests/fixtures/DummyProject/SomeTrait.php'), ]); $output = ob_get_clean(); $this->assertSame('Scanning files...' . "\n" . 'Analyzing files...' . "\n\n", $output); $this->assertSame(0, \Psalm\IssueBuffer::getErrorCount()); $this->assertSame( 'Psalm was able to infer types for 100% of the codebase', $this->project_analyzer->getCodebase()->analyzer->getTypeInferenceSummary( $this->project_analyzer->getCodebase() ) ); } }