X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Frest%2Ftests%2Fsrc%2FFunctional%2FEntityResource%2FImageStyle%2FImageStyleResourceTestBase.php;fp=web%2Fcore%2Fmodules%2Frest%2Ftests%2Fsrc%2FFunctional%2FEntityResource%2FImageStyle%2FImageStyleResourceTestBase.php;h=07ec79bec3cfaa676e473b0a71b2e6bc230bc45d;hp=ccd68d95bd2e280ca23115fb225a307c38b0f856;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/modules/rest/tests/src/Functional/EntityResource/ImageStyle/ImageStyleResourceTestBase.php b/web/core/modules/rest/tests/src/Functional/EntityResource/ImageStyle/ImageStyleResourceTestBase.php index ccd68d95b..07ec79bec 100644 --- a/web/core/modules/rest/tests/src/Functional/EntityResource/ImageStyle/ImageStyleResourceTestBase.php +++ b/web/core/modules/rest/tests/src/Functional/EntityResource/ImageStyle/ImageStyleResourceTestBase.php @@ -2,112 +2,15 @@ namespace Drupal\Tests\rest\Functional\EntityResource\ImageStyle; -use Drupal\image\Entity\ImageStyle; -use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase; +@trigger_error('The ' . __NAMESPACE__ . '\ImageStyleResourceTestBase is deprecated in Drupal 8.6.x and will be removed before Drupal 9.0.0. Instead, use Drupal\Tests\image\Functional\Rest\ImageStyleResourceTestBase. See https://www.drupal.org/node/2971931.', E_USER_DEPRECATED); + +use Drupal\Tests\image\Functional\Rest\ImageStyleResourceTestBase as ImageStyleResourceTestBaseReal; /** - * ResourceTestBase for ImageStyle entity. + * @deprecated in Drupal 8.6.x. Will be removed before Drupal 9.0.0. Use + * Drupal\Tests\image\Functional\Rest\ImageStyleResourceTestBase instead. + * + * @see https://www.drupal.org/node/2971931 */ -abstract class ImageStyleResourceTestBase extends EntityResourceTestBase { - - /** - * {@inheritdoc} - */ - public static $modules = ['image']; - - /** - * {@inheritdoc} - */ - protected static $entityTypeId = 'image_style'; - - /** - * The ImageStyle entity. - * - * @var \Drupal\image\ImageStyleInterface - */ - protected $entity; - - /** - * The effect UUID. - * - * @var string - */ - protected $effectUuid; - - /** - * {@inheritdoc} - */ - protected function setUpAuthorization($method) { - $this->grantPermissionsToTestedRole(['administer image styles']); - } - - /** - * {@inheritdoc} - */ - protected function createEntity() { - // Create a "Camelids" image style. - $camelids = ImageStyle::create([ - 'name' => 'camelids', - 'label' => 'Camelids', - ]); - - // Add an image effect. - $effect = [ - 'id' => 'image_scale_and_crop', - 'data' => [ - 'width' => 120, - 'height' => 121, - ], - 'weight' => 0, - ]; - $this->effectUuid = $camelids->addImageEffect($effect); - - $camelids->save(); - - return $camelids; - } - - /** - * {@inheritdoc} - */ - protected function getExpectedNormalizedEntity() { - return [ - 'dependencies' => [], - 'effects' => [ - $this->effectUuid => [ - 'uuid' => $this->effectUuid, - 'id' => 'image_scale_and_crop', - 'weight' => 0, - 'data' => [ - 'width' => 120, - 'height' => 121, - ], - ], - ], - 'label' => 'Camelids', - 'langcode' => 'en', - 'name' => 'camelids', - 'status' => TRUE, - 'uuid' => $this->entity->uuid(), - ]; - } - - /** - * {@inheritdoc} - */ - protected function getNormalizedPostEntity() { - // @todo Update in https://www.drupal.org/node/2300677. - } - - /** - * {@inheritdoc} - */ - protected function getExpectedUnauthorizedAccessMessage($method) { - if ($this->config('rest.settings')->get('bc_entity_resource_permissions')) { - return parent::getExpectedUnauthorizedAccessMessage($method); - } - - return "The 'administer image styles' permission is required."; - } - +abstract class ImageStyleResourceTestBase extends ImageStyleResourceTestBaseReal { }