Commit b3678c74 authored by webchick's avatar webchick

Issue #1705702 follow-up by andypost: Oops. Another missing file. :P

parent 84c6fea4
<?php
/**
* @file
* Definition of Drupal\system\Tests\Plugin\AlterDecoratorTest.
*/
namespace Drupal\system\Tests\Plugin;
use Drupal\Component\Plugin\Exception\ExceptionInterface;
use Exception;
use Drupal\plugin_test\Plugin\AlterDecoratorTestPluginManager;
use Drupal\plugin_test\Plugin\TestPluginManager;
use Drupal\simpletest\WebTestBase;
/**
* Tests that the AlterDecorator fires and respects the alter hook.
*/
class AlterDecoratorTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('plugin_test');
/**
* Stores a plugin manager which uses the AlterDecorator.
*
* @var Drupal\plugin_test\Plugin\AlterDecoratorTestPluginManager;
*/
protected $alterTestPluginManager;
public static function getInfo() {
return array(
'name' => 'AlterDecorator',
'description' => 'Tests that the AlterDecorator fires and respects the alter hook.',
'group' => 'Plugin API',
);
}
public function setUp() {
parent::setUp();
// Setup a plugin manager which uses the alter decorator.
$this->alterTestPluginManager = new AlterDecoratorTestPluginManager();
}
/**
* Tests getDefinitions() and getDefinition() of Drupal\Core\Plugin\Discovery\AlterDecorator.
*/
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']);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment