Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / block_content / tests / src / Functional / Rest / BlockContentTypeResourceTestBase.php
diff --git a/web/core/modules/block_content/tests/src/Functional/Rest/BlockContentTypeResourceTestBase.php b/web/core/modules/block_content/tests/src/Functional/Rest/BlockContentTypeResourceTestBase.php
new file mode 100644 (file)
index 0000000..13d6ed2
--- /dev/null
@@ -0,0 +1,71 @@
+<?php
+
+namespace Drupal\Tests\block_content\Functional\Rest;
+
+use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
+use Drupal\block_content\Entity\BlockContentType;
+
+abstract class BlockContentTypeResourceTestBase extends EntityResourceTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['block_content'];
+
+  /**
+   * {@inheritdoc}
+   */
+  protected static $entityTypeId = 'block_content_type';
+
+  /**
+   * @var \Drupal\block_content\Entity\BlockContentTypeInterface
+   */
+  protected $entity;
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUpAuthorization($method) {
+    $this->grantPermissionsToTestedRole(['administer blocks']);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function createEntity() {
+    $block_content_type = BlockContentType::create([
+      'id' => 'pascal',
+      'label' => 'Pascal',
+      'revision' => FALSE,
+      'description' => 'Provides a competitive alternative to the "basic" type',
+    ]);
+
+    $block_content_type->save();
+
+    return $block_content_type;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function getExpectedNormalizedEntity() {
+    return [
+      'dependencies' => [],
+      'description' => 'Provides a competitive alternative to the "basic" type',
+      'id' => 'pascal',
+      'label' => 'Pascal',
+      'langcode' => 'en',
+      'revision' => 0,
+      'status' => TRUE,
+      'uuid' => $this->entity->uuid(),
+    ];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function getNormalizedPostEntity() {
+    // @todo Update in https://www.drupal.org/node/2300677.
+  }
+
+}