Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / workspaces / tests / src / Kernel / WorkspaceInternalResourceTest.php
1 <?php
2
3 namespace Drupal\Tests\workspaces\Kernel;
4
5 use Drupal\Component\Plugin\Exception\PluginNotFoundException;
6 use Drupal\KernelTests\KernelTestBase;
7 use Drupal\rest\Entity\RestResourceConfig;
8 use Drupal\rest\RestResourceConfigInterface;
9
10 /**
11  * Tests REST module with internal workspace entity types.
12  *
13  * @group workspaces
14  */
15 class WorkspaceInternalResourceTest extends KernelTestBase {
16
17   /**
18    * {@inheritdoc}
19    */
20   public static $modules = ['user', 'serialization', 'rest', 'workspaces'];
21
22   /**
23    * Tests enabling workspace associations for REST throws an exception.
24    *
25    * @see \Drupal\workspaces\Entity\WorkspaceAssociation
26    */
27   public function testCreateWorkspaceAssociationResource() {
28     $this->setExpectedException(PluginNotFoundException::class, 'The "entity:workspace_association" plugin does not exist.');
29     RestResourceConfig::create([
30       'id' => 'entity.workspace_association',
31       'granularity' => RestResourceConfigInterface::RESOURCE_GRANULARITY,
32       'configuration' => [
33         'methods' => ['GET'],
34         'formats' => ['json'],
35         'authentication' => ['cookie'],
36       ],
37     ])
38       ->enable()
39       ->save();
40   }
41
42 }