Skip to content
Snippets Groups Projects
Verified Commit 97775e78 authored by Dave Long's avatar Dave Long
Browse files

Issue #3477366 by andypost: Fix closures in tests for PHP 8.4

parent ea261a9d
Branches
Tags
20 merge requests!12227Issue #3181946 by jonmcl, mglaman,!11131[10.4.x-only-DO-NOT-MERGE]: Issue ##2842525 Ajax attached to Views exposed filter form does not trigger callbacks,!8736Update the Documention As per the Function uses.,!3878Removed unused condition head title for views,!3818Issue #2140179: $entity->original gets stale between updates,!3742Issue #3328429: Create item list field formatter for displaying ordered and unordered lists,!3731Claro: role=button on status report items,!3478Issue #3337882: Deleted menus are not removed from content type config,!3154Fixes #2987987 - CSRF token validation broken on routes with optional parameters.,!3133core/modules/system/css/components/hidden.module.css,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!2812Issue #3312049: [Followup] Fix Drupal.Commenting.FunctionComment.MissingReturnType returns for NULL,!2062Issue #3246454: Add weekly granularity to views date sort,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!877Issue #2708101: Default value for link text is not saved,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493,!459Resolve #3118590 "More tests",!213Issue #2906496: Give Media a menu item under Content
Pipeline #302975 passed with warnings
Pipeline: drupal

#302997

    Pipeline: drupal

    #302993

      Pipeline: drupal

      #302984

        ......@@ -127,9 +127,14 @@ public function testExceptionHandler(): void {
        '%line' => 56,
        '%file' => $this->getModulePath('error_test') . '/error_test.module',
        ];
        $select = \Drupal::database()->select('bananas_are_awesome', 'b')->fields('b');
        $message = \Drupal::database()->prepareStatement((string) $select, [])->getQueryString();
        $message = str_replace(["\r", "\n"], ' ', $message);
        $error_pdo_exception = [
        '%type' => 'DatabaseExceptionWrapper',
        '@message' => 'SELECT "b".* FROM {bananas_are_awesome} "b"',
        '@message' => PHP_VERSION_ID >= 80400 ?
        $message :
        'SELECT "b".* FROM {bananas_are_awesome} "b"',
        '%function' => 'Drupal\error_test\Controller\ErrorTestController->triggerPDOException()',
        '%line' => 64,
        '%file' => $this->getModulePath('error_test') . '/error_test.module',
        ......@@ -137,7 +142,9 @@ public function testExceptionHandler(): void {
        $error_renderer_exception = [
        '%type' => 'Exception',
        '@message' => 'This is an exception that occurs during rendering',
        '%function' => 'Drupal\error_test\Controller\ErrorTestController->Drupal\error_test\Controller\{closure}()',
        '%function' => PHP_VERSION_ID >= 80400 ?
        'Drupal\error_test\Controller\ErrorTestController->{closure:Drupal\error_test\Controller\ErrorTestController::triggerRendererException():104}()' :
        'Drupal\error_test\Controller\ErrorTestController->Drupal\error_test\Controller\{closure}()',
        '%line' => 82,
        '%file' => $this->getModulePath('error_test') . '/error_test.module',
        ];
        ......
        ......
        ......@@ -92,11 +92,20 @@ public function testUncaughtException(): void {
        * Tests displaying an uncaught fatal error.
        */
        public function testUncaughtFatalError(): void {
        if (PHP_VERSION_ID >= 80400) {
        $fatal_error = [
        '%type' => 'TypeError',
        '@message' => 'Drupal\error_test\Controller\ErrorTestController::{closure:Drupal\error_test\Controller\ErrorTestController::generateFatalErrors():64}(): Argument #1 ($test) must be of type array, string given, called in ' . \Drupal::root() . '/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php on line 67',
        '%function' => 'Drupal\error_test\Controller\ErrorTestController->{closure:Drupal\error_test\Controller\ErrorTestController::generateFatalErrors():64}()',
        ];
        }
        else {
        $fatal_error = [
        '%type' => 'TypeError',
        '@message' => 'Drupal\error_test\Controller\ErrorTestController::Drupal\error_test\Controller\{closure}(): Argument #1 ($test) must be of type array, string given, called in ' . \Drupal::root() . '/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php on line 67',
        '%function' => 'Drupal\error_test\Controller\ErrorTestController->Drupal\error_test\Controller\{closure}()',
        ];
        }
        $this->drupalGet('error-test/generate-fatal-errors');
        $this->assertSession()->statusCodeEquals(500);
        $message = new FormattableMarkup('%type: @message in %function (line ', $fatal_error);
        ......@@ -155,7 +164,9 @@ public function testErrorContainer(): void {
        $this->writeSettings($settings);
        \Drupal::service('kernel')->invalidateContainer();
        $this->expectedExceptionMessage = 'Drupal\FunctionalTests\Bootstrap\ErrorContainer::Drupal\FunctionalTests\Bootstrap\{closure}(): Argument #1 ($container) must be of type Drupal\FunctionalTests\Bootstrap\ErrorContainer';
        $this->expectedExceptionMessage = PHP_VERSION_ID >= 80400 ?
        'Drupal\FunctionalTests\Bootstrap\ErrorContainer::{closure:Drupal\FunctionalTests\Bootstrap\ErrorContainer::get():21}(): Argument #1 ($container) must be of type Drupal\FunctionalTests\Bootstrap\ErrorContainer' :
        'Drupal\FunctionalTests\Bootstrap\ErrorContainer::Drupal\FunctionalTests\Bootstrap\{closure}(): Argument #1 ($container) must be of type Drupal\FunctionalTests\Bootstrap\ErrorContainer';
        $this->drupalGet('');
        $this->assertSession()->statusCodeEquals(500);
        ......
        ......
        ......@@ -47,6 +47,8 @@ public function testCallbackResolver(): void {
        function ($suffix) {
        return __METHOD__ . '+' . $suffix;
        },
        PHP_VERSION_ID >= 80400 ?
        '{closure:Drupal\Tests\Core\Utility\CallableResolverTest::testCallbackResolver():47}' :
        'Drupal\Tests\Core\Utility\{closure}',
        ],
        'First-class callable function' => [
        ......@@ -59,6 +61,8 @@ function ($suffix) {
        ],
        'Arrow function' => [
        fn($suffix) => __METHOD__ . '+' . $suffix,
        PHP_VERSION_ID >= 80400 ?
        '{closure:Drupal\Tests\Core\Utility\CallableResolverTest::testCallbackResolver():63}' :
        'Drupal\Tests\Core\Utility\{closure}',
        ],
        'Static function' => [
        ......
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please to comment