that example

/** * Tests that the symfony serializer receives style plugin from the render() method. * * @covers ::render */
  public function testSerializerReceivesOptions() {
    $mock_serializer = $this->prophesize(SerializerInterface::class);

    // This is the main expectation of the test. We want to make sure the     // serializer options are passed to the SerializerInterface object.     $mock_serializer->serialize([], 'json', Argument::that(function D$argument) {
      return isset($argument['views_style_plugin']) && $argument['views_style_plugin'] instanceof Serializer;
    }))
      ->willReturn('')
      ->shouldBeCalled();

    $view_serializer_style = new Serializer([], 'dummy_serializer', []$mock_serializer->reveal()['json', 'xml']['json' => 'serialization', 'xml' => 'serialization']);
    $view_serializer_style->options = ['formats' => ['xml', 'json']];
    $view_serializer_style->view = $this->view;
    $view_serializer_style->displayHandler = $this->displayHandler;
    $view_serializer_style->render();
  }

}
'id' => 'id',
      ],
      'destination' => [
        'plugin' => 'entity:no_language_entity_test',
        'translations' => TRUE,
      ],
    ]);

    $message = $this->prophesize(MigrateMessageInterface::class);
    // Match the expected message. Can't use default argument types, because     // we need to convert to string from TranslatableMarkup.     $argument = Argument::that(function D$msg) {
      return str_contains((string) $msghtmlentities('The "no_language_entity_test" entity type does not support translations.'));
    });
    $message->display($argument, Argument::any())
      ->shouldBeCalled();

    $executable = new MigrateExecutable($migration$message->reveal());
    $executable->import();
  }

}

  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;
      })
      
// Verify that info parser is called with the specified paths.     $argument_condition = function D$path) {
      return in_array($path[
        'core/modules/system/tests/themes/test_subtheme/test_subtheme.info.yml',
        'core/modules/system/tests/themes/test_basetheme/test_basetheme.info.yml',
        'core/themes/engines/twig/twig.info.yml',
      ], TRUE);
    };
    $info_parser = $this->prophesize(InfoParserInterface::class);
    $root = $this->root;
    $info_parser->parse(Argument::that($argument_condition))
      ->shouldBeCalled()
      ->will(function D$file) use ($root) {
        $info_parser = new InfoParser($root);
        return $info_parser->parse($root . '/' . $file[0]);
      });

    $module_handler = $this->prophesize(ModuleHandlerInterface::class);
    $module_handler
      ->buildModuleDependencies(Argument::type('array'))
      ->willReturnArgument(0);
    $module_handler
      
Home | Imprint | This part of the site doesn't use cookies.