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

Issue #3392396 by andypost, longwave: Improve AutowireTest to ignore TrustedCallbackInterface

(cherry picked from commit 4cfa1b5f)
parent 09d7cff7
No related branches found
No related tags found
21 merge requests!8376Drupal views: adding more granularity to the ‘use ajax’ functionality,!8300Issue #3443586 View area displays even when parent view has no results.,!7567Issue #3153723 by quietone, Hardik_Patel_12: Change the scaffolding...,!7565Issue #3153723 by quietone, Hardik_Patel_12: Change the scaffolding...,!7509Change label "Block description" to "Block type",!7344Issue #3292350 by O'Briat, KlemenDEV, hswong3i, smustgrave, quietone: Update...,!6922Issue #3412959 by quietone, smustgrave, longwave: Fix 12 'un' words,!6848Issue #3417553 by longwave: Remove withConsecutive() in CacheCollectorTest,!6720Revert "Issue #3358581 by pfrenssen, _tarik_, a.dmitriiev, smustgrave:...,!6560Update ClaroPreRender.php, confirming classes provided are in array format,!6528Issue #3414261 by catch: Add authenticated user umami performance tests,!6501Issue #3263668 by omkar-pd, Wim Leers, hooroomoo: Re-enable inline form errors...,!6354Draft: Issue #3380392 by phma: Updating language weight from the overview reverts label if translated,!6324Issue #3416723 by Ludo.R: Provide a "node type" views default argument,!6119Issue #3405704 by Spokje, longwave: symfony/psr-http-message-bridge major version bump,!5950Issue #3403653 by alexpott, longwave: Incorporate improvements to how contrib runs PHPStan to core,!5858Issue #3401971 by fjgarlin: Test-only job shouldn't require constant rebases...,!5716Draft: Issue #3401102 by Spokje, longwave, smustgrave: Nightwatch artifacts on GitLab not retained,!5674Transaction autocommit during shutdown relies on unreliable object destruction order,!5644Issue #3395563 by nireneko, marvil07, lauriii, borisson_, smustgrave, Wim...,!5041SDC ComponentElement: Transform slots scalar values to #plain_text instead of throwing an exception
Pipeline #32468 failed
Pipeline: drupal

#32479

    Pipeline: drupal

    #32476

      Pipeline: drupal

      #32473

        +1
        ......@@ -14,3 +14,4 @@ services:
        announcements_feed.lazy_builders:
        class: Drupal\announcements_feed\LazyBuilders
        arguments: [ '@plugin.manager.element_info']
        Drupal\announcements_feed\LazyBuilders: '@announcements_feed.lazy_builders'
        ......@@ -20,6 +20,7 @@ services:
        comment.lazy_builders:
        class: Drupal\comment\CommentLazyBuilders
        arguments: ['@entity_type.manager', '@entity.form_builder', '@current_user', '@comment.manager', '@module_handler', '@renderer']
        Drupal\comment\CommentLazyBuilders: '@comment.lazy_builders'
        comment.link_builder:
        class: Drupal\comment\CommentLinkBuilder
        ......
        ......@@ -5,6 +5,7 @@ services:
        element.editor:
        class: Drupal\editor\Element
        arguments: ['@plugin.manager.editor']
        Drupal\editor\Element: '@element.editor'
        editor.config_translation_mapper_subscriber:
        class: Drupal\editor\EventSubscriber\EditorConfigTranslationSubscriber
        arguments: ['@config.factory']
        ......
        ......@@ -2,3 +2,4 @@ services:
        shortcut.lazy_builders:
        class: Drupal\shortcut\ShortcutLazyBuilders
        arguments: ['@renderer']
        Drupal\shortcut\ShortcutLazyBuilders: '@shortcut.lazy_builders'
        ......@@ -6,6 +6,8 @@ services:
        public: false
        Drupal\autowire_test\TestInjection2:
        public: false
        Drupal\autowire_test\TestInjection3:
        public: false
        # An alias that specifies which service to use by default for arguments that
        # type-hint to the interface.
        ......@@ -14,6 +16,7 @@ services:
        Drupal\autowire_test\TestInjectionInterface:
        alias: 'Drupal\autowire_test\TestInjection'
        public: false
        Drupal\autowire_test\TestInjectionInterface $testInjection3: '@Drupal\autowire_test\TestInjection3'
        # A service that tests autowiring for four constructor arguments:
        # - One type-hinted to TestInjectionInterface.
        ......
        <?php
        namespace Drupal\autowire_test;
        use Drupal\Core\Security\TrustedCallbackInterface;
        /**
        * A service that is autowired.
        */
        class TestInjection3 implements TrustedCallbackInterface, TestInjectionInterface {
        /**
        * {@inheritdoc}
        */
        public static function trustedCallbacks() {
        return [];
        }
        }
        ......@@ -27,7 +27,7 @@ class TestService {
        */
        protected $kernel;
        public function __construct(TestInjectionInterface $test_injection, TestInjection2 $test_injection2, Connection $database, DrupalKernelInterface $kernel) {
        public function __construct(TestInjectionInterface $test_injection, TestInjection2 $test_injection2, Connection $database, DrupalKernelInterface $kernel, protected TestInjectionInterface $testInjection3) {
        $this->testInjection = $test_injection;
        $this->testInjection2 = $test_injection2;
        $this->database = $database;
        ......@@ -42,6 +42,10 @@ public function getTestInjection2(): TestInjection2 {
        return $this->testInjection2;
        }
        public function getTestInjection3(): TestInjection3 {
        return $this->testInjection3;
        }
        public function getDatabase(): Connection {
        return $this->database;
        }
        ......
        ......@@ -63,6 +63,7 @@ services:
        user.toolbar_link_builder:
        class: Drupal\user\ToolbarLinkBuilder
        arguments: ['@current_user']
        Drupal\user\ToolbarLinkBuilder: '@user.toolbar_link_builder'
        user.flood_control:
        class: Drupal\user\UserFloodControl
        arguments: ['@flood', '@event_dispatcher', '@request_stack']
        ......
        ......@@ -4,9 +4,11 @@
        use Drupal\autowire_test\TestInjection;
        use Drupal\autowire_test\TestInjection2;
        use Drupal\autowire_test\TestInjection3;
        use Drupal\autowire_test\TestService;
        use Drupal\Core\Database\Connection;
        use Drupal\Core\DrupalKernelInterface;
        use Drupal\Core\Security\TrustedCallbackInterface;
        use Drupal\Core\Serialization\Yaml;
        use Drupal\KernelTests\FileSystemModuleDiscoveryDataProviderTrait;
        use Drupal\KernelTests\KernelTestBase;
        ......@@ -33,6 +35,7 @@ public function testAutowire(): void {
        // Ensure an autowired interface works.
        $this->assertInstanceOf(TestInjection::class, $service->getTestInjection());
        $this->assertInstanceOf(TestInjection3::class, $service->getTestInjection3());
        // Ensure an autowired class works.
        $this->assertInstanceOf(TestInjection2::class, $service->getTestInjection2());
        // Ensure an autowired core class works.
        ......@@ -100,6 +103,10 @@ public function testCoreServiceAliases(): void {
        if (!$implements) {
        $expected[$class] = $id;
        }
        elseif (count($implements) === 1 && TrustedCallbackInterface::class === reset($implements)) {
        // Classes implementing only TrustedCallbackInterface should be aliased.
        $expected[$class] = $id;
        }
        // Expect classes that are the only implementation of their interface to
        // be aliased.
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please register or to comment