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
diff --git a/web/core/modules/workspaces/tests/src/Kernel/WorkspaceInternalResourceTest.php b/web/core/modules/workspaces/tests/src/Kernel/WorkspaceInternalResourceTest.php
new file mode 100644 (file)
index 0000000..2c7758b
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+
+namespace Drupal\Tests\workspaces\Kernel;
+
+use Drupal\Component\Plugin\Exception\PluginNotFoundException;
+use Drupal\KernelTests\KernelTestBase;
+use Drupal\rest\Entity\RestResourceConfig;
+use Drupal\rest\RestResourceConfigInterface;
+
+/**
+ * Tests REST module with internal workspace entity types.
+ *
+ * @group workspaces
+ */
+class WorkspaceInternalResourceTest extends KernelTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['user', 'serialization', 'rest', 'workspaces'];
+
+  /**
+   * Tests enabling workspace associations for REST throws an exception.
+   *
+   * @see \Drupal\workspaces\Entity\WorkspaceAssociation
+   */
+  public function testCreateWorkspaceAssociationResource() {
+    $this->setExpectedException(PluginNotFoundException::class, 'The "entity:workspace_association" plugin does not exist.');
+    RestResourceConfig::create([
+      'id' => 'entity.workspace_association',
+      'granularity' => RestResourceConfigInterface::RESOURCE_GRANULARITY,
+      'configuration' => [
+        'methods' => ['GET'],
+        'formats' => ['json'],
+        'authentication' => ['cookie'],
+      ],
+    ])
+      ->enable()
+      ->save();
+  }
+
+}