diff --git a/core/lib/Drupal/Core/Controller/ExceptionController.php b/core/lib/Drupal/Core/Controller/ExceptionController.php index 01a4253..bc1177f 100644 --- a/core/lib/Drupal/Core/Controller/ExceptionController.php +++ b/core/lib/Drupal/Core/Controller/ExceptionController.php @@ -10,7 +10,7 @@ use Drupal\Core\Page\DefaultHtmlPageRenderer; use Drupal\Core\Page\HtmlFragmentRendererInterface; use Drupal\Core\Page\HtmlPageRendererInterface; -use Drupal\Core\Page\RenderHtmlRenderer; +use Drupal\Core\Page\RenderHtmlRendererInterface; use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; @@ -77,7 +77,7 @@ class ExceptionController extends HtmlControllerBase implements ContainerAwareIn * @param \Drupal\Core\Page\RenderHtmlRenderer * The render array converter. */ - public function __construct(ContentNegotiation $negotiation, TitleResolverInterface $title_resolver, HtmlPageRendererInterface $renderer, HtmlFragmentRendererInterface $fragment_renderer, TranslationInterface $string_translation, RenderHtmlRenderer $render_converter) { + public function __construct(ContentNegotiation $negotiation, TitleResolverInterface $title_resolver, HtmlPageRendererInterface $renderer, HtmlFragmentRendererInterface $fragment_renderer, TranslationInterface $string_translation, RenderHtmlRendererInterface $render_converter) { parent::__construct($title_resolver, $render_converter); $this->negotiation = $negotiation; $this->htmlPageRenderer = $renderer; diff --git a/core/lib/Drupal/Core/Controller/HtmlControllerBase.php b/core/lib/Drupal/Core/Controller/HtmlControllerBase.php index 9bab08e..0da21d2 100644 --- a/core/lib/Drupal/Core/Controller/HtmlControllerBase.php +++ b/core/lib/Drupal/Core/Controller/HtmlControllerBase.php @@ -8,7 +8,7 @@ namespace Drupal\Core\Controller; use Drupal\Core\Page\HtmlFragment; -use Drupal\Core\Page\RenderHtmlRenderer; +use Drupal\Core\Page\RenderHtmlRendererInterface; use Drupal\Core\Utility\Title; use Symfony\Cmf\Component\Routing\RouteObjectInterface; use Symfony\Component\HttpFoundation\Request; @@ -29,7 +29,7 @@ class HtmlControllerBase { /** * The render array converter. * - * @var \Drupal\Core\Page\RenderHtmlRenderer + * @var RenderHtmlRendererInterface */ protected $renderConverter; @@ -43,7 +43,7 @@ class HtmlControllerBase { * @param \Drupal\Core\Page\RenderHtmlRenderer * The render array converter. */ - public function __construct(TitleResolverInterface $title_resolver, RenderHtmlRenderer $render_converter) { + public function __construct(TitleResolverInterface $title_resolver, RenderHtmlRendererInterface $render_converter) { $this->titleResolver = $title_resolver; $this->renderConverter = $render_converter; } diff --git a/core/lib/Drupal/Core/Controller/HtmlPageController.php b/core/lib/Drupal/Core/Controller/HtmlPageController.php index 8cbbf60..c070449 100644 --- a/core/lib/Drupal/Core/Controller/HtmlPageController.php +++ b/core/lib/Drupal/Core/Controller/HtmlPageController.php @@ -8,6 +8,7 @@ namespace Drupal\Core\Controller; use Drupal\Core\Page\RenderHtmlRenderer; +use Drupal\Core\Page\RenderHtmlRendererInterface; use Drupal\Core\Routing\UrlGeneratorInterface; use Symfony\Component\HttpFoundation\Request; @@ -35,7 +36,7 @@ class HtmlPageController extends HtmlControllerBase { * @param \Drupal\Core\Page\RenderHtmlRenderer * The render array converter. */ - public function __construct(ControllerResolverInterface $controller_resolver, TitleResolverInterface $title_resolver, RenderHtmlRenderer $render_converter) { + public function __construct(ControllerResolverInterface $controller_resolver, TitleResolverInterface $title_resolver, RenderHtmlRendererInterface $render_converter) { parent::__construct($title_resolver, $render_converter); $this->controllerResolver = $controller_resolver; diff --git a/core/lib/Drupal/Core/Page/RenderHtmlRenderer.php b/core/lib/Drupal/Core/Page/RenderHtmlRenderer.php index 294c128..1c552f3 100644 --- a/core/lib/Drupal/Core/Page/RenderHtmlRenderer.php +++ b/core/lib/Drupal/Core/Page/RenderHtmlRenderer.php @@ -10,7 +10,7 @@ use Drupal\Core\Routing\UrlGeneratorInterface; use Drupal\Core\Utility\Title; -class RenderHtmlRenderer { +class RenderHtmlRenderer implements RenderHtmlRendererInterface { /** * @var \Drupal\Core\Routing\UrlGeneratorInterface @@ -28,13 +28,7 @@ public function __construct(UrlGeneratorInterface $generator) { } /** - * Converts a render array into a corresponding HtmlFragment object. - * - * @param array|string $render_array - * The render array to convert. A string may also be passed, in which case - * it will be treated as a a render array with just a #markup property. - * @return HtmlFragment - * The equivalent HtmlFragment object. + * {@inheritdoc} */ public function render($render_array) { if (!is_array($render_array)) { diff --git a/core/lib/Drupal/Core/Page/RenderHtmlRendererInterface.php b/core/lib/Drupal/Core/Page/RenderHtmlRendererInterface.php new file mode 100644 index 0000000..30f6ca7 --- /dev/null +++ b/core/lib/Drupal/Core/Page/RenderHtmlRendererInterface.php @@ -0,0 +1,22 @@ +getMock('Drupal\Core\Page\HtmlPageRendererInterface'); $html_fragment_renderer = $this->getMock('Drupal\Core\Page\HtmlFragmentRendererInterface'); + $render_array_renderer = $this->getMock('Drupal\Core\Page\RenderArrayRendererInterface'); $title_resolver = $this->getMock('Drupal\Core\Controller\TitleResolverInterface'); $translation = $this->getMock('Drupal\Core\StringTranslation\TranslationInterface'); $url_generator = $this->getMock('Drupal\Core\Routing\UrlGeneratorInterface'); @@ -35,7 +36,7 @@ public function test405HTML() { ->method('getContentType') ->will($this->returnValue('html')); - $exception_controller = new ExceptionController($content_negotiation, $title_resolver, $html_page_renderer, $html_fragment_renderer, $translation, $url_generator); + $exception_controller = new ExceptionController($content_negotiation, $title_resolver, $html_page_renderer, $html_fragment_renderer, $translation, $url_generator, $render_array_renderer); $response = $exception_controller->execute($flat_exception, new Request()); $this->assertEquals($response->getStatusCode(), 405, 'HTTP status of response is correct.'); $this->assertEquals($response->getContent(), 'Method Not Allowed', 'HTTP response body is correct.');