Skip to content

Commit

Permalink
Move AbstractRuleTestCase and TestHelper to src
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharylund committed Oct 10, 2024
1 parent a0e552f commit c3736b6
Show file tree
Hide file tree
Showing 38 changed files with 42 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .phpstan/ExceptionTypeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function __construct(private DefaultExceptionTypeResolver $defaultExcepti
public function isCheckedException(string $className, Scope $scope): bool
{
$namespace = $scope->getNamespace();
if (null !== $namespace && str_starts_with($namespace, 'TwigCsFixer\Tests')) {
if (null !== $namespace && str_starts_with($namespace, 'TwigCsFixer\Test')) {
return false;
}

Expand Down
5 changes: 5 additions & 0 deletions composer-dependency-analyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@

return $config
->addPathToScan(__DIR__.'/bin/twig-cs-fixer', isDev: false)
->ignoreErrorsOnPackageAndPath(
'phpunit/phpunit',
__DIR__.'/src/Test/AbstractRuleTestCase.php',
[ErrorType::DEV_DEPENDENCY_IN_PROD]
)
->ignoreErrorsOnPackageAndPath(
'symfony/twig-bridge',
__DIR__.'/src/Environment/StubbedEnvironment.php',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace TwigCsFixer\Tests\Rules;
namespace TwigCsFixer\Test;

use PHPUnit\Framework\TestCase;
use TwigCsFixer\Environment\StubbedEnvironment;
Expand All @@ -12,7 +12,6 @@
use TwigCsFixer\Ruleset\Ruleset;
use TwigCsFixer\Runner\Fixer;
use TwigCsFixer\Runner\Linter;
use TwigCsFixer\Tests\TestHelper;
use TwigCsFixer\Token\Tokenizer;

abstract class AbstractRuleTestCase extends TestCase
Expand Down
2 changes: 1 addition & 1 deletion tests/TestHelper.php → src/Test/TestHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace TwigCsFixer\Tests;
namespace TwigCsFixer\Test;

final class TestHelper
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Binary/TwigCsFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
use Composer\InstalledVersions;
use Symfony\Component\Process\Process;
use TwigCsFixer\Console\Application;
use TwigCsFixer\Test\TestHelper;
use TwigCsFixer\Tests\FileTestCase;
use TwigCsFixer\Tests\TestHelper;

/**
* @group skip-windows
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
declare(strict_types=1);

use TwigCsFixer\Config\Config;
use TwigCsFixer\Tests\TestHelper;
use TwigCsFixer\Test\TestHelper;

$config = new Config('Custom');
$config->setCacheFile(TestHelper::getOsPath(__DIR__.'/.twig-cs-fixer.cache'));
Expand Down
2 changes: 1 addition & 1 deletion tests/Console/Command/TwigCsFixerCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
use TwigCsFixer\Cache\Signature;
use TwigCsFixer\Config\Config;
use TwigCsFixer\Console\Command\TwigCsFixerCommand;
use TwigCsFixer\Test\TestHelper;
use TwigCsFixer\Tests\FileTestCase;
use TwigCsFixer\Tests\TestHelper;

final class TwigCsFixerCommandTest extends FileTestCase
{
Expand Down
1 change: 1 addition & 0 deletions tests/FileTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use PHPUnit\Framework\TestCase;
use Symfony\Component\Filesystem\Exception\IOException;
use Symfony\Component\Filesystem\Filesystem;
use TwigCsFixer\Test\TestHelper;
use Webmozart\Assert\Assert;

abstract class FileTestCase extends TestCase
Expand Down
2 changes: 1 addition & 1 deletion tests/Report/Reporter/CheckstyleReporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use TwigCsFixer\Report\Reporter\CheckstyleReporter;
use TwigCsFixer\Report\Violation;
use TwigCsFixer\Report\ViolationId;
use TwigCsFixer\Tests\TestHelper;
use TwigCsFixer\Test\TestHelper;

final class CheckstyleReporterTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Report/Reporter/GithubReporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use TwigCsFixer\Report\Reporter\GithubReporter;
use TwigCsFixer\Report\Violation;
use TwigCsFixer\Report\ViolationId;
use TwigCsFixer\Tests\TestHelper;
use TwigCsFixer\Test\TestHelper;

final class GithubReporterTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Report/Reporter/JUnitReporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use TwigCsFixer\Report\Reporter\JUnitReporter;
use TwigCsFixer\Report\Violation;
use TwigCsFixer\Report\ViolationId;
use TwigCsFixer\Tests\TestHelper;
use TwigCsFixer\Test\TestHelper;

final class JUnitReporterTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Report/Reporter/NullReporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use TwigCsFixer\Report\Report;
use TwigCsFixer\Report\Reporter\NullReporter;
use TwigCsFixer\Report\Violation;
use TwigCsFixer\Tests\TestHelper;
use TwigCsFixer\Test\TestHelper;

final class NullReporterTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Report/Reporter/TextReporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use TwigCsFixer\Report\Reporter\TextReporter;
use TwigCsFixer\Report\Violation;
use TwigCsFixer\Report\ViolationId;
use TwigCsFixer\Tests\TestHelper;
use TwigCsFixer\Test\TestHelper;

final class TextReporterTest extends TestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace TwigCsFixer\Tests\Rules\Delimiter\BlockNameSpacing;

use TwigCsFixer\Rules\Delimiter\BlockNameSpacingRule;
use TwigCsFixer\Tests\Rules\AbstractRuleTestCase;
use TwigCsFixer\Test\AbstractRuleTestCase;

final class BlockNameSpacingRuleTest extends AbstractRuleTestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace TwigCsFixer\Tests\Rules\Delimiter\DelimiterSpacing;

use TwigCsFixer\Rules\Delimiter\DelimiterSpacingRule;
use TwigCsFixer\Tests\Rules\AbstractRuleTestCase;
use TwigCsFixer\Test\AbstractRuleTestCase;

final class DelimiterSpacingRuleTest extends AbstractRuleTestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Rules/File/DirectoryName/DirectoryNameRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace TwigCsFixer\Tests\Rules\File\DirectoryName;

use TwigCsFixer\Rules\File\DirectoryNameRule;
use TwigCsFixer\Tests\Rules\AbstractRuleTestCase;
use TwigCsFixer\Test\AbstractRuleTestCase;

final class DirectoryNameRuleTest extends AbstractRuleTestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Rules/File/FileExtension/FileExtensionRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace TwigCsFixer\Tests\Rules\File\FileExtension;

use TwigCsFixer\Rules\File\FileExtensionRule;
use TwigCsFixer\Tests\Rules\AbstractRuleTestCase;
use TwigCsFixer\Test\AbstractRuleTestCase;

final class FileExtensionRuleTest extends AbstractRuleTestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Rules/File/FileName/FileNameRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace TwigCsFixer\Tests\Rules\File\FileName;

use TwigCsFixer\Rules\File\FileNameRule;
use TwigCsFixer\Tests\Rules\AbstractRuleTestCase;
use TwigCsFixer\Test\AbstractRuleTestCase;

final class FileNameRuleTest extends AbstractRuleTestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use TwigCsFixer\Rules\Function\IncludeFunctionRule;
use TwigCsFixer\Rules\Punctuation\PunctuationSpacingRule;
use TwigCsFixer\Tests\Rules\AbstractRuleTestCase;
use TwigCsFixer\Test\AbstractRuleTestCase;

final class IncludeFunctionRuleTest extends AbstractRuleTestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Rules/Function/NamedArgumentSeparatorRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Composer\InstalledVersions;
use Composer\Semver\VersionParser;
use TwigCsFixer\Rules\Function\NamedArgumentSeparatorRule;
use TwigCsFixer\Tests\Rules\AbstractRuleTestCase;
use TwigCsFixer\Test\AbstractRuleTestCase;

final class NamedArgumentSeparatorRuleTest extends AbstractRuleTestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace TwigCsFixer\Tests\Rules\Function\NamedArgumentSpacing;

use TwigCsFixer\Rules\Function\NamedArgumentSpacingRule;
use TwigCsFixer\Tests\Rules\AbstractRuleTestCase;
use TwigCsFixer\Test\AbstractRuleTestCase;

final class NamedArgumentSpacingRuleTest extends AbstractRuleTestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Rules/Node/ForbiddenBlock/ForbiddenBlockRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace TwigCsFixer\Tests\Rules\Node\ForbiddenBlock;

use TwigCsFixer\Rules\Node\ForbiddenBlockRule;
use TwigCsFixer\Tests\Rules\AbstractRuleTestCase;
use TwigCsFixer\Test\AbstractRuleTestCase;

final class ForbiddenBlockRuleTest extends AbstractRuleTestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace TwigCsFixer\Tests\Rules\Node\ForbiddenFilter;

use TwigCsFixer\Rules\Node\ForbiddenFilterRule;
use TwigCsFixer\Tests\Rules\AbstractRuleTestCase;
use TwigCsFixer\Test\AbstractRuleTestCase;

final class ForbiddenFilterRuleTest extends AbstractRuleTestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace TwigCsFixer\Tests\Rules\Node\ForbiddenFunction;

use TwigCsFixer\Rules\Node\ForbiddenFunctionRule;
use TwigCsFixer\Tests\Rules\AbstractRuleTestCase;
use TwigCsFixer\Test\AbstractRuleTestCase;

final class ForbiddenFunctionRuleTest extends AbstractRuleTestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace TwigCsFixer\Tests\Rules\Node\ValidConstantFunction;

use TwigCsFixer\Rules\Node\ValidConstantFunctionRule;
use TwigCsFixer\Tests\Rules\AbstractRuleTestCase;
use TwigCsFixer\Test\AbstractRuleTestCase;

final class ValidConstantFunctionRuleTest extends AbstractRuleTestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace TwigCsFixer\Tests\Rules\Operator\OperatorNameSpacing;

use TwigCsFixer\Rules\Operator\OperatorNameSpacingRule;
use TwigCsFixer\Tests\Rules\AbstractRuleTestCase;
use TwigCsFixer\Test\AbstractRuleTestCase;

final class OperatorNameSpacingRuleTest extends AbstractRuleTestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace TwigCsFixer\Tests\Rules\Operator\OperatorSpacing;

use TwigCsFixer\Rules\Operator\OperatorSpacingRule;
use TwigCsFixer\Tests\Rules\AbstractRuleTestCase;
use TwigCsFixer\Test\AbstractRuleTestCase;

final class OperatorSpacingRuleTest extends AbstractRuleTestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace TwigCsFixer\Tests\Rules\Punctuation\PunctuationSpacing;

use TwigCsFixer\Rules\Punctuation\PunctuationSpacingRule;
use TwigCsFixer\Tests\Rules\AbstractRuleTestCase;
use TwigCsFixer\Test\AbstractRuleTestCase;

final class PunctuationSpacingRuleTest extends AbstractRuleTestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace TwigCsFixer\Tests\Rules\Punctuation\TrailingCommaMultiLine;

use TwigCsFixer\Rules\Punctuation\TrailingCommaMultiLineRule;
use TwigCsFixer\Tests\Rules\AbstractRuleTestCase;
use TwigCsFixer\Test\AbstractRuleTestCase;

final class TrailingCommaMultiLineRuleTest extends AbstractRuleTestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace TwigCsFixer\Tests\Rules\Punctuation\TrailingCommaSingleLine;

use TwigCsFixer\Rules\Punctuation\TrailingCommaSingleLineRule;
use TwigCsFixer\Tests\Rules\AbstractRuleTestCase;
use TwigCsFixer\Test\AbstractRuleTestCase;

final class TrailingCommaSingleLineRuleTest extends AbstractRuleTestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Rules/String/HashQuote/HashQuoteRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace TwigCsFixer\Tests\Rules\String\HashQuote;

use TwigCsFixer\Rules\String\HashQuoteRule;
use TwigCsFixer\Tests\Rules\AbstractRuleTestCase;
use TwigCsFixer\Test\AbstractRuleTestCase;

final class HashQuoteRuleTest extends AbstractRuleTestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Rules/String/SimpleQuote/SingleQuoteRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace TwigCsFixer\Tests\Rules\String\SimpleQuote;

use TwigCsFixer\Rules\String\SingleQuoteRule;
use TwigCsFixer\Tests\Rules\AbstractRuleTestCase;
use TwigCsFixer\Test\AbstractRuleTestCase;

final class SingleQuoteRuleTest extends AbstractRuleTestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Rules/Variable/VariableName/VariableNameRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace TwigCsFixer\Tests\Rules\Variable\VariableName;

use TwigCsFixer\Rules\Variable\VariableNameRule;
use TwigCsFixer\Tests\Rules\AbstractRuleTestCase;
use TwigCsFixer\Test\AbstractRuleTestCase;

final class VariableNameRuleTest extends AbstractRuleTestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Rules/Whitespace/BlankEOF/BlankEOFRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace TwigCsFixer\Tests\Rules\Whitespace\BlankEOF;

use TwigCsFixer\Rules\Whitespace\BlankEOFRule;
use TwigCsFixer\Tests\Rules\AbstractRuleTestCase;
use TwigCsFixer\Test\AbstractRuleTestCase;

final class BlankEOFRuleTest extends AbstractRuleTestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Rules/Whitespace/EmptyLines/EmptyLinesRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace TwigCsFixer\Tests\Rules\Whitespace\EmptyLines;

use TwigCsFixer\Rules\Whitespace\EmptyLinesRule;
use TwigCsFixer\Tests\Rules\AbstractRuleTestCase;
use TwigCsFixer\Test\AbstractRuleTestCase;

final class EmptyLinesRuleTest extends AbstractRuleTestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Rules/Whitespace/Indent/IndentRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace TwigCsFixer\Tests\Rules\Whitespace\Indent;

use TwigCsFixer\Rules\Whitespace\IndentRule;
use TwigCsFixer\Tests\Rules\AbstractRuleTestCase;
use TwigCsFixer\Test\AbstractRuleTestCase;

final class IndentRuleTest extends AbstractRuleTestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace TwigCsFixer\Tests\Rules\Whitespace\TrailingSpace;

use TwigCsFixer\Rules\Whitespace\TrailingSpaceRule;
use TwigCsFixer\Tests\Rules\AbstractRuleTestCase;
use TwigCsFixer\Test\AbstractRuleTestCase;

final class TrailingSpaceRuleTest extends AbstractRuleTestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Token/Tokenizer/TokenizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use TwigCsFixer\Environment\StubbedEnvironment;
use TwigCsFixer\Exception\CannotTokenizeException;
use TwigCsFixer\Report\ViolationId;
use TwigCsFixer\Tests\TestHelper;
use TwigCsFixer\Test\TestHelper;
use TwigCsFixer\Tests\Token\Tokenizer\Fixtures\CustomTwigExtension;
use TwigCsFixer\Token\Token;
use TwigCsFixer\Token\Tokenizer;
Expand Down

0 comments on commit c3736b6

Please sign in to comment.