.../tests/src/Unit/Render/ManyPlaceholderTest.php | 36 +++++++++------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/core/modules/big_pipe/tests/src/Unit/Render/ManyPlaceholderTest.php b/core/modules/big_pipe/tests/src/Unit/Render/ManyPlaceholderTest.php index c1d2778513..3de77ec16a 100644 --- a/core/modules/big_pipe/tests/src/Unit/Render/ManyPlaceholderTest.php +++ b/core/modules/big_pipe/tests/src/Unit/Render/ManyPlaceholderTest.php @@ -14,43 +14,37 @@ use Symfony\Component\HttpKernel\HttpKernelInterface; /** - * Class ManyPlaceholderTest. - * - * @package Drupal\Tests\big_pipe\Unit\Render\Placeholder - * * @coversDefaultClass \Drupal\big_pipe\Render\BigPipe - * * @group big_pipe */ class ManyPlaceholderTest extends UnitTestCase { /** - * Minimal testcase for the fragment extraction with many placeholders. + * @covers \Drupal\big_pipe\Render\BigPipe::sendNoJsPlaceholders */ - public function testManyPlaceHolders() { - // Mock all the dependencies. - $renderer = $this->createMock(RendererInterface::class); - $session = $this->createMock(SessionInterface::class); - $requestStack = new RequestStack(); - $kernel = $this->createMock(HttpKernelInterface::class); - $eventDispatcher = $this->createMock(EventDispatcherInterface::class); - $configFactory = $this->createMock(ConfigFactoryInterface::class); - $bigpipe = new BigPipe($renderer, $session, $requestStack, $kernel, $eventDispatcher, $configFactory); - $htmlResponse = HtmlResponse::create(); - $response = new BigPipeResponse($htmlResponse); + public function testManyNoJsPlaceHolders() { + $bigpipe = new BigPipe( + $this->prophesize(RendererInterface::class)->reveal(), + $this->prophesize(SessionInterface::class)->reveal(), + $this->prophesize(RequestStack::class)->reveal(), + $this->prophesize(HttpKernelInterface::class)->reveal(), + $this->prophesize(EventDispatcherInterface::class)->reveal(), + $this->prophesize(ConfigFactoryInterface::class)->reveal() + ); + $response = new BigPipeResponse(HtmlResponse::create()); // Add many placeholders. - $manyPlaceholders = []; + $many_placeholders = []; for ($i = 0; $i < 400; $i++) { - $manyPlaceholders[$this->randomMachineName(80)] = $this->randomMachineName(80); + $many_placeholders[$this->randomMachineName(80)] = $this->randomMachineName(80); } $attachments = [ 'library' => [], - 'big_pipe_nojs_placeholders' => $manyPlaceholders, + 'big_pipe_nojs_placeholders' => $many_placeholders, ]; $response->setAttachments($attachments); - // Construct html with all required tags. + // Construct minimal HTML response. $content = 'contentscript-bottom'; $response->setContent($content);