public function AlterDecoratorTest::testAlterDecorator

Tests getDefinitions() and getDefinition() of Drupal\Core\Plugin\Discovery\AlterDecorator.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Plugin/AlterDecoratorTest.php, line 52
Definition of Drupal\system\Tests\Plugin\AlterDecoratorTest.

Class

AlterDecoratorTest
Tests that the AlterDecorator fires and respects the alter hook.

Namespace

Drupal\system\Tests\Plugin

Code

public function testAlterDecorator() {

  // Ensure that getDefinitions() fires and changes the actual plugin definitions.
  $definitions = $this->alterTestPluginManager
    ->getDefinitions();
  foreach ($definitions as &$definition) {
    $this
      ->assertTrue($definition['altered']);
  }

  // Ensure that getDefinitions() fires and changes the actual plugin definition.
  $definition = $this->alterTestPluginManager
    ->getDefinition('user_login');
  $this
    ->assertTrue($definition['altered_single']);
}