From 1da1e2fbe86b1f99f293013e0f2688f5b90ddca0 Mon Sep 17 00:00:00 2001 From: Hannes Bochmann Date: Wed, 3 Jan 2024 13:18:10 +0100 Subject: [PATCH] Cleanup fix tests --- Tests/Classes/AbstractTestCase.php | 2 +- .../GlobalInputSanitizerMiddlewareTest.php | 8 +-- .../Utility/ConfigurationUtilityTest.php | 2 +- Tests/Classes/Utility/DebugUtilityTest.php | 2 +- phpunit.xml.dist | 55 +++++++------------ 5 files changed, 23 insertions(+), 46 deletions(-) diff --git a/Tests/Classes/AbstractTestCase.php b/Tests/Classes/AbstractTestCase.php index 0c792e8..4bc4af3 100644 --- a/Tests/Classes/AbstractTestCase.php +++ b/Tests/Classes/AbstractTestCase.php @@ -128,6 +128,6 @@ protected static function resetDebugger() */ protected static function addRules(array $rules) { - Rules::addRulesForFrontend($rules); + Rules::addRulesForBackend($rules); } } diff --git a/Tests/Classes/Middleware/GlobalInputSanitizerMiddlewareTest.php b/Tests/Classes/Middleware/GlobalInputSanitizerMiddlewareTest.php index 127fe6b..c8238f8 100644 --- a/Tests/Classes/Middleware/GlobalInputSanitizerMiddlewareTest.php +++ b/Tests/Classes/Middleware/GlobalInputSanitizerMiddlewareTest.php @@ -88,8 +88,6 @@ public function processCallsMonitorCorrect() $response->reveal(), $middleware->process($request->reveal(), $handler->reveal()) ); - - self::assertInstanceOf(ServerRequestInterface::class, $GLOBALS['TYPO3_REQUEST']); } /** @@ -99,8 +97,6 @@ public function processCallsMonitorCorrect() */ public function processCallsSanitizerCorrect() { - self::assertNull($GLOBALS['TYPO3_REQUEST'] ?? null); - $this->setExtConf(['stealthMode' => '0']); $middleware = new GlobalInputSanitizerMiddleware(); @@ -138,8 +134,6 @@ public function processCallsSanitizerCorrect() $response->reveal(), $middleware->process($request->reveal(), $handler->reveal()) ); - - self::assertInstanceOf(ServerRequestInterface::class, $GLOBALS['TYPO3_REQUEST']); } /** @@ -189,7 +183,7 @@ function (ServerRequest $cleanedRequest) use ($sanitizedData) { * * @return array[] */ - public function getProcessCallsSanitizerAndSanitizesCorrectByRulesData() + public static function getProcessCallsSanitizerAndSanitizesCorrectByRulesData() { return SanitizerTest::getSanitizeInputData(); } diff --git a/Tests/Classes/Utility/ConfigurationUtilityTest.php b/Tests/Classes/Utility/ConfigurationUtilityTest.php index 40abb1f..bea53ec 100644 --- a/Tests/Classes/Utility/ConfigurationUtilityTest.php +++ b/Tests/Classes/Utility/ConfigurationUtilityTest.php @@ -176,7 +176,7 @@ public function getExtensionConfigurationLoadsCorrect( * * @return array[] */ - public function getExtensionConfigurationLoadsCorrectData() + public static function getExtensionConfigurationLoadsCorrectData() { return [ __LINE__.':1,1,0,14' => [ diff --git a/Tests/Classes/Utility/DebugUtilityTest.php b/Tests/Classes/Utility/DebugUtilityTest.php index b9aa181..f0f4f70 100644 --- a/Tests/Classes/Utility/DebugUtilityTest.php +++ b/Tests/Classes/Utility/DebugUtilityTest.php @@ -57,7 +57,7 @@ public function debugDoesNotEchoButDesctructDoes() ]; $echoDebugCall = -1; - $debugger = $this->getMockBuilder(DebugUtility::class)->setMethods(['echoDebug'])->getMock(); + $debugger = $this->getMockBuilder(DebugUtility::class)->onlyMethods(['echoDebug'])->getMock(); $debugger ->expects($this->exactly(2)) ->method('echoDebug') diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 22c88d4..e6bf0e5 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,37 +1,20 @@ - - - - - - - - - - Tests/ - - - - - - ./hooks - ./rules - ./sanitizer - ./util - - + + + + + + + + + Tests/ + + + + + ./hooks + ./rules + ./sanitizer + ./util + +