You are here

public function HookFivestarWidgetsAlterTest::testWidgetAlter in Fivestar 8

Tests that fivestar_widget_provider_fivestar_widgets_alter() was called.

File

tests/src/Kernel/HookFivestarWidgetsAlterTest.php, line 42

Class

HookFivestarWidgetsAlterTest
Tests the operation of hook_fivestar_widgets_alter().

Namespace

Drupal\Tests\fivestar\Kernel

Code

public function testWidgetAlter() {

  // Invoke the hook and collect all defined and altered widgets.
  $widgets = $this->widgetManager
    ->getWidgets();

  // Verify the label of the "Basic" widget was changed to "Altered".
  $this
    ->assertArrayHasKey('basic', $widgets);
  $this
    ->assertEquals('Altered', $widgets['basic']['label']);
}