1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Fix tests

This commit is contained in:
Matt Brown 2020-10-05 10:14:39 -04:00 committed by Daniil Gentili
parent 8cbbfbf58b
commit 580d3e2b61
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
2 changed files with 1 additions and 55 deletions

View File

@ -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(

View File

@ -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);