Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix faulty Config tests #7355

Merged
merged 1 commit into from
Jan 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 8 additions & 9 deletions tests/Config/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function testBarebonesConfig(): void
$config = $this->project_analyzer->getConfig();

$this->assertTrue($config->isInProjectDirs(realpath('src/Psalm/Type.php')));
$this->assertFalse($config->isInProjectDirs(realpath('examples/StringAnalyzer.php')));
$this->assertFalse($config->isInProjectDirs(realpath('examples/TemplateScanner.php')));
}

public function testIgnoreProjectDirectory(): void
Expand All @@ -129,7 +129,7 @@ public function testIgnoreProjectDirectory(): void

$this->assertTrue($config->isInProjectDirs(realpath('src/Psalm/Type.php')));
$this->assertFalse($config->isInProjectDirs(realpath('src/Psalm/Internal/Analyzer/FileAnalyzer.php')));
$this->assertFalse($config->isInProjectDirs(realpath('examples/StringAnalyzer.php')));
$this->assertFalse($config->isInProjectDirs(realpath('examples/TemplateScanner.php')));
}

public function testIgnoreMissingProjectDirectory(): void
Expand All @@ -152,8 +152,8 @@ public function testIgnoreMissingProjectDirectory(): void
$config = $this->project_analyzer->getConfig();

$this->assertTrue($config->isInProjectDirs(realpath('src/Psalm/Type.php')));
$this->assertFalse($config->isInProjectDirs(realpath('does/not/exist/FileAnalyzer.php')));
$this->assertFalse($config->isInProjectDirs(realpath('examples/StringAnalyzer.php')));
$this->assertFalse($config->isInProjectDirs(realpath(__DIR__.'/../../').'/does/not/exist/FileAnalyzer.php'));
$this->assertFalse($config->isInProjectDirs(realpath('examples/TemplateScanner.php')));
}

public function testIgnoreSymlinkedProjectDirectory(): void
Expand Down Expand Up @@ -199,7 +199,7 @@ public function testIgnoreSymlinkedProjectDirectory(): void

$this->assertTrue($config->isInProjectDirs(realpath('tests/AnnotationTest.php')));
$this->assertFalse($config->isInProjectDirs(realpath('tests/fixtures/symlinktest/a/ignoreme.php')));
$this->assertFalse($config->isInProjectDirs(realpath('examples/StringAnalyzer.php')));
$this->assertFalse($config->isInProjectDirs(realpath('examples/TemplateScanner.php')));

$regex = '/^unlink\([^\)]+\): (?:Permission denied|No such file or directory)$/';
$last_error = error_get_last();
Expand Down Expand Up @@ -247,7 +247,7 @@ public function testIgnoreWildcardProjectDirectory(): void
$this->assertTrue($config->isInProjectDirs(realpath('src/Psalm/Type.php')));
$this->assertFalse($config->isInProjectDirs(realpath('src/Psalm/Internal/Analyzer/FileAnalyzer.php')));
$this->assertFalse($config->isInProjectDirs(realpath('src/Psalm/Internal/Analyzer/Statements/ReturnAnalyzer.php')));
$this->assertFalse($config->isInProjectDirs(realpath('examples/StringAnalyzer.php')));
$this->assertFalse($config->isInProjectDirs(realpath('examples/TemplateScanner.php')));
}

public function testIgnoreWildcardFiles(): void
Expand All @@ -272,7 +272,7 @@ public function testIgnoreWildcardFiles(): void
$this->assertTrue($config->isInProjectDirs(realpath('src/Psalm/Type.php')));
$this->assertFalse($config->isInProjectDirs(realpath('src/Psalm/Internal/Analyzer/FileAnalyzer.php')));
$this->assertTrue($config->isInProjectDirs(realpath('src/Psalm/Internal/Analyzer/Statements/ReturnAnalyzer.php')));
$this->assertFalse($config->isInProjectDirs(realpath('examples/StringAnalyzer.php')));
$this->assertFalse($config->isInProjectDirs(realpath('examples/TemplateScanner.php')));
}

public function testIgnoreWildcardFilesInWildcardFolder(): void
Expand Down Expand Up @@ -328,7 +328,6 @@ public function testIgnoreWildcardFilesInAllPossibleWildcardFolders(): void
$this->assertTrue($config->isInProjectDirs(realpath('src/Psalm/Internal/PhpVisitor/ReflectorVisitor.php')));
$this->assertFalse($config->isInProjectDirs(realpath('src/Psalm/Internal/Analyzer/FileAnalyzer.php')));
$this->assertFalse($config->isInProjectDirs(realpath('src/Psalm/Internal/Analyzer/Statements/ReturnAnalyzer.php')));
$this->assertFalse($config->isInProjectDirs(realpath('examples/StringAnalyzer.php')));
}

public function testIssueHandler(): void
Expand All @@ -352,7 +351,7 @@ public function testIssueHandler(): void

$config = $this->project_analyzer->getConfig();

$this->assertFalse($config->reportIssueInFile('MissingReturnType', realpath('tests/ConfigTest.php')));
$this->assertFalse($config->reportIssueInFile('MissingReturnType', realpath(__FILE__)));
$this->assertFalse($config->reportIssueInFile('MissingReturnType', realpath('src/Psalm/Type.php')));
}

Expand Down