Unverified Commit e82e0c05 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3059090 by clepson, mondrake, alexpott: Deprecate...

Issue #3059090 by clepson, mondrake, alexpott: Deprecate \Drupal\Tests\PhpunitCompatibilityTrait::setExpectedException()
parent 6d3ac6c7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ public function testNonHtmlResponse($response_class) {
    $big_pipe_response_attachments_processor = $this->createBigPipeResponseAttachmentsProcessor($this->prophesize(AttachmentsResponseProcessorInterface::class));

    $non_html_response = new $response_class();
    $this->setExpectedException(\AssertionError::class);
    $this->expectException(\AssertionError::class);
    $big_pipe_response_attachments_processor->processAttachments($non_html_response);
  }

+2 −1
Original line number Diff line number Diff line
@@ -95,7 +95,8 @@ public function testTransformException() {
      ->method('getSourceProperty')
      ->willReturnMap([['bid', 99], ['module', 'foobar']]);
    $this->plugin = new BlockVisibility(['skip_php' => TRUE], 'block_visibility_pages', [], $this->moduleHandler->reveal(), $migration_plugin->reveal());
    $this->setExpectedException(MigrateSkipRowException::class, "The block with bid '99' from module 'foobar' will have no PHP or request_path visibility configuration.");
    $this->expectException(MigrateSkipRowException::class);
    $this->expectExceptionMessage("The block with bid '99' from module 'foobar' will have no PHP or request_path visibility configuration.");
    $this->plugin->transform([2, '<?php', []], $this->migrateExecutable, $this->row, 'destinationproperty');
  }

+6 −3
Original line number Diff line number Diff line
@@ -116,7 +116,8 @@ protected function getExpectedUnauthorizedAccessMessage($method) {
   */
  public function testGet() {
    // Contact Message entities are not stored, so they cannot be retrieved.
    $this->setExpectedException(RouteNotFoundException::class, 'Route "rest.entity.contact_message.GET" does not exist.');
    $this->expectException(RouteNotFoundException::class);
    $this->expectExceptionMessage('Route "rest.entity.contact_message.GET" does not exist.');

    $this->provisionEntityResource();
    Url::fromRoute('rest.entity.contact_message.GET')->toString(TRUE);
@@ -127,7 +128,8 @@ public function testGet() {
   */
  public function testPatch() {
    // Contact Message entities are not stored, so they cannot be modified.
    $this->setExpectedException(RouteNotFoundException::class, 'Route "rest.entity.contact_message.PATCH" does not exist.');
    $this->expectException(RouteNotFoundException::class);
    $this->expectExceptionMessage('Route "rest.entity.contact_message.PATCH" does not exist.');

    $this->provisionEntityResource();
    Url::fromRoute('rest.entity.contact_message.PATCH')->toString(TRUE);
@@ -138,7 +140,8 @@ public function testPatch() {
   */
  public function testDelete() {
    // Contact Message entities are not stored, so they cannot be deleted.
    $this->setExpectedException(RouteNotFoundException::class, 'Route "rest.entity.contact_message.DELETE" does not exist.');
    $this->expectException(RouteNotFoundException::class);
    $this->expectExceptionMessage('Route "rest.entity.contact_message.DELETE" does not exist.');

    $this->provisionEntityResource();
    Url::fromRoute('rest.entity.contact_message.DELETE')->toString(TRUE);
+2 −1
Original line number Diff line number Diff line
@@ -120,7 +120,8 @@ public function testInvalidRecipient() {
    $sender->expects($this->once())
      ->method('isAnonymous')
      ->willReturn(FALSE);
    $this->setExpectedException(MailHandlerException::class, 'Unable to determine message recipient');
    $this->expectException(MailHandlerException::class);
    $this->expectExceptionMessage('Unable to determine message recipient');
    $this->contactMailHandler->sendMailMessages($message, $sender);
  }

+2 −1
Original line number Diff line number Diff line
@@ -21,7 +21,8 @@ class ContentModerationStateResourceTest extends KernelTestBase {
   * @see \Drupal\content_moderation\Entity\ContentModerationState
   */
  public function testCreateContentModerationStateResource() {
    $this->setExpectedException(PluginNotFoundException::class, 'The "entity:content_moderation_state" plugin does not exist.');
    $this->expectException(PluginNotFoundException::class);
    $this->expectExceptionMessage('The "entity:content_moderation_state" plugin does not exist.');
    RestResourceConfig::create([
      'id' => 'entity.content_moderation_state',
      'granularity' => RestResourceConfigInterface::RESOURCE_GRANULARITY,
Loading