You are here

class ToolbarEventTest in Hook Event Dispatcher 8.2

Same name and namespace in other branches
  1. 3.x modules/toolbar_event_dispatcher/tests/src/Unit/Toolbar/ToolbarEventTest.php \Drupal\Tests\toolbar_event_dispatcher\Unit\Toolbar\ToolbarEventTest

Class ToolbarEventTest.

@group toolbar_event_dispatcher

Hierarchy

  • class \Drupal\Tests\toolbar_event_dispatcher\Unit\Toolbar\ToolbarEventTest extends \PHPUnit\Framework\TestCase

Expanded class hierarchy of ToolbarEventTest

File

modules/toolbar_event_dispatcher/tests/src/Unit/Toolbar/ToolbarEventTest.php, line 18

Namespace

Drupal\Tests\toolbar_event_dispatcher\Unit\Toolbar
View source
class ToolbarEventTest extends TestCase {

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

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

  /**
   * Test the ToolbarAlterEvent.
   */
  public function testToolbarEvent() : void {
    toolbar_event_dispatcher_toolbar();
    $event = $this->manager
      ->getRegisteredEvent(HookEventDispatcherInterface::TOOLBAR);
    self::assertInstanceOf(ToolbarEvent::class, $event);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ToolbarEventTest::$manager private property The manager.
ToolbarEventTest::setUp public function
ToolbarEventTest::testToolbarEvent public function Test the ToolbarAlterEvent.