annotate core/tests/Drupal/Tests/Component/Plugin/ConfigurablePluginInterfaceTest.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents af1871eacc83
children
rev   line source
Chris@18 1 <?php
Chris@18 2
Chris@18 3 namespace Drupal\Tests\Component\Plugin;
Chris@18 4
Chris@18 5 use Drupal\Component\Plugin\ConfigurablePluginInterface;
Chris@18 6 use Drupal\Component\Plugin\PluginBase;
Chris@18 7 use PHPUnit\Framework\TestCase;
Chris@18 8
Chris@18 9 /**
Chris@18 10 * Tests ConfigurablePluginInterface deprecation.
Chris@18 11 *
Chris@18 12 * @group legacy
Chris@18 13 * @group plugin
Chris@18 14 */
Chris@18 15 class ConfigurablePluginInterfaceTest extends TestCase {
Chris@18 16
Chris@18 17 /**
Chris@18 18 * Tests the deprecation error is thrown.
Chris@18 19 *
Chris@18 20 * @expectedDeprecation Drupal\Component\Plugin\ConfigurablePluginInterface is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. You should implement ConfigurableInterface and/or DependentPluginInterface directly as needed. If you implement ConfigurableInterface you may choose to implement ConfigurablePluginInterface in Drupal 8 as well for maximum compatibility, however this must be removed prior to Drupal 9. See https://www.drupal.org/node/2946161
Chris@18 21 */
Chris@18 22 public function testDeprecation() {
Chris@18 23 new ConfigurablePluginInterfaceTestClass([], '', []);
Chris@18 24 }
Chris@18 25
Chris@18 26 }
Chris@18 27
Chris@18 28 /**
Chris@18 29 * Test Class to trigger deprecation error.
Chris@18 30 */
Chris@18 31 class ConfigurablePluginInterfaceTestClass extends PluginBase implements ConfigurablePluginInterface {
Chris@18 32
Chris@18 33 /**
Chris@18 34 * {@inheritdoc}
Chris@18 35 */
Chris@18 36 public function getConfiguration() {
Chris@18 37 return [];
Chris@18 38 }
Chris@18 39
Chris@18 40 /**
Chris@18 41 * {@inheritdoc}
Chris@18 42 */
Chris@18 43 public function setConfiguration(array $configuration) {}
Chris@18 44
Chris@18 45 /**
Chris@18 46 * {@inheritdoc}
Chris@18 47 */
Chris@18 48 public function defaultConfiguration() {
Chris@18 49 return [];
Chris@18 50 }
Chris@18 51
Chris@18 52 /**
Chris@18 53 * {@inheritdoc}
Chris@18 54 */
Chris@18 55 public function calculateDependencies() {
Chris@18 56 return [];
Chris@18 57 }
Chris@18 58
Chris@18 59 }