mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Fix tests
This commit is contained in:
parent
8cbbfbf58b
commit
580d3e2b61
@ -595,60 +595,6 @@ class ConfigTest extends \Psalm\Tests\TestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function testRequireVoidReturnTypeExists(): void
|
||||
{
|
||||
$this->expectExceptionMessage('MissingReturnType');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
TestConfig::loadFromXML(
|
||||
dirname(__DIR__, 2),
|
||||
'<?xml version="1.0"?>
|
||||
<psalm
|
||||
requireVoidReturnType="true">
|
||||
<projectFiles>
|
||||
<directory name="src" />
|
||||
</projectFiles>
|
||||
</psalm>'
|
||||
)
|
||||
);
|
||||
|
||||
$file_path = getcwd() . '/src/somefile.php';
|
||||
|
||||
$this->addFile(
|
||||
$file_path,
|
||||
'<?php
|
||||
function foo() {}'
|
||||
);
|
||||
|
||||
$this->analyzeFile($file_path, new Context());
|
||||
}
|
||||
|
||||
public function testDoNotRequireVoidReturnTypeExists(): void
|
||||
{
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
TestConfig::loadFromXML(
|
||||
dirname(__DIR__, 2),
|
||||
'<?xml version="1.0"?>
|
||||
<psalm
|
||||
requireVoidReturnType="false">
|
||||
<projectFiles>
|
||||
<directory name="src" />
|
||||
</projectFiles>
|
||||
</psalm>'
|
||||
)
|
||||
);
|
||||
|
||||
$file_path = getcwd() . '/src/somefile.php';
|
||||
|
||||
$this->addFile(
|
||||
$file_path,
|
||||
'<?php
|
||||
function foo() {}'
|
||||
);
|
||||
|
||||
$this->analyzeFile($file_path, new Context());
|
||||
}
|
||||
|
||||
public function testThing(): void
|
||||
{
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
|
@ -170,7 +170,7 @@ class PsalmEndToEndTest extends TestCase
|
||||
$this->runPsalmInit(1);
|
||||
$psalmXmlContent = file_get_contents(self::$tmpDir . '/psalm.xml');
|
||||
$count = 0;
|
||||
$psalmXmlContent = preg_replace('/resolveFromConfigFile="true"/', '', $psalmXmlContent, -1, $count);
|
||||
$psalmXmlContent = preg_replace('/resolveFromConfigFile="true"/', 'resolveFromConfigFile="false"', $psalmXmlContent, -1, $count);
|
||||
$this->assertEquals(1, $count);
|
||||
|
||||
file_put_contents(self::$tmpDir . '/src/psalm.xml', $psalmXmlContent);
|
||||
|
Loading…
x
Reference in New Issue
Block a user