diff --git a/core/modules/comment/lib/Drupal/comment/Controller/AdminController.php b/core/modules/comment/lib/Drupal/comment/Controller/AdminController.php index d792dd1..fb379c7 100644 --- a/core/modules/comment/lib/Drupal/comment/Controller/AdminController.php +++ b/core/modules/comment/lib/Drupal/comment/Controller/AdminController.php @@ -38,13 +38,6 @@ class AdminController implements ContainerInjectionInterface { protected $commentManager; /** - * The form builder. - * - * @var \Drupal\Core\Form\FormBuilderInterface - */ - protected $formBuilder; - - /** * {@inheritdoc} */ public static function create(ContainerInterface $container) { diff --git a/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationController.php b/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationController.php index 4d1a901..74f6b3d 100644 --- a/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationController.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationController.php @@ -64,13 +64,6 @@ class ConfigTranslationController implements ContainerInjectionInterface { protected $account; /** - * The language manager. - * - * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager - */ - protected $languageManager; - - /** * Constructs a ConfigTranslationController. * * @param \Drupal\config_translation\ConfigMapperManagerInterface $config_mapper_manager diff --git a/core/modules/dblog/lib/Drupal/dblog/Controller/DbLogController.php b/core/modules/dblog/lib/Drupal/dblog/Controller/DbLogController.php index 6567c02..dd7a39d 100644 --- a/core/modules/dblog/lib/Drupal/dblog/Controller/DbLogController.php +++ b/core/modules/dblog/lib/Drupal/dblog/Controller/DbLogController.php @@ -32,13 +32,6 @@ class DbLogController implements ContainerInjectionInterface { protected $database; /** - * The module handler service. - * - * @var \Drupal\Core\Extension\ModuleHandlerInterface - */ - protected $moduleHandler; - - /** * The date service. * * @var \Drupal\Core\Datetime\Date @@ -46,13 +39,6 @@ class DbLogController implements ContainerInjectionInterface { protected $date; /** - * The form builder service. - * - * @var \Drupal\Core\Form\FormBuilderInterface - */ - protected $formBuilder; - - /** * {@inheritdoc} */ public static function create(ContainerInterface $container) { diff --git a/core/modules/image/lib/Drupal/image/Controller/ImageStyleDownloadController.php b/core/modules/image/lib/Drupal/image/Controller/ImageStyleDownloadController.php index 191a6c7..3c619ff 100644 --- a/core/modules/image/lib/Drupal/image/Controller/ImageStyleDownloadController.php +++ b/core/modules/image/lib/Drupal/image/Controller/ImageStyleDownloadController.php @@ -8,6 +8,7 @@ namespace Drupal\image\Controller; use Drupal\Component\Utility\Crypt; +use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\Image\ImageFactory; use Drupal\Core\Lock\LockBackendInterface; use Drupal\image\ImageStyleInterface; @@ -22,7 +23,7 @@ /** * Defines a controller to serve image styles. */ -class ImageStyleDownloadController extends FileDownloadController { +class ImageStyleDownloadController extends FileDownloadController implements ContainerInjectionInterface { /** * The lock backend. diff --git a/core/tests/Drupal/Tests/Core/Controller/ControllerBaseTest.php b/core/tests/Drupal/Tests/Core/Controller/ControllerBaseTest.php index a14f8e0..f099662 100644 --- a/core/tests/Drupal/Tests/Core/Controller/ControllerBaseTest.php +++ b/core/tests/Drupal/Tests/Core/Controller/ControllerBaseTest.php @@ -7,6 +7,7 @@ namespace Drupal\Tests\Core\Controller; +use Drupal\Core\Controller\ControllerBaseTrait; use Drupal\Tests\UnitTestCase; /** @@ -19,7 +20,7 @@ class ControllerBaseTest extends UnitTestCase { * * @var \Drupal\Core\Controller\ControllerBaseTrait|\PHPUnit_Framework_MockObject_MockObject */ - protected $controllerBase; + protected $controller; public static function getInfo() { return array( @@ -30,7 +31,7 @@ public static function getInfo() { } protected function setUp() { - $this->controllerBase = $this->getMockForAbstractClass('Drupal\Core\Controller\ControllerBase'); + $this->controller = new TestController(); } /** @@ -53,15 +54,23 @@ public function testGetConfig() { ->will($this->returnValue($config_factory)); \Drupal::setContainer($container); - $config_method = new \ReflectionMethod('Drupal\Core\Controller\ControllerBase', 'config'); + $config_method = new \ReflectionMethod($this->controller, 'config'); $config_method->setAccessible(TRUE); // Call config twice to ensure that the container is just called once. - $config = $config_method->invoke($this->controllerBase, 'config_name'); + $config = $config_method->invoke($this->controller, 'config_name'); $this->assertEquals('value', $config->get('key')); - $config = $config_method->invoke($this->controllerBase, 'config_name2'); + $config = $config_method->invoke($this->controller, 'config_name2'); $this->assertEquals('value2', $config->get('key2')); } } + +/** + * Test controller implementing the ControllerBaseTrait. + */ +class TestController { + use ControllerBaseTrait; + +}