1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

Move config tests into separate dir

This commit is contained in:
Brown 2019-05-09 18:58:30 -04:00
parent d75ac7f55d
commit fe22e83c76
12 changed files with 79 additions and 77 deletions

View File

@ -1,11 +1,11 @@
<?php
namespace Psalm\Tests;
namespace Psalm\Tests\Config;
use Psalm\Config;
use Psalm\Internal\PluginManager\ConfigFile;
/** @group PluginManager */
class ConfigFileTest extends TestCase
class ConfigFileTest extends \Psalm\Tests\TestCase
{
/** @var string */
private $file_path;

View File

@ -1,12 +1,13 @@
<?php
namespace Psalm\Tests;
namespace Psalm\Tests\Config;
use Psalm\Config;
use Psalm\Context;
use Psalm\Internal\Analyzer\FileAnalyzer;
use Psalm\Tests\Internal\Provider;
use Psalm\Tests\TestConfig;
class ConfigTest extends TestCase
class ConfigTest extends \Psalm\Tests\TestCase
{
/** @var TestConfig */
protected static $config;
@ -89,7 +90,7 @@ class ConfigTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
Config::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@ -116,7 +117,7 @@ class ConfigTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
Config::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@ -141,7 +142,7 @@ class ConfigTest extends TestCase
*/
public function testIgnoreSymlinkedProjectDirectory()
{
@unlink(__DIR__ . '/fixtures/symlinktest/ignored/b');
@unlink(dirname(__DIR__, 1) . '/fixtures/symlinktest/ignored/b');
$no_symlinking_error = 'symlink(): Cannot create symlink, error code(1314)';
$last_error = error_get_last();
@ -150,7 +151,7 @@ class ConfigTest extends TestCase
!isset($last_error['message']) ||
$no_symlinking_error !== $last_error['message'];
@symlink(__DIR__ . '/fixtures/symlinktest/a', __DIR__ . '/fixtures/symlinktest/ignored/b');
@symlink(dirname(__DIR__, 1) . '/fixtures/symlinktest/a', dirname(__DIR__, 1) . '/fixtures/symlinktest/ignored/b');
if ($check_symlink_error) {
$last_error = error_get_last();
@ -164,7 +165,7 @@ class ConfigTest extends TestCase
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
Config::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@ -214,7 +215,7 @@ class ConfigTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
Config::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@ -242,7 +243,7 @@ class ConfigTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
Config::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@ -270,7 +271,7 @@ class ConfigTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
Config::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@ -301,7 +302,7 @@ class ConfigTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
Config::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@ -332,7 +333,7 @@ class ConfigTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
Config::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@ -360,7 +361,7 @@ class ConfigTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
Config::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@ -569,7 +570,7 @@ class ConfigTest extends TestCase
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
Config::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@ -594,7 +595,7 @@ class ConfigTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
Config::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@ -619,7 +620,7 @@ class ConfigTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm
requireVoidReturnType="true">
@ -648,7 +649,7 @@ class ConfigTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm
requireVoidReturnType="false">
@ -677,7 +678,7 @@ class ConfigTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm memoizeMethodCallResults="true">
<projectFiles>
@ -725,7 +726,7 @@ class ConfigTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@ -760,7 +761,7 @@ class ConfigTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<exitFunctions>
@ -830,7 +831,7 @@ class ConfigTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm></psalm>'
)
@ -857,7 +858,7 @@ class ConfigTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<forbiddenFunctions>
@ -888,7 +889,7 @@ class ConfigTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm forbidEcho="true"></psalm>'
)
@ -912,7 +913,7 @@ class ConfigTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm></psalm>'
)
@ -940,7 +941,7 @@ class ConfigTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<forbiddenFunctions>
@ -972,7 +973,7 @@ class ConfigTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<issueHandlers>
@ -1024,7 +1025,7 @@ class ConfigTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<issueHandlers>
@ -1073,7 +1074,7 @@ class ConfigTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<issueHandlers>
@ -1127,8 +1128,8 @@ class ConfigTest extends TestCase
{
foreach (['1.xml', '2.xml', '3.xml', '4.xml', '5.xml', '6.xml', '7.xml', '8.xml'] as $file_name) {
Config::loadFromXMLFile(
realpath(dirname(__DIR__) . '/assets/config_levels/' . $file_name),
dirname(__DIR__)
realpath(dirname(__DIR__, 2) . '/assets/config_levels/' . $file_name),
dirname(__DIR__, 2)
);
}
}
@ -1140,7 +1141,7 @@ class ConfigTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<globals>
@ -1238,7 +1239,7 @@ class ConfigTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm checkForThrowsDocblock="true" checkForThrowsInGlobalScope="true">
<ignoreExceptions>
@ -1285,7 +1286,7 @@ class ConfigTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm checkForThrowsDocblock="true" checkForThrowsInGlobalScope="true">
<ignoreExceptions>

View File

@ -1,5 +1,5 @@
<?php
namespace Psalm\Test\Plugin;
namespace Psalm\Test\Config\Plugin;
use Psalm\Plugin;
use SimpleXMLElement;

View File

@ -1,5 +1,5 @@
<?php
namespace Psalm\Test\Plugin;
namespace Psalm\Test\Config\Plugin;
use Psalm\Plugin;
use SimpleXMLElement;

View File

@ -1,5 +1,5 @@
<?php
namespace Psalm\Test\Plugin\Hook;
namespace Psalm\Test\Config\Plugin\Hook;
use Psalm\Codebase;
use Psalm\Plugin\Hook\{

View File

@ -1,5 +1,5 @@
<?php
namespace Psalm\Test\Plugin\Hook;
namespace Psalm\Test\Config\Plugin\Hook;
use PhpParser;
use Psalm\CodeLocation;

View File

@ -1,5 +1,5 @@
<?php
namespace Psalm\Test\Plugin\Hook;
namespace Psalm\Test\Config\Plugin\Hook;
use PhpParser;
use Psalm\CodeLocation;

View File

@ -1,5 +1,5 @@
<?php
namespace Psalm\Test\Plugin\Hook;
namespace Psalm\Test\Config\Plugin\Hook;
use PhpParser;
use Psalm\CodeLocation;

View File

@ -1,5 +1,5 @@
<?php
namespace Psalm\Test\Plugin;
namespace Psalm\Test\Config\Plugin;
use Psalm\Plugin;
use SimpleXMLElement;

View File

@ -1,5 +1,5 @@
<?php
namespace Psalm\Test\Plugin;
namespace Psalm\Test\Config\Plugin;
use Psalm\Plugin;
use SimpleXMLElement;

View File

@ -1,5 +1,5 @@
<?php
namespace Psalm\Tests;
namespace Psalm\Tests\Config;
use Prophecy\Prophecy\ObjectProphecy;
use Psalm\Config;
@ -8,7 +8,7 @@ use Psalm\Internal\PluginManager\ConfigFile;
use Psalm\Internal\PluginManager\PluginList;
/** @group PluginManager */
class PluginListTest extends TestCase
class PluginListTest extends \Psalm\Tests\TestCase
{
/** @var ObjectProphecy<ConfigFile> */
private $config_file;

View File

@ -1,5 +1,5 @@
<?php
namespace Psalm\Tests;
namespace Psalm\Tests\Config;
use Psalm\Codebase;
use Psalm\Config;
@ -8,8 +8,9 @@ use Psalm\Internal\Analyzer\FileAnalyzer;
use Psalm\Plugin\Hook\AfterCodebasePopulatedInterface;
use Psalm\PluginRegistrationSocket;
use Psalm\Tests\Internal\Provider;
use Psalm\Tests\TestConfig;
class PluginTest extends TestCase
class PluginTest extends \Psalm\Tests\TestCase
{
/** @var TestConfig */
protected static $config;
@ -68,7 +69,7 @@ class PluginTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__) . DIRECTORY_SEPARATOR,
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@ -104,7 +105,7 @@ class PluginTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__) . DIRECTORY_SEPARATOR,
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@ -144,7 +145,7 @@ class PluginTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__) . DIRECTORY_SEPARATOR,
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@ -181,7 +182,7 @@ class PluginTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__) . DIRECTORY_SEPARATOR,
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@ -216,7 +217,7 @@ class PluginTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__) . DIRECTORY_SEPARATOR,
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@ -256,7 +257,7 @@ class PluginTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__) . DIRECTORY_SEPARATOR,
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@ -292,7 +293,7 @@ class PluginTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__) . DIRECTORY_SEPARATOR,
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@ -345,7 +346,7 @@ class PluginTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__) . DIRECTORY_SEPARATOR,
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@ -379,7 +380,7 @@ class PluginTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__) . DIRECTORY_SEPARATOR,
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@ -418,7 +419,7 @@ class PluginTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__) . DIRECTORY_SEPARATOR,
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@ -449,11 +450,11 @@ class PluginTest extends TestCase
/** @return void */
public function testInheritedHookHandlersAreCalled()
{
require_once __DIR__ . '/fixtures/stubs/extending_plugin_entrypoint.php';
require_once dirname(__DIR__) . '/fixtures/stubs/extending_plugin_entrypoint.php';
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__) . DIRECTORY_SEPARATOR,
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@ -478,7 +479,7 @@ class PluginTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__) . DIRECTORY_SEPARATOR,
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@ -514,14 +515,14 @@ class PluginTest extends TestCase
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__) . DIRECTORY_SEPARATOR,
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
'<?xml version="1.0"?>
<psalm>
<projectFiles>
<directory name="src" />
</projectFiles>
<plugins>
<pluginClass class="Psalm\\Test\\Plugin\\PropertyPlugin" />
<pluginClass class="Psalm\\Test\\Config\\Plugin\\PropertyPlugin" />
</plugins>
</psalm>'
)
@ -552,14 +553,14 @@ class PluginTest extends TestCase
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__) . DIRECTORY_SEPARATOR,
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
'<?xml version="1.0"?>
<psalm>
<projectFiles>
<directory name="src" />
</projectFiles>
<plugins>
<pluginClass class="Psalm\\Test\\Plugin\\MethodPlugin" />
<pluginClass class="Psalm\\Test\\Config\\Plugin\\MethodPlugin" />
</plugins>
</psalm>'
)
@ -591,14 +592,14 @@ class PluginTest extends TestCase
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__) . DIRECTORY_SEPARATOR,
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
'<?xml version="1.0"?>
<psalm>
<projectFiles>
<directory name="src" />
</projectFiles>
<plugins>
<pluginClass class="Psalm\\Test\\Plugin\\FunctionPlugin" />
<pluginClass class="Psalm\\Test\\Config\\Plugin\\FunctionPlugin" />
</plugins>
</psalm>'
)
@ -629,14 +630,14 @@ class PluginTest extends TestCase
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__) . DIRECTORY_SEPARATOR,
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
'<?xml version="1.0"?>
<psalm>
<projectFiles>
<directory name="src" />
</projectFiles>
<plugins>
<pluginClass class="Psalm\\Test\\Plugin\\PropertyPlugin" />
<pluginClass class="Psalm\\Test\\Config\\Plugin\\PropertyPlugin" />
</plugins>
</psalm>'
)
@ -672,14 +673,14 @@ class PluginTest extends TestCase
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__) . DIRECTORY_SEPARATOR,
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
'<?xml version="1.0"?>
<psalm>
<projectFiles>
<directory name="src" />
</projectFiles>
<plugins>
<pluginClass class="Psalm\\Test\\Plugin\\MethodPlugin" />
<pluginClass class="Psalm\\Test\\Config\\Plugin\\MethodPlugin" />
</plugins>
</psalm>'
)
@ -715,14 +716,14 @@ class PluginTest extends TestCase
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__) . DIRECTORY_SEPARATOR,
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
'<?xml version="1.0"?>
<psalm>
<projectFiles>
<directory name="src" />
</projectFiles>
<plugins>
<pluginClass class="Psalm\\Test\\Plugin\\FunctionPlugin" />
<pluginClass class="Psalm\\Test\\Config\\Plugin\\FunctionPlugin" />
</plugins>
</psalm>'
)
@ -750,14 +751,14 @@ class PluginTest extends TestCase
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__) . DIRECTORY_SEPARATOR,
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
'<?xml version="1.0"?>
<psalm>
<projectFiles>
<directory name="tests/fixtures/DummyProject" />
</projectFiles>
<plugins>
<pluginClass class="Psalm\\Test\\Plugin\\AfterAnalysisPlugin" />
<pluginClass class="Psalm\\Test\\Config\\Plugin\\AfterAnalysisPlugin" />
</plugins>
</psalm>'
)
@ -778,7 +779,7 @@ class PluginTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__) . DIRECTORY_SEPARATOR,
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
sprintf(
'<?xml version="1.0"?>
<psalm>
@ -789,7 +790,7 @@ class PluginTest extends TestCase
<plugin filename="%s/examples/plugins/StringChecker.php" />
</plugins>
</psalm>',
__DIR__.'/..'
__DIR__.'/../..'
)
)
);
@ -807,7 +808,7 @@ class PluginTest extends TestCase
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__) . DIRECTORY_SEPARATOR,
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
sprintf(
'<?xml version="1.0"?>
<psalm>