ContentModerationStateResourceTest.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace Drupal\Tests\content_moderation\Kernel;
  3. use Drupal\Component\Plugin\Exception\PluginNotFoundException;
  4. use Drupal\KernelTests\KernelTestBase;
  5. use Drupal\rest\Entity\RestResourceConfig;
  6. use Drupal\rest\RestResourceConfigInterface;
  7. /**
  8. * @group content_moderation
  9. */
  10. class ContentModerationStateResourceTest extends KernelTestBase {
  11. /**
  12. * {@inheritdoc}
  13. */
  14. public static $modules = ['serialization', 'rest', 'content_moderation'];
  15. /**
  16. * @see \Drupal\content_moderation\Entity\ContentModerationState
  17. */
  18. public function testCreateContentModerationStateResource() {
  19. $this->setExpectedException(PluginNotFoundException::class, 'The "entity:content_moderation_state" plugin does not exist.');
  20. RestResourceConfig::create([
  21. 'id' => 'entity.content_moderation_state',
  22. 'granularity' => RestResourceConfigInterface::RESOURCE_GRANULARITY,
  23. 'configuration' => [
  24. 'methods' => ['GET'],
  25. 'formats' => ['json'],
  26. 'authentication' => ['cookie'],
  27. ],
  28. ])
  29. ->enable()
  30. ->save();
  31. }
  32. }