public function testHtmlResponse(array
$attachments) { $big_pipe_response =
new BigPipeResponse(new HtmlResponse('original'
));
$big_pipe_response->
setAttachments($attachments);
// This mock is the main expectation of this test: verify that the decorated
// service (that is this mock) never receives BigPipe placeholder
// attachments, because it doesn't know (nor should it) how to handle them.
$html_response_attachments_processor =
$this->
prophesize(AttachmentsResponseProcessorInterface::
class);
$html_response_attachments_processor->
processAttachments(Argument::
that(function D
$response) { return $response instanceof HtmlResponse &&
empty(array_intersect(['big_pipe_placeholders', 'big_pipe_nojs_placeholders'
],
array_keys($response->
getAttachments())));
})) ->
will(function D
$args) { /** @var \Symfony\Component\HttpFoundation\Response|\Drupal\Core\Render\AttachmentsInterface $response */
$response =
$args[0
];
// Simulate its actual behavior.
$attachments =
array_diff_key($response->
getAttachments(),
['html_response_attachment_placeholders' => TRUE
]);
$response->
setContent('processed'
);
$response->
setAttachments($attachments);
return $response;
})