You are here

class ThemesInstalledEventTest in Hook Event Dispatcher 3.x

Same name and namespace in other branches
  1. 8.2 modules/core_event_dispatcher/tests/src/Unit/Theme/ThemesInstalledEventTest.php \Drupal\Tests\core_event_dispatcher\Unit\Theme\ThemesInstalledEventTest

Class ThemesInstalledEventTest.

@group hook_event_dispatcher

Hierarchy

Expanded class hierarchy of ThemesInstalledEventTest

File

modules/core_event_dispatcher/tests/src/Unit/Theme/ThemesInstalledEventTest.php, line 17

Namespace

Drupal\Tests\core_event_dispatcher\Unit\Theme
View source
class ThemesInstalledEventTest extends TestCase {

  /**
   * The manager.
   *
   * @var \Drupal\Tests\hook_event_dispatcher\Unit\HookEventDispatcherManagerSpy
   */
  private $manager;

  /**
   * Sets up the test.
   */
  public function setUp() : void {
    $builder = new ContainerBuilder();
    $this->manager = new HookEventDispatcherManagerSpy();
    $builder
      ->set('hook_event_dispatcher.manager', $this->manager);
    $builder
      ->compile();
    Drupal::setContainer($builder);
  }

  /**
   * Themes installed event test.
   */
  public function testThemesInstalledEvent() : void {
    $themes = [
      'classy',
      'bartik',
    ];
    core_event_dispatcher_themes_installed($themes);

    /** @var \Drupal\core_event_dispatcher\Event\Theme\ThemesInstalledEvent $event */
    $event = $this->manager
      ->getRegisteredEvent(HookEventDispatcherInterface::THEMES_INSTALLED);
    self::assertSame($themes, $event
      ->getThemeList());
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ThemesInstalledEventTest::$manager private property The manager.
ThemesInstalledEventTest::setUp public function Sets up the test.
ThemesInstalledEventTest::testThemesInstalledEvent public function Themes installed event test.