diff --git a/core/modules/image/image.module b/core/modules/image/image.module index d7bb236c3820..dbed41c93ac6 100644 --- a/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -15,51 +15,6 @@ use Drupal\field\FieldStorageConfigInterface; use Drupal\file\FileInterface; use Drupal\image\Entity\ImageStyle; -/** - * Image style constant for user presets in the database. - * - * @deprecated in drupal:8.1.0 and is removed from drupal:9.0.0. - * - * @see https://www.drupal.org/node/1820974 - */ -const IMAGE_STORAGE_NORMAL = 1; - -/** - * Image style constant for user presets that override module-defined presets. - * - * @deprecated in drupal:8.1.0 and is removed from drupal:9.0.0. - * - * @see https://www.drupal.org/node/1820974 - */ -const IMAGE_STORAGE_OVERRIDE = 2; - -/** - * Image style constant for module-defined presets in code. - * - * @deprecated in drupal:8.1.0 and is removed from drupal:9.0.0. - * - * @see https://www.drupal.org/node/1820974 - */ -const IMAGE_STORAGE_DEFAULT = 4; - -/** - * Image style constant to represent an editable preset. - * - * @deprecated in drupal:8.1.0 and is removed from drupal:9.0.0. - * - * @see https://www.drupal.org/node/1820974 - */ -define('IMAGE_STORAGE_EDITABLE', IMAGE_STORAGE_NORMAL | IMAGE_STORAGE_OVERRIDE); - -/** - * Image style constant to represent any module-based preset. - * - * @deprecated in drupal:8.1.0 and is removed from drupal:9.0.0. - * - * @see https://www.drupal.org/node/1820974 - */ -define('IMAGE_STORAGE_MODULE', IMAGE_STORAGE_OVERRIDE | IMAGE_STORAGE_DEFAULT); - /** * The name of the query parameter for image derivative tokens. */ diff --git a/core/modules/image/src/Entity/ImageStyle.php b/core/modules/image/src/Entity/ImageStyle.php index 222c4c697709..39e7263fcadb 100644 --- a/core/modules/image/src/Entity/ImageStyle.php +++ b/core/modules/image/src/Entity/ImageStyle.php @@ -505,51 +505,6 @@ class ImageStyle extends ConfigEntityBase implements ImageStyleInterface, Entity return $path; } - /** - * Provides a wrapper for file_uri_scheme() to allow unit testing. - * - * Returns the scheme of a URI (e.g. a stream). - * - * @param string $uri - * A stream, referenced as "scheme://target" or "data:target". - * - * @return string - * A string containing the name of the scheme, or FALSE if none. For - * example, the URI "public://example.txt" would return "public". - * - * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use - * \Drupal\Core\StreamWrapper\StreamWrapperManager::getTarget() instead. - * - * @see https://www.drupal.org/node/3035273 - */ - protected function fileUriScheme($uri) { - @trigger_error('fileUriTarget() is deprecated in drupal:8.8.0. It will be removed from drupal:9.0.0. See https://www.drupal.org/node/3035273', E_USER_DEPRECATED); - return StreamWrapperManager::getScheme($uri); - } - - /** - * Provides a wrapper for file_uri_target() to allow unit testing. - * - * Returns the part of a URI after the schema. - * - * @param string $uri - * A stream, referenced as "scheme://target" or "data:target". - * - * @return string|bool - * A string containing the target (path), or FALSE if none. - * For example, the URI "public://sample/test.txt" would return - * "sample/test.txt". - * - * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use - * \Drupal\Core\StreamWrapper\StreamWrapperManager::getUriTarget() instead. - * - * @see https://www.drupal.org/node/3035273 - */ - protected function fileUriTarget($uri) { - @trigger_error('fileUriTarget() is deprecated in drupal:8.8.0. It will be removed from drupal:9.0.0. See https://www.drupal.org/node/3035273', E_USER_DEPRECATED); - return StreamWrapperManager::getTarget($uri); - } - /** * Provides a wrapper to allow unit testing. * diff --git a/core/modules/image/src/ImageStyleInterface.php b/core/modules/image/src/ImageStyleInterface.php index 5250be51dc3d..d3306e5d1596 100644 --- a/core/modules/image/src/ImageStyleInterface.php +++ b/core/modules/image/src/ImageStyleInterface.php @@ -9,20 +9,6 @@ use Drupal\Core\Config\Entity\ConfigEntityInterface; */ interface ImageStyleInterface extends ConfigEntityInterface { - /** - * Returns the replacement ID. - * - * @return string|null - * The replacement image style ID or NULL if no replacement has been - * selected. - * - * @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use - * \Drupal\image\ImageStyleStorageInterface::getReplacementId() instead. - * - * @see \Drupal\image\ImageStyleStorageInterface::getReplacementId() - */ - public function getReplacementID(); - /** * Returns the image style. * diff --git a/core/modules/image/src/Tests/ImageFieldTestBase.php b/core/modules/image/src/Tests/ImageFieldTestBase.php deleted file mode 100644 index d4095be99d1b..000000000000 --- a/core/modules/image/src/Tests/ImageFieldTestBase.php +++ /dev/null @@ -1,115 +0,0 @@ -profile != 'standard') { - $this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']); - $this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']); - } - - $this->adminUser = $this->drupalCreateUser(['access content', 'access administration pages', 'administer site configuration', 'administer content types', 'administer node fields', 'administer nodes', 'create article content', 'edit any article content', 'delete any article content', 'administer image styles', 'administer node display']); - $this->drupalLogin($this->adminUser); - } - - /** - * Preview an image in a node. - * - * @param \Drupal\Core\Image\ImageInterface $image - * A file object representing the image to upload. - * @param string $field_name - * Name of the image field the image should be attached to. - * @param string $type - * The type of node to create. - */ - public function previewNodeImage($image, $field_name, $type) { - $edit = [ - 'title[0][value]' => $this->randomMachineName(), - ]; - $edit['files[' . $field_name . '_0]'] = \Drupal::service('file_system')->realpath($image->uri); - $this->drupalPostForm('node/add/' . $type, $edit, t('Preview')); - } - - /** - * Upload an image to a node. - * - * @param $image - * A file object representing the image to upload. - * @param $field_name - * Name of the image field the image should be attached to. - * @param $type - * The type of node to create. - * @param $alt - * The alt text for the image. Use if the field settings require alt text. - */ - public function uploadNodeImage($image, $field_name, $type, $alt = '') { - $edit = [ - 'title[0][value]' => $this->randomMachineName(), - ]; - $edit['files[' . $field_name . '_0]'] = \Drupal::service('file_system')->realpath($image->uri); - $this->drupalPostForm('node/add/' . $type, $edit, t('Save')); - if ($alt) { - // Add alt text. - $this->drupalPostForm(NULL, [$field_name . '[0][alt]' => $alt], t('Save')); - } - - // Retrieve ID of the newly created node from the current URL. - $matches = []; - preg_match('/node\/([0-9]+)/', $this->getUrl(), $matches); - return isset($matches[1]) ? $matches[1] : FALSE; - } - - /** - * Retrieves the fid of the last inserted file. - */ - protected function getLastFileId() { - return (int) \Drupal::entityQueryAggregate('file')->aggregate('fid', 'max')->execute()[0]['fid_max']; - } - -} diff --git a/core/modules/image/tests/src/Unit/Plugin/migrate/field/d7/ImageFieldTest.php b/core/modules/image/tests/src/Unit/Plugin/migrate/field/d7/ImageFieldTest.php deleted file mode 100644 index 638c4eda73fd..000000000000 --- a/core/modules/image/tests/src/Unit/Plugin/migrate/field/d7/ImageFieldTest.php +++ /dev/null @@ -1,67 +0,0 @@ -plugin = new ImageField([], 'image', []); - - $migration = $this->prophesize(MigrationInterface::class); - - // The plugin's processFieldValues() method will call - // mergeProcessOfProperty() and return nothing. So, in order to examine the - // process pipeline created by the plugin, we need to ensure that - // getProcess() always returns the last input to mergeProcessOfProperty(). - $migration->mergeProcessOfProperty(Argument::type('string'), Argument::type('array')) - ->will(function ($arguments) use ($migration) { - $migration->getProcess()->willReturn($arguments[1]); - }); - $this->migration = $migration->reveal(); - } - - /** - * @covers ::processFieldValues - * @expectedDeprecation Deprecated in Drupal 8.6.0, to be removed before Drupal 9.0.0. Use defineValueProcessPipeline() instead. See https://www.drupal.org/node/2944598. - */ - public function testProcessFieldValues() { - $this->plugin->processFieldValues($this->migration, 'somefieldname', []); - - $expected = [ - 'plugin' => 'sub_process', - 'source' => 'somefieldname', - 'process' => [ - 'target_id' => 'fid', - 'alt' => 'alt', - 'title' => 'title', - 'width' => 'width', - 'height' => 'height', - ], - ]; - $this->assertSame($expected, $this->migration->getProcess()); - } - -}