Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] Improve test case inheritance chain #883

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tests/BaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
*
* Don't subclass this test case but rather choose a more specialized base test case,
* such as UnitTestCase or FunctionalTestCase
*
* @deprecated Will be removed in v4. Update .gitattributes to fully exclude tests/
*/
abstract class BaseTestCase extends TestCase
{
Expand Down
11 changes: 4 additions & 7 deletions tests/Functional/AbstractFunctionalTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

namespace TYPO3Fluid\Fluid\Tests\Functional;

use PHPUnit\Framework\TestCase;
use TYPO3Fluid\Fluid\Core\Cache\FluidCacheInterface;
use TYPO3Fluid\Fluid\Core\Cache\SimpleFileCache;
use TYPO3Fluid\Fluid\Tests\BaseTestCase;

/**
* Base test case for functional tests.
Expand All @@ -27,17 +27,14 @@
* exported as package file. Extensions with own view helpers can not rely on it as test base.
* This may change in case this abstract stabilizes, later.
*/
abstract class AbstractFunctionalTestCase extends BaseTestCase
abstract class AbstractFunctionalTestCase extends TestCase
{
/**
* @var FluidCacheInterface
*/
protected static $cache;
protected static FluidCacheInterface $cache;

/**
* @var string Absolute path to cache directory
*/
protected static $cachePath;
protected static string $cachePath;

public static function setUpBeforeClass(): void
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/Cases/Escaping/ViewHelperEscapingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContext;
use TYPO3Fluid\Fluid\Core\Variables\StandardVariableProvider;
use TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperInterface;
use TYPO3Fluid\Fluid\Tests\BaseTestCase;
use TYPO3Fluid\Fluid\Tests\Functional\AbstractFunctionalTestCase;
use TYPO3Fluid\Fluid\Tests\Functional\Fixtures\Various\TestViewHelperResolver;
use TYPO3Fluid\Fluid\Tests\Functional\Fixtures\ViewHelpers\MutableTestViewHelper;
use TYPO3Fluid\Fluid\Tests\Functional\Fixtures\ViewHelpers\TagBasedTestViewHelper;
use TYPO3Fluid\Fluid\View\TemplateView;

final class ViewHelperEscapingTest extends BaseTestCase
final class ViewHelperEscapingTest extends AbstractFunctionalTestCase
{
private const UNESCAPED = '<script>alert(1)</script>';
private const ESCAPED = '&lt;script&gt;alert(1)&lt;/script&gt;';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
use TYPO3Fluid\Fluid\Core\Parser\TemplateProcessor\NamespaceDetectionTemplateProcessor;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContext;
use TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperResolver;
use TYPO3Fluid\Fluid\Tests\UnitTestCase;
use TYPO3Fluid\Fluid\Tests\Functional\AbstractFunctionalTestCase;

final class NamespaceDetectionTemplateProcessorTest extends UnitTestCase
final class NamespaceDetectionTemplateProcessorTest extends AbstractFunctionalTestCase
{
public static function preProcessSourceExtractsNamespacesDataProvider(): array
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

use PHPUnit\Framework\Attributes\Test;
use TYPO3Fluid\Fluid\Core\Exception;
use TYPO3Fluid\Fluid\Tests\Functional\AbstractFunctionalTestCase;
use TYPO3Fluid\Fluid\Tests\Functional\Core\ViewHelper\Traits\Fixtures\CompileWithContentArgumentAndRenderStaticTestTraitViewHelper;
use TYPO3Fluid\Fluid\Tests\UnitTestCase;

final class CompileWithContentArgumentAndRenderStaticTest extends UnitTestCase
final class CompileWithContentArgumentAndRenderStaticTest extends AbstractFunctionalTestCase
{
#[Test]
public function resolveContentArgumentNameThrowsExceptionIfNoArgumentsAvailable(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Core/Cache/FluidCacheWarmupResultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
namespace TYPO3Fluid\Fluid\Tests\Unit\Core\Cache;

use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use TYPO3Fluid\Fluid\Core\Cache\FluidCacheWarmupResult;
use TYPO3Fluid\Fluid\Core\Compiler\FailedCompilingState;
use TYPO3Fluid\Fluid\Core\Parser\ParsedTemplateInterface;
use TYPO3Fluid\Fluid\Tests\UnitTestCase;

final class FluidCacheWarmupResultTest extends UnitTestCase
final class FluidCacheWarmupResultTest extends TestCase
{
#[Test]
public function mergeCombinesTwoResults(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Core/Cache/StandardCacheWarmerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use TYPO3Fluid\Fluid\Core\Cache\StandardCacheWarmer;
use TYPO3Fluid\Fluid\Core\Compiler\StopCompilingException;
use TYPO3Fluid\Fluid\Core\Parser\Exception;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\Expression\ExpressionException;
use TYPO3Fluid\Fluid\Core\Parser\TemplateParser;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\Variables\StandardVariableProvider;
use TYPO3Fluid\Fluid\Tests\UnitTestCase;
use TYPO3Fluid\Fluid\View\TemplatePaths;

final class StandardCacheWarmerTest extends UnitTestCase
final class StandardCacheWarmerTest extends TestCase
{
#[Test]
public function testDetectControllerNamesInTemplateRootPaths(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Core/Compiler/AbstractCompiledTemplateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
namespace TYPO3Fluid\Fluid\Tests\Unit\Core\Compiler;

use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContext;
use TYPO3Fluid\Fluid\Core\Variables\StandardVariableProvider;
use TYPO3Fluid\Fluid\Tests\Unit\Core\Compiler\Fixtures\AbstractCompiledTemplateTestFixture;
use TYPO3Fluid\Fluid\Tests\UnitTestCase;

class AbstractCompiledTemplateTest extends UnitTestCase
class AbstractCompiledTemplateTest extends TestCase
{
#[Test]
public function setIdentifierDoesNotChangeObject(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Core/Compiler/FailedCompilingStateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
namespace TYPO3Fluid\Fluid\Tests\Unit\Core\Compiler;

use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use TYPO3Fluid\Fluid\Core\Compiler\FailedCompilingState;
use TYPO3Fluid\Fluid\Tests\UnitTestCase;

final class FailedCompilingStateTest extends UnitTestCase
final class FailedCompilingStateTest extends TestCase
{
#[Test]
public function getFailureReasonReturnsPreviouslySetFailureReason(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
namespace TYPO3Fluid\Fluid\Tests\Unit\Core\Compiler;

use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use TYPO3Fluid\Fluid\Core\Compiler\StopCompilingChildrenException;
use TYPO3Fluid\Fluid\Tests\UnitTestCase;

/**
* @deprecated Remove together with StopCompilingChildrenException
*/
final class StopCompilingChildrenExceptionTest extends UnitTestCase
final class StopCompilingChildrenExceptionTest extends TestCase
{
#[Test]
public function setAndGetReplacementString(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Core/Compiler/TemplateCompilerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
namespace TYPO3Fluid\Fluid\Tests\Unit\Core\Compiler;

use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use TYPO3Fluid\Fluid\Core\Cache\SimpleFileCache;
use TYPO3Fluid\Fluid\Core\Compiler\StopCompilingException;
use TYPO3Fluid\Fluid\Core\Compiler\TemplateCompiler;
use TYPO3Fluid\Fluid\Core\Parser\ParsingState;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\TextNode;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\ViewHelperNode;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Tests\UnitTestCase;

final class TemplateCompilerTest extends UnitTestCase
final class TemplateCompilerTest extends TestCase
{
#[Test]
public function isWarmupModeReturnsTrueAfterEnterWarmupModeHasBeenCalled(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Core/Parser/BooleanParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use TYPO3Fluid\Fluid\Core\Parser\BooleanParser;
use TYPO3Fluid\Fluid\Core\Parser\Exception;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\BooleanNode;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContext;
use TYPO3Fluid\Fluid\Tests\UnitTestCase;

final class BooleanParserTest extends UnitTestCase
final class BooleanParserTest extends TestCase
{
public static function getSomeEvaluationTestValues(): array
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Core/Parser/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
namespace TYPO3Fluid\Fluid\Tests\Unit\Core\Parser;

use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use TYPO3Fluid\Fluid\Core\Parser\Configuration;
use TYPO3Fluid\Fluid\Core\Parser\Interceptor\Escape;
use TYPO3Fluid\Fluid\Core\Parser\InterceptorInterface;
use TYPO3Fluid\Fluid\Tests\UnitTestCase;

final class ConfigurationTest extends UnitTestCase
final class ConfigurationTest extends TestCase
{
#[Test]
public function testAddInterceptor(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Core/Parser/Interceptor/EscapeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
namespace TYPO3Fluid\Fluid\Tests\Unit\Core\Parser\Interceptor;

use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use TYPO3Fluid\Fluid\Core\Parser\Interceptor\Escape;
use TYPO3Fluid\Fluid\Core\Parser\InterceptorInterface;
use TYPO3Fluid\Fluid\Core\Parser\ParsingState;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\EscapingNode;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\ObjectAccessorNode;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\ViewHelperNode;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Tests\UnitTestCase;

final class EscapeTest extends UnitTestCase
final class EscapeTest extends TestCase
{
#[Test]
public function processDoesNotDisableEscapingInterceptorByDefault(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Core/Parser/ParsingStateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
namespace TYPO3Fluid\Fluid\Tests\Unit\Core\Parser;

use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use TYPO3Fluid\Fluid\Core\Parser\ParsingState;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\RootNode;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContext;
use TYPO3Fluid\Fluid\Core\Variables\StandardVariableProvider;
use TYPO3Fluid\Fluid\Tests\UnitTestCase;

final class ParsingStateTest extends UnitTestCase
final class ParsingStateTest extends TestCase
{
#[Test]
public function getIdentifierReturnsPreviouslySetIdentifier(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Core/Parser/SyntaxTree/AbstractNodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use TYPO3Fluid\Fluid\Core\Parser\Exception;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\AbstractNode;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\NodeInterface;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Tests\Functional\Fixtures\Various\UserWithToString;
use TYPO3Fluid\Fluid\Tests\UnitTestCase;

class AbstractNodeTest extends UnitTestCase
class AbstractNodeTest extends TestCase
{
#[Test]
public function evaluateChildNodesPassesRenderingContextToChildNodes(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Core/Parser/SyntaxTree/BooleanNodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\ArrayNode;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\BooleanNode;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\NodeInterface;
Expand All @@ -21,9 +22,8 @@
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContext;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\Variables\StandardVariableProvider;
use TYPO3Fluid\Fluid\Tests\UnitTestCase;

final class BooleanNodeTest extends UnitTestCase
final class BooleanNodeTest extends TestCase
{
#[Test]
public function convertToBooleanProperlyConvertsValuesOfTypeBoolean(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Core/Parser/SyntaxTree/EscapingNodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
namespace TYPO3Fluid\Fluid\Tests\Unit\Core\Parser\SyntaxTree;

use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\EscapingNode;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\TextNode;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContext;
use TYPO3Fluid\Fluid\Tests\UnitTestCase;

final class EscapingNodeTest extends UnitTestCase
final class EscapingNodeTest extends TestCase
{
#[Test]
public function testEscapesNodeInConstructor(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\Expression\CastingExpressionNode;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\Expression\ExpressionException;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContext;
use TYPO3Fluid\Fluid\Core\Variables\StandardVariableProvider;
use TYPO3Fluid\Fluid\Tests\Functional\Fixtures\Various\UserWithToArray;
use TYPO3Fluid\Fluid\Tests\UnitTestCase;

final class CastingExpressionNodeTest extends UnitTestCase
final class CastingExpressionNodeTest extends TestCase
{
#[Test]
public function testEvaluateDelegatesToEvaluteExpression(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\Expression\MathExpressionNode;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContext;
use TYPO3Fluid\Fluid\Core\Variables\StandardVariableProvider;
use TYPO3Fluid\Fluid\Tests\UnitTestCase;

final class MathExpressionNodeTest extends UnitTestCase
final class MathExpressionNodeTest extends TestCase
{
public static function getEvaluateExpressionTestValues(): array
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Core/Parser/SyntaxTree/NumericNodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
namespace TYPO3Fluid\Fluid\Tests\Unit\Core\Parser\SyntaxTree;

use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use TYPO3Fluid\Fluid\Core\Parser\Exception;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\NumericNode;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContext;
use TYPO3Fluid\Fluid\Tests\UnitTestCase;

final class NumericNodeTest extends UnitTestCase
final class NumericNodeTest extends TestCase
{
#[Test]
public function renderReturnsProperIntegerGivenInConstructor(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Core/Parser/SyntaxTree/ObjectAccessorNodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\ObjectAccessorNode;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\Variables\StandardVariableProvider;
use TYPO3Fluid\Fluid\Tests\UnitTestCase;

final class ObjectAccessorNodeTest extends UnitTestCase
final class ObjectAccessorNodeTest extends TestCase
{
public static function getEvaluateTestValues(): array
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Core/Parser/SyntaxTree/RootNodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
namespace TYPO3Fluid\Fluid\Tests\Unit\Core\Parser\SyntaxTree;

use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\RootNode;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContext;
use TYPO3Fluid\Fluid\Tests\UnitTestCase;

final class RootNodeTest extends UnitTestCase
final class RootNodeTest extends TestCase
{
#[Test]
public function testEvaluateCallsEvaluateChildNodes(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Core/Parser/SyntaxTree/TextNodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
namespace TYPO3Fluid\Fluid\Tests\Unit\Core\Parser\SyntaxTree;

use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\TextNode;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContext;
use TYPO3Fluid\Fluid\Tests\UnitTestCase;

final class TextNodeTest extends UnitTestCase
final class TextNodeTest extends TestCase
{
#[Test]
public function renderReturnsSameStringAsGivenInConstructor(): void
Expand Down
Loading