From 27d3190a048b2f10e4e09734d606cde780d3e6e2 Mon Sep 17 00:00:00 2001 From: Roly Gutierrez Date: Fri, 31 Jan 2025 12:20:51 -0400 Subject: [PATCH] FOUR-21698 Adjust the schema for PHPUnit 10.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Descripción The Laravel 11 update also included the update to PHPUnit 11, but this version has too many changes. It was decided to roll back to PHPUnit 10 to minimize the impact. These minor errors are mitigated: - routes speed → Data Provider method Tests\Feature\Api\PerformanceApiTest::RoutesListProvider() is not static - routes speed → Data Provider method Tests\Feature\Api\PerformanceRoutesTest::RoutesListProvider() is not static - process patterns → Data Provider method Tests\Feature\Api\ProcessPatternsTest::prepareTestCasesProvider() is not static - export import full → Data Provider method Tests\Feature\ImportExport\Api\ExportImportTest::importType() is not static ## Related Tickets & Packages https://processmaker.atlassian.net/browse/FOUR-21698 --- phpunit.xml | 3 +-- tests/Feature/Api/PerformanceApiTest.php | 6 +++--- tests/Feature/Api/PerformanceRoutesTest.php | 6 +++--- tests/Feature/Api/ProcessPatternsTest.php | 14 +++++++------- .../Feature/ImportExport/Api/ExportImportTest.php | 2 +- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index cfc43d2046..353abc4eec 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -4,8 +4,7 @@ processIsolation="false" stopOnFailure="false" bootstrap="tests/bootstrap.php" - xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd" -> + xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"> tests/Feature diff --git a/tests/Feature/Api/PerformanceApiTest.php b/tests/Feature/Api/PerformanceApiTest.php index 004177d758..1b96c73ce3 100644 --- a/tests/Feature/Api/PerformanceApiTest.php +++ b/tests/Feature/Api/PerformanceApiTest.php @@ -41,7 +41,7 @@ private function calculateUnitTime($times = 100) } // Endpoints to be tested - private $endpoints = [ + private static $endpoints = [ ['l5-swagger.default.oauth2_callback', []], ['passport.tokens.index', []], ['passport.clients.index', []], @@ -77,11 +77,11 @@ private function calculateUnitTime($times = 100) const DESIRABLE_ROUTE_SPEED = 11; - public function RoutesListProvider() + public static function RoutesListProvider() { file_exists('coverage') ?: mkdir('coverage'); - return $this->endpoints; + return self::$endpoints; } /** diff --git a/tests/Feature/Api/PerformanceRoutesTest.php b/tests/Feature/Api/PerformanceRoutesTest.php index 7f3e000ad0..4331a73f06 100644 --- a/tests/Feature/Api/PerformanceRoutesTest.php +++ b/tests/Feature/Api/PerformanceRoutesTest.php @@ -40,7 +40,7 @@ private function calculateUnitTime($times = 100) } // Endpoints to be tested - private $endpoints = [ + private static $endpoints = [ ['groups.index', []], ['users.index', []], ['auth-clients.index', []], @@ -79,11 +79,11 @@ private function calculateUnitTime($times = 100) const DESIRABLE_ROUTE_SPEED = 11; - public function RoutesListProvider() + public static function RoutesListProvider() { file_exists('coverage') ?: mkdir('coverage'); - return $this->endpoints; + return self::endpoints; } /** diff --git a/tests/Feature/Api/ProcessPatternsTest.php b/tests/Feature/Api/ProcessPatternsTest.php index d9b8bb7b63..8ae1afb598 100644 --- a/tests/Feature/Api/ProcessPatternsTest.php +++ b/tests/Feature/Api/ProcessPatternsTest.php @@ -52,14 +52,14 @@ public function testProcessPatterns($type, $bpmnFile, $context = []) * * @return array */ - public function prepareTestCasesProvider() + public static function prepareTestCasesProvider() { $tests = []; - $tests = $this->prepareTestCases('Conditional_StartEvent.bpmn', $tests); - $tests = $this->prepareTestCases('Conditional_IntermediateEvent.bpmn', $tests); - $tests = $this->prepareTestCases('MultiInstance_SequentialCallActivity.bpmn', $tests); - $tests = $this->prepareTestCases('Loop_Task.bpmn', $tests); - $tests = $this->prepareTestCases('SignalWithCustomPayload.bpmn', $tests); + $tests = self::prepareTestCases('Conditional_StartEvent.bpmn', $tests); + $tests = self::prepareTestCases('Conditional_IntermediateEvent.bpmn', $tests); + $tests = self::prepareTestCases('MultiInstance_SequentialCallActivity.bpmn', $tests); + $tests = self::prepareTestCases('Loop_Task.bpmn', $tests); + $tests = self::prepareTestCases('SignalWithCustomPayload.bpmn', $tests); return $tests; } @@ -72,7 +72,7 @@ public function prepareTestCasesProvider() * * @return array */ - private function prepareTestCases($bpmnFile, array $tests) + private static function prepareTestCases($bpmnFile, array $tests) { $file = "{$this->basePath}{$bpmnFile}"; $name = basename($bpmnFile, '.bpmn'); diff --git a/tests/Feature/ImportExport/Api/ExportImportTest.php b/tests/Feature/ImportExport/Api/ExportImportTest.php index 6f1178c1c4..2de9c8bd59 100644 --- a/tests/Feature/ImportExport/Api/ExportImportTest.php +++ b/tests/Feature/ImportExport/Api/ExportImportTest.php @@ -237,7 +237,7 @@ public function testExportImportFull($importType) $this->assertAssetsWasImported($scenario); } - public function importType() + public static function importType() { return [ ['update'],