Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kkmuffme committed Aug 24, 2022
1 parent 7373465 commit e8e43d2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Psalm/Internal/Provider/ParserCacheProvider.php
Expand Up @@ -253,8 +253,10 @@ public function cacheFileContents(string $file_path, string $file_contents): voi

public function deleteOldParserCaches(float $time_before): int
{
// bug in tests, cannot use $this->config, https://github.com/vimeo/psalm/pull/8415#issuecomment-1216982800
$cache_directory = Config::getInstance()->getCacheDirectory();
$cache_directory = $this->config->getCacheDirectory();

$this->existing_file_content_hashes = null;
$this->new_file_content_hashes = [];

if (!$cache_directory) {
return 0;
Expand Down
12 changes: 12 additions & 0 deletions tests/Internal/Provider/ParserInstanceCacheProvider.php
Expand Up @@ -82,6 +82,18 @@ public function cacheFileContents(string $file_path, string $file_contents): voi
$this->file_contents_cache[$file_path] = $file_contents;
}

public function deleteOldParserCaches(): int
{
$this->existing_file_content_hashes = null;
$this->new_file_content_hashes = [];

$this->file_contents_cache = [];
$this->file_content_hash = [];
$this->statements_cache = [];
$this->statements_cache_time = [];
return 0;
}

public function saveFileContentHashes(): void
{
}
Expand Down

0 comments on commit e8e43d2

Please sign in to comment.