ContentModerationStateResourceTest.php

Same filename in other branches
  1. 9 core/modules/content_moderation/tests/src/Kernel/ContentModerationStateResourceTest.php
  2. 10 core/modules/content_moderation/tests/src/Kernel/ContentModerationStateResourceTest.php
  3. 11.x core/modules/content_moderation/tests/src/Kernel/ContentModerationStateResourceTest.php

Namespace

Drupal\Tests\content_moderation\Kernel

File

core/modules/content_moderation/tests/src/Kernel/ContentModerationStateResourceTest.php

View source
<?php

namespace Drupal\Tests\content_moderation\Kernel;

use Drupal\Component\Plugin\Exception\PluginNotFoundException;
use Drupal\KernelTests\KernelTestBase;
use Drupal\rest\Entity\RestResourceConfig;
use Drupal\rest\RestResourceConfigInterface;

/**
 * @group content_moderation
 */
class ContentModerationStateResourceTest extends KernelTestBase {
    
    /**
     * {@inheritdoc}
     */
    public static $modules = [
        'serialization',
        'rest',
        'content_moderation',
    ];
    
    /**
     * @see \Drupal\content_moderation\Entity\ContentModerationState
     */
    public function testCreateContentModerationStateResource() {
        $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,
            'configuration' => [
                'methods' => [
                    'GET',
                ],
                'formats' => [
                    'json',
                ],
                'authentication' => [
                    'cookie',
                ],
            ],
        ])->enable()
            ->save();
    }

}

Classes

Title Deprecated Summary
ContentModerationStateResourceTest @group content_moderation

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.