mirror of
https://github.com/danog/psalm.git
synced 2024-12-15 02:47:02 +01:00
94f934627c
* Add resolveFromConfigFile config option Treats all paths as relative to the location of the config file, not the current working directory of the process. This commit just changes psalm, further commits will be needed to apply the change to psalter and the LSP server. * Copy asset xml files into project root for testing, delete during teardown Needed since paths are now resolved relative to the position of the file. Not sure why I only saw a test failre for 1.xml - would have expected it for all eight files. * Fix following rebase * Move psalm --init handly code above working directory setting code If there's no psalm.xml yet we can't use the location of psalm.xml to set our working directory * Move Psalm version output code above working directory resolution Working directory doesn't need to be known to output version constant * Rely on new config file based working directory in end to end test * Dont use rely on config dir for --alter - not currently working * Fix code style error * Add failing test for supporting config without `resolveFromConfigFile="true"` * Don't treat config directory as a path to check * Document resolveFromConfigFile setting
54 lines
1.2 KiB
PHP
54 lines
1.2 KiB
PHP
<?php
|
|
namespace Psalm\Tests\Config;
|
|
|
|
use const DIRECTORY_SEPARATOR;
|
|
use function dirname;
|
|
use Psalm\Config\Creator;
|
|
|
|
class CreatorTest extends \Psalm\Tests\TestCase
|
|
{
|
|
public static function setUpBeforeClass() : void
|
|
{
|
|
}
|
|
|
|
public function setUp() : void
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @return void
|
|
*/
|
|
public function testDiscoverLibDirectory()
|
|
{
|
|
$lib_contents = Creator::getContents(
|
|
dirname(__DIR__, 1)
|
|
. DIRECTORY_SEPARATOR . 'fixtures'
|
|
. DIRECTORY_SEPARATOR . 'config_discovery'
|
|
. DIRECTORY_SEPARATOR . 'files_in_lib',
|
|
null,
|
|
1
|
|
);
|
|
|
|
$this->assertSame('<?xml version="1.0"?>
|
|
<psalm
|
|
totallyTyped="true"
|
|
resolveFromConfigFile="true"
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xmlns="https://getpsalm.org/schema/config"
|
|
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
|
>
|
|
<projectFiles>
|
|
<directory name="lib" />
|
|
<ignoreFiles>
|
|
<directory name="vendor" />
|
|
</ignoreFiles>
|
|
</projectFiles>
|
|
|
|
<issueHandlers>
|
|
<LessSpecificReturnType errorLevel="info" />
|
|
</issueHandlers>
|
|
</psalm>
|
|
', $lib_contents);
|
|
}
|
|
}
|