You are here

public function MessageResourceTestBase::testDelete in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/contact/tests/src/Functional/Rest/MessageResourceTestBase.php \Drupal\Tests\contact\Functional\Rest\MessageResourceTestBase::testDelete()
  2. 9 core/modules/contact/tests/src/Functional/Rest/MessageResourceTestBase.php \Drupal\Tests\contact\Functional\Rest\MessageResourceTestBase::testDelete()

Tests a DELETE request for an entity, plus edge cases to ensure good DX.

Overrides EntityResourceTestBase::testDelete

File

core/modules/contact/tests/src/Functional/Rest/MessageResourceTestBase.php, line 137

Class

MessageResourceTestBase

Namespace

Drupal\Tests\contact\Functional\Rest

Code

public function testDelete() {

  // Contact Message entities are not stored, so they cannot be deleted.
  $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);
}