Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / rest / tests / src / Functional / EntityResource / Editor / EditorResourceTestBase.php
index 4eb4a6e1b0c27bf8b856211174b70833a40ad8c2..9cdeab0e70dc3da931979f2e28dd7aa17b0d0467 100644 (file)
 
 namespace Drupal\Tests\rest\Functional\EntityResource\Editor;
 
-use Drupal\editor\Entity\Editor;
-use Drupal\filter\Entity\FilterFormat;
-use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
+@trigger_error('The ' . __NAMESPACE__ . '\EditorResourceTestBase is deprecated in Drupal 8.6.x and will be removed before Drupal 9.0.0. Instead, use Drupal\Tests\editor\Functional\Rest\EditorResourceTestBase. See https://www.drupal.org/node/2971931.', E_USER_DEPRECATED);
+
+use Drupal\Tests\editor\Functional\Rest\EditorResourceTestBase as EditorResourceTestBaseReal;
 
 /**
- * ResourceTestBase for Editor entity.
+ * @deprecated in Drupal 8.6.x. Will be removed before Drupal 9.0.0. Use
+ *   Drupal\Tests\editor\Functional\Rest\EditorResourceTestBase instead.
+ *
+ * @see https://www.drupal.org/node/2971931
  */
-abstract class EditorResourceTestBase extends EntityResourceTestBase {
-
-  /**
-   * {@inheritdoc}
-   */
-  public static $modules = ['ckeditor', 'editor'];
-
-  /**
-   * {@inheritdoc}
-   */
-  protected static $entityTypeId = 'editor';
-
-  /**
-   * The Editor entity.
-   *
-   * @var \Drupal\editor\EditorInterface
-   */
-  protected $entity;
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function setUpAuthorization($method) {
-    $this->grantPermissionsToTestedRole(['administer filters']);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function createEntity() {
-    // Create a "Llama" filter format.
-    $llama_format = FilterFormat::create([
-      'name' => 'Llama',
-      'format' => 'llama',
-      'langcode' => 'es',
-      'filters' => [
-        'filter_html' => [
-          'status' => TRUE,
-          'settings' => [
-            'allowed_html' => '<p> <a> <b> <lo>',
-          ],
-        ],
-      ],
-    ]);
-
-    $llama_format->save();
-
-    // Create a "Camelids" editor.
-    $camelids = Editor::create([
-      'format' => 'llama',
-      'editor' => 'ckeditor',
-    ]);
-    $camelids
-      ->setImageUploadSettings([
-        'status' => FALSE,
-        'scheme' => file_default_scheme(),
-        'directory' => 'inline-images',
-        'max_size' => '',
-        'max_dimensions' => [
-          'width' => '',
-          'height' => '',
-        ],
-      ])
-      ->save();
-
-    return $camelids;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function getExpectedNormalizedEntity() {
-    return [
-      'dependencies' => [
-        'config' => [
-          'filter.format.llama',
-        ],
-        'module' => [
-          'ckeditor',
-        ],
-      ],
-      'editor' => 'ckeditor',
-      'format' => 'llama',
-      'image_upload' => [
-        'status' => FALSE,
-        'scheme' => 'public',
-        'directory' => 'inline-images',
-        'max_size' => '',
-        'max_dimensions' => [
-          'width' => NULL,
-          'height' => NULL,
-        ],
-      ],
-      'langcode' => 'en',
-      'settings' => [
-        'toolbar' => [
-          'rows' => [
-            [
-              [
-                'name' => 'Formatting',
-                'items' => [
-                  'Bold',
-                  'Italic',
-                ],
-              ],
-              [
-                'name' => 'Links',
-                'items' => [
-                  'DrupalLink',
-                  'DrupalUnlink',
-                ],
-              ],
-              [
-                'name' => 'Lists',
-                'items' => [
-                  'BulletedList',
-                  'NumberedList',
-                ],
-              ],
-              [
-                'name' => 'Media',
-                'items' => [
-                  'Blockquote',
-                  'DrupalImage',
-                ],
-              ],
-              [
-                'name' => 'Tools',
-                'items' => [
-                  'Source',
-                ],
-              ],
-            ],
-          ],
-        ],
-        'plugins' => [
-          'language' => [
-            'language_list' => 'un',
-          ],
-        ],
-      ],
-      'status' => TRUE,
-      'uuid' => $this->entity->uuid(),
-    ];
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function getNormalizedPostEntity() {
-    // @todo Update in https://www.drupal.org/node/2300677.
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function getExpectedCacheContexts() {
-    // @see ::createEntity()
-    return ['user.permissions'];
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function getExpectedUnauthorizedAccessMessage($method) {
-    if ($this->config('rest.settings')->get('bc_entity_resource_permissions')) {
-      return parent::getExpectedUnauthorizedAccessMessage($method);
-    }
-
-    return "The 'administer filters' permission is required.";
-  }
-
+abstract class EditorResourceTestBase extends EditorResourceTestBaseReal {
 }