Commit b09d4e08 authored by catch's avatar catch
Browse files

Issue #3446116 by sjothivelu, m4olivei, plopesc: Rename UserNavigationBlock to...

Issue #3446116 by sjothivelu, m4olivei, plopesc: Rename UserNavigationBlock to NavigationUserBlock for class name consistency

(cherry picked from commit 0de488c1)
parent 1faa0113
Loading
Loading
Loading
Loading
Loading
+44 −0
Original line number Diff line number Diff line
@@ -6,10 +6,7 @@

use Drupal\Core\Block\Attribute\Block;
use Drupal\Core\Block\BlockBase;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Defines a user navigation block.
@@ -20,40 +17,7 @@
  id: 'navigation_user',
  admin_label: new TranslatableMarkup('User'),
)]
final class UserNavigationBlock extends BlockBase implements ContainerFactoryPluginInterface {

  /**
   * Constructs the plugin instance.
   *
   * @param array $configuration
   *   A configuration array containing information about the plugin instance.
   * @param string $plugin_id
   *   The plugin_id for the plugin instance.
   * @param mixed $plugin_definition
   *   The plugin implementation definition.
   * @param \Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler
   *   The module handler.
   */
  public function __construct(
    array $configuration,
    $plugin_id,
    $plugin_definition,
    protected readonly ModuleHandlerInterface $moduleHandler,
  ) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static(
      $configuration,
      $plugin_id,
      $plugin_definition,
      $container->get('module_handler'),
    );
  }
final class NavigationUserBlock extends BlockBase {

  /**
   * {@inheritdoc}
+4 −4
Original line number Diff line number Diff line
@@ -8,11 +8,11 @@
use Drupal\Tests\system\Functional\Cache\PageCacheTagsTestBase;

/**
 * Tests for \Drupal\navigation\Plugin\NavigationBlock\UserNavigationBlock.
 * Tests for \Drupal\navigation\Plugin\NavigationBlock\NavigationUserBlock.
 *
 * @group navigation
 */
class UserNavigationBlockTest extends PageCacheTagsTestBase {
class NavigationUserBlockTest extends PageCacheTagsTestBase {

  /**
   * Modules to install.
@@ -63,9 +63,9 @@ protected function setUp(): void {
  }

  /**
   * Test output of the user navigation with regards to caching and contents.
   * Test output of user navigation block with regards to caching and contents.
   */
  public function testUserNavigationBlock() {
  public function testNavigationUserBlock() {
    // Verify some basic cacheability metadata. Ensures that we're not doing
    // anything so egregious as to upset expected caching behavior. In this
    // case, as an anonymous user, we should have zero effect on the page.