Skip to content
Permalink
Browse files

Move config tests into separate dir

  • Loading branch information...
muglug committed May 9, 2019
1 parent d75ac7f commit fe22e83c76ac08baf4a64fbf505967dacbff4d39
@@ -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;
@@ -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 @@ public function testIgnoreProjectDirectory()
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
Config::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@@ -116,7 +117,7 @@ public function testIgnoreMissingProjectDirectory()
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
Config::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@@ -141,7 +142,7 @@ public function testIgnoreMissingProjectDirectory()
*/
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 @@ public function testIgnoreSymlinkedProjectDirectory()
!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 @@ public function testIgnoreSymlinkedProjectDirectory()
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
Config::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@@ -214,7 +215,7 @@ public function testIgnoreWildcardProjectDirectory()
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
Config::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@@ -242,7 +243,7 @@ public function testIgnoreWildcardFiles()
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
Config::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@@ -270,7 +271,7 @@ public function testIgnoreWildcardFilesInWildcardFolder()
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
Config::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@@ -301,7 +302,7 @@ public function testIgnoreWildcardFilesInAllPossibleWildcardFolders()
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
Config::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@@ -332,7 +333,7 @@ public function testIssueHandler()
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
Config::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@@ -360,7 +361,7 @@ public function testIssueHandlerWithCustomErrorLevels()
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
Config::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@@ -569,7 +570,7 @@ function ($issue_name) {
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
Config::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@@ -594,7 +595,7 @@ public function testImpossibleIssue()
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
Config::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@@ -619,7 +620,7 @@ public function testRequireVoidReturnTypeExists()
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm
requireVoidReturnType="true">
@@ -648,7 +649,7 @@ public function testDoNotRequireVoidReturnTypeExists()
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm
requireVoidReturnType="false">
@@ -677,7 +678,7 @@ public function testMethodCallMemoize()
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm memoizeMethodCallResults="true">
<projectFiles>
@@ -725,7 +726,7 @@ public function testThing()
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<projectFiles>
@@ -760,7 +761,7 @@ public function testExitFunctions()
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<exitFunctions>
@@ -830,7 +831,7 @@ public function testAllowedEchoFunction()
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm></psalm>'
)
@@ -857,7 +858,7 @@ public function testForbiddenEchoFunctionViaFunctions()
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<forbiddenFunctions>
@@ -888,7 +889,7 @@ public function testForbiddenEchoFunctionViaFlag()
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm forbidEcho="true"></psalm>'
)
@@ -912,7 +913,7 @@ public function testAllowedVarExportFunction()
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm></psalm>'
)
@@ -940,7 +941,7 @@ public function testForbiddenVarExportFunction()
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<forbiddenFunctions>
@@ -972,7 +973,7 @@ public function testValidThrowInvalidCatch()
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<issueHandlers>
@@ -1024,7 +1025,7 @@ public function testInvalidThrowValidCatch()
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<issueHandlers>
@@ -1073,7 +1074,7 @@ public function testValidThrowValidCatch()
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<issueHandlers>
@@ -1127,8 +1128,8 @@ public function testTemplatedFiles()
{
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 @@ public function testGlobals()
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm>
<globals>
@@ -1238,7 +1239,7 @@ public function testIgnoreExceptions()
{
$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 @@ public function testNotIgnoredException()
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
dirname(__DIR__, 2),
'<?xml version="1.0"?>
<psalm checkForThrowsDocblock="true" checkForThrowsInGlobalScope="true">
<ignoreExceptions>
@@ -1,5 +1,5 @@
<?php
namespace Psalm\Test\Plugin;
namespace Psalm\Test\Config\Plugin;
use Psalm\Plugin;
use SimpleXMLElement;
@@ -1,5 +1,5 @@
<?php
namespace Psalm\Test\Plugin;
namespace Psalm\Test\Config\Plugin;
use Psalm\Plugin;
use SimpleXMLElement;
@@ -1,5 +1,5 @@
<?php
namespace Psalm\Test\Plugin\Hook;
namespace Psalm\Test\Config\Plugin\Hook;
use Psalm\Codebase;
use Psalm\Plugin\Hook\{
@@ -1,5 +1,5 @@
<?php
namespace Psalm\Test\Plugin\Hook;
namespace Psalm\Test\Config\Plugin\Hook;
use PhpParser;
use Psalm\CodeLocation;
@@ -1,5 +1,5 @@
<?php
namespace Psalm\Test\Plugin\Hook;
namespace Psalm\Test\Config\Plugin\Hook;
use PhpParser;
use Psalm\CodeLocation;
@@ -1,5 +1,5 @@
<?php
namespace Psalm\Test\Plugin\Hook;
namespace Psalm\Test\Config\Plugin\Hook;
use PhpParser;
use Psalm\CodeLocation;
@@ -1,5 +1,5 @@
<?php
namespace Psalm\Test\Plugin;
namespace Psalm\Test\Config\Plugin;
use Psalm\Plugin;
use SimpleXMLElement;
@@ -1,5 +1,5 @@
<?php
namespace Psalm\Test\Plugin;
namespace Psalm\Test\Config\Plugin;
use Psalm\Plugin;
use SimpleXMLElement;
@@ -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\PluginList;
/** @group PluginManager */
class PluginListTest extends TestCase
class PluginListTest extends \Psalm\Tests\TestCase
{
/** @var ObjectProphecy<ConfigFile> */
private $config_file;

0 comments on commit fe22e83

Please sign in to comment.
You can’t perform that action at this time.