Skip to content

Commit

Permalink
Enable store_node_types for all test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
edsrzf committed Feb 19, 2023
1 parent c8393bd commit d4a57c8
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 31 deletions.
31 changes: 0 additions & 31 deletions tests/ClosureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Psalm\Tests;

use Psalm\Context;
use Psalm\Tests\Traits\InvalidCodeAnalysisTestTrait;
use Psalm\Tests\Traits\ValidCodeAnalysisTestTrait;

Expand All @@ -13,36 +12,6 @@ class ClosureTest extends TestCase
use InvalidCodeAnalysisTestTrait;
use ValidCodeAnalysisTestTrait;

public function testLanguageServerFirstClassCallable(): void
{
$code = '<?php
function foo(): void {}
class A {
public static function publicStatic(): void {}
public function publicMethod(): void {}
}
foo(...);
A::publicStatic(...);
(new A())->publicMethod(...);
';

$context = new Context();

$this->project_analyzer->setPhpVersion('8.1.0', 'tests');

$codebase = $this->project_analyzer->getCodebase();
$codebase->enterServerMode();
$codebase->config->visitPreloadedStubFiles($codebase);

$file_path = self::$src_dir_path . 'somefile.php';

$this->addFile($file_path, $code);
$this->analyzeFile($file_path, $context);
}

public function providerValidCodeParse(): iterable
{
return [
Expand Down
1 change: 1 addition & 0 deletions tests/Traits/InvalidCodeAnalysisTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public function testInvalidCode(
$this->expectExceptionMessageMatches('/\b' . preg_quote($error_message, '/') . '\b/');

$codebase = $this->project_analyzer->getCodebase();
$codebase->enterServerMode();
$codebase->config->visitPreloadedStubFiles($codebase);

$this->addFile($file_path, $code);
Expand Down
1 change: 1 addition & 0 deletions tests/Traits/ValidCodeAnalysisTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public function testValidCode(
$this->project_analyzer->setPhpVersion($php_version, 'tests');

$codebase = $this->project_analyzer->getCodebase();
$codebase->enterServerMode();
$codebase->config->visitPreloadedStubFiles($codebase);

$file_path = self::$src_dir_path . 'somefile.php';
Expand Down

0 comments on commit d4a57c8

Please sign in to comment.