Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes
This commit is contained in:
parent
b11a755ba8
commit
c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions
|
@ -1,3 +0,0 @@
|
|||
migrate.source.d6_imagecache_presets:
|
||||
type: migrate_source_sql
|
||||
label: 'Drupal 6 ImageCache Presets'
|
|
@ -14,26 +14,36 @@ use Drupal\image\Entity\ImageStyle;
|
|||
|
||||
/**
|
||||
* Image style constant for user presets in the database.
|
||||
*
|
||||
* @deprecated in Drupal 8.1.x, will be removed before Drupal 9.0.0.
|
||||
*/
|
||||
const IMAGE_STORAGE_NORMAL = 1;
|
||||
|
||||
/**
|
||||
* Image style constant for user presets that override module-defined presets.
|
||||
*
|
||||
* @deprecated in Drupal 8.1.x, will be removed before Drupal 9.0.0.
|
||||
*/
|
||||
const IMAGE_STORAGE_OVERRIDE = 2;
|
||||
|
||||
/**
|
||||
* Image style constant for module-defined presets in code.
|
||||
*
|
||||
* @deprecated in Drupal 8.1.x, will be removed before Drupal 9.0.0.
|
||||
*/
|
||||
const IMAGE_STORAGE_DEFAULT = 4;
|
||||
|
||||
/**
|
||||
* Image style constant to represent an editable preset.
|
||||
*
|
||||
* @deprecated in Drupal 8.1.x, will be removed before Drupal 9.0.0.
|
||||
*/
|
||||
define('IMAGE_STORAGE_EDITABLE', IMAGE_STORAGE_NORMAL | IMAGE_STORAGE_OVERRIDE);
|
||||
|
||||
/**
|
||||
* Image style constant to represent any module-based preset.
|
||||
*
|
||||
* @deprecated in Drupal 8.1.x, will be removed before Drupal 9.0.0.
|
||||
*/
|
||||
define('IMAGE_STORAGE_MODULE', IMAGE_STORAGE_OVERRIDE | IMAGE_STORAGE_DEFAULT);
|
||||
|
||||
|
@ -66,7 +76,7 @@ function image_help($route_name, RouteMatchInterface $route_match) {
|
|||
$output .= '<dd>' . t('For accessibility and search engine optimization, all images that convey meaning on web sites should have alternate text. Drupal also allows entry of title text for images, but it can lead to confusion for screen reader users and its use is not recommended. Image fields can be configured so that alternate and title text fields are enabled or disabled; if enabled, the fields can be set to be required. The recommended setting is to enable and require alternate text and disable title text.') . '</dd>';
|
||||
$output .= '<dd>' . t('When you create an image field, you will need to choose whether the uploaded images will be stored in the public or private file directory defined in your settings.php file and shown on the <a href=":file-system">File system page</a>. This choice cannot be changed later. You can also configure your field to store files in a subdirectory of the public or private directory; this setting can be changed later and can be different for each entity sub-type using the field. For more information on file storage, see the <a href=":system-help">System module help page</a>.', array(':file-system' => \Drupal::url('system.file_system_settings'), ':system-help' => \Drupal::url('help.page', array('name' => 'system')))) . '</dd>';
|
||||
$output .= '<dd>' . t('The maximum file size that can be uploaded is limited by PHP settings of the server, but you can restrict it further by configuring a <em>Maximum upload size</em> in the field settings (this setting can be changed later). The maximum file size, either from PHP server settings or field configuration, is automatically displayed to users in the help text of the image field.') . '</dd>';
|
||||
$output .= '<dd>' . t('You can also configure a minimum and/or maximum resolution for uploaded images. Images that are too small will be rejected. Images that are to large will be resized. During the resizing the <a href=":exif">EXIF data</a> in the image will be lost.', array(':exif' => 'http://en.wikipedia.org/wiki/Exchangeable_image_file_format')) . '</dd>';
|
||||
$output .= '<dd>' . t('You can also configure a minimum and/or maximum resolution for uploaded images. Images that are too small will be rejected. Images that are to large will be resized. During the resizing the <a href="http://wikipedia.org/wiki/Exchangeable_image_file_format">EXIF data</a> in the image will be lost.') . '</dd>';
|
||||
$output .= '<dd>' . t('You can also configure a default image that will be used if no image is uploaded in an image field. This default can be defined for all instances of the field in the field storage settings when you create a field, and the setting can be overridden for each entity sub-type that uses the field.') . '</dd>';
|
||||
$output .= '<dt>' . t('Configuring displays and form displays') . '</dt>';
|
||||
$output .= '<dd>' . t('On the <em>Manage display</em> page, you can choose the image formatter, which determines the image style used to display the image in each display mode and whether or not to display the image as a link. On the <em>Manage form display</em> page, you can configure the image upload widget, including setting the preview image style shown on the entity edit form.') . '</dd>';
|
||||
|
|
0
core/modules/image/migration_templates/d7_image_settings.yml
Executable file → Normal file
0
core/modules/image/migration_templates/d7_image_settings.yml
Executable file → Normal file
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Annotation\ImageEffect.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Annotation;
|
||||
|
||||
use Drupal\Component\Annotation\Plugin;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\ConfigurableImageEffectBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\image;
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\ConfigurableImageEffectInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\image;
|
||||
|
||||
use Drupal\Core\Plugin\PluginFormInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Controller\ImageStyleDownloadController.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Controller;
|
||||
|
||||
use Drupal\Component\Utility\Crypt;
|
||||
|
@ -12,7 +7,6 @@ use Drupal\Core\Image\ImageFactory;
|
|||
use Drupal\Core\Lock\LockBackendInterface;
|
||||
use Drupal\image\ImageStyleInterface;
|
||||
use Drupal\system\FileDownloadController;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
@ -53,13 +47,11 @@ class ImageStyleDownloadController extends FileDownloadController {
|
|||
* The lock backend.
|
||||
* @param \Drupal\Core\Image\ImageFactory $image_factory
|
||||
* The image factory.
|
||||
* @param \Psr\Log\LoggerInterface $logger
|
||||
* A logger instance.
|
||||
*/
|
||||
public function __construct(LockBackendInterface $lock, ImageFactory $image_factory, LoggerInterface $logger) {
|
||||
public function __construct(LockBackendInterface $lock, ImageFactory $image_factory) {
|
||||
$this->lock = $lock;
|
||||
$this->imageFactory = $image_factory;
|
||||
$this->logger = $logger;
|
||||
$this->logger = $this->getLogger('image');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,8 +60,7 @@ class ImageStyleDownloadController extends FileDownloadController {
|
|||
public static function create(ContainerInterface $container) {
|
||||
return new static(
|
||||
$container->get('lock'),
|
||||
$container->get('image.factory'),
|
||||
$container->get('logger.factory')->get('image')
|
||||
$container->get('image.factory')
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Entity\ImageStyle.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Entity;
|
||||
|
||||
use Drupal\Core\Cache\Cache;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Form\ImageEffectAddForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Form;
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Form\ImageEffectDeleteForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Form;
|
||||
|
||||
use Drupal\Core\Form\ConfirmFormBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Form\ImageEffectEditForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Form;
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Form\ImageEffectFormBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Form;
|
||||
|
||||
use Drupal\Core\Form\FormBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Form\ImageStyleAddForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Form;
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Form\ImageStyleDeleteForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Form;
|
||||
|
||||
use Drupal\Core\Entity\EntityDeleteForm;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Form\ImageStyleEditForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Form;
|
||||
|
||||
use Drupal\Core\Entity\EntityStorageInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Form\ImageStyleFlushForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Form;
|
||||
|
||||
use Drupal\Core\Entity\EntityConfirmFormBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Form\ImageStyleFormBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Form;
|
||||
|
||||
use Drupal\Core\Entity\EntityForm;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\ImageEffectBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\image;
|
||||
|
||||
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\ImageEffectInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\image;
|
||||
|
||||
use Drupal\Component\Plugin\ConfigurablePluginInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\ImageEffectManager.
|
||||
*/
|
||||
|
||||
namespace Drupal\image;
|
||||
|
||||
use Drupal\Core\Cache\CacheBackendInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\ImageEffectPluginCollection.
|
||||
*/
|
||||
|
||||
namespace Drupal\image;
|
||||
|
||||
use Drupal\Core\Plugin\DefaultLazyPluginCollection;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\ImageStyleInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\image;
|
||||
|
||||
use Drupal\Core\Config\Entity\ConfigEntityInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\ImageStyleListBuilder.
|
||||
*/
|
||||
|
||||
namespace Drupal\image;
|
||||
|
||||
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\ImageStyleStorage.
|
||||
*/
|
||||
|
||||
namespace Drupal\image;
|
||||
|
||||
use Drupal\Core\Config\Entity\ConfigEntityStorage;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\ImageStyleStorageInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\image;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\PageCache\DenyPrivateImageStyleDownload.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\PageCache;
|
||||
|
||||
use Drupal\Core\PageCache\ResponsePolicyInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\PathProcessor\PathProcessorImageStyles.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\PathProcessor;
|
||||
|
||||
use Drupal\Core\PathProcessor\InboundPathProcessorInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Plugin\Field\FieldFormatter\ImageFormatter.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Plugin\Field\FieldFormatter;
|
||||
|
||||
use Drupal\Core\Entity\EntityStorageInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Plugin\Field\FieldFormatter\ImageFormatterBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Plugin\Field\FieldFormatter;
|
||||
|
||||
use Drupal\Core\Field\EntityReferenceFieldItemListInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Plugin\Field\FieldType\ImageItem.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Plugin\Field\FieldType;
|
||||
|
||||
use Drupal\Component\Utility\Random;
|
||||
|
@ -213,7 +208,7 @@ class ImageItem extends FileItem {
|
|||
'#weight' => 4.1,
|
||||
'#field_prefix' => '<div class="container-inline">',
|
||||
'#field_suffix' => '</div>',
|
||||
'#description' => t('The maximum allowed image size expressed as WIDTH×HEIGHT (e.g. 640×480). Leave blank for no restriction. If a larger image is uploaded, it will be resized to reflect the given width and height. Resizing images on upload will cause the loss of <a href=":url">EXIF data</a> in the image.', array(':url' => 'http://en.wikipedia.org/wiki/Exchangeable_image_file_format')),
|
||||
'#description' => t('The maximum allowed image size expressed as WIDTH×HEIGHT (e.g. 640×480). Leave blank for no restriction. If a larger image is uploaded, it will be resized to reflect the given width and height. Resizing images on upload will cause the loss of <a href="http://wikipedia.org/wiki/Exchangeable_image_file_format">EXIF data</a> in the image.'),
|
||||
);
|
||||
$element['max_resolution']['x'] = array(
|
||||
'#type' => 'number',
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Plugin\Field\FieldWidget\ImageWidget.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Plugin\Field\FieldWidget;
|
||||
|
||||
use Drupal\Core\Field\FieldItemListInterface;
|
||||
|
@ -98,7 +93,7 @@ class ImageWidget extends FileWidget {
|
|||
if ($cardinality == 1) {
|
||||
// If there's only one field, return it as delta 0.
|
||||
if (empty($elements[0]['#default_value']['fids'])) {
|
||||
$file_upload_help['#description'] = $this->fieldDefinition->getDescription();
|
||||
$file_upload_help['#description'] = $this->getFilteredDescription();
|
||||
$elements[0]['#description'] = \Drupal::service('renderer')->renderPlain($file_upload_help);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Plugin\ImageEffect\ConvertImageEffect.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Plugin\ImageEffect;
|
||||
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Plugin\ImageEffect\CropImageEffect.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Plugin\ImageEffect;
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Plugin\ImageEffect\DesaturateImageEffect.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Plugin\ImageEffect;
|
||||
|
||||
use Drupal\Core\Image\ImageInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Plugin\ImageEffect\ResizeImageEffect.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Plugin\ImageEffect;
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Plugin\ImageEffect\RotateImageEffect.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Plugin\ImageEffect;
|
||||
|
||||
use Drupal\Component\Utility\Color;
|
||||
use Drupal\Component\Utility\Rectangle;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Image\ImageInterface;
|
||||
use Drupal\image\ConfigurableImageEffectBase;
|
||||
|
@ -43,14 +39,13 @@ class RotateImageEffect extends ConfigurableImageEffectBase {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function transformDimensions(array &$dimensions, $uri) {
|
||||
// If the rotate is not random and the angle is a multiple of 90 degrees,
|
||||
// If the rotate is not random and current dimensions are set,
|
||||
// then the new dimensions can be determined.
|
||||
if (!$this->configuration['random'] && ((int) ($this->configuration['degrees']) == $this->configuration['degrees']) && ($this->configuration['degrees'] % 90 == 0)) {
|
||||
if ($this->configuration['degrees'] % 180 != 0) {
|
||||
$temp = $dimensions['width'];
|
||||
$dimensions['width'] = $dimensions['height'];
|
||||
$dimensions['height'] = $temp;
|
||||
}
|
||||
if (!$this->configuration['random'] && $dimensions['width'] && $dimensions['height']) {
|
||||
$rect = new Rectangle($dimensions['width'], $dimensions['height']);
|
||||
$rect = $rect->rotate($this->configuration['degrees']);
|
||||
$dimensions['width'] = $rect->getBoundingWidth();
|
||||
$dimensions['height'] = $rect->getBoundingHeight();
|
||||
}
|
||||
else {
|
||||
$dimensions['width'] = $dimensions['height'] = NULL;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Plugin\ImageEffect\ScaleAndCropImageEffect.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Plugin\ImageEffect;
|
||||
|
||||
use Drupal\Core\Image\ImageInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Plugin\ImageEffect\ScaleImageEffect.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Plugin\ImageEffect;
|
||||
|
||||
use Drupal\Component\Utility\Image;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Plugin\migrate\destination\EntityImageStyle.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Plugin\migrate\destination;
|
||||
|
||||
use Drupal\Component\Plugin\Exception\PluginNotFoundException;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* contains \Drupal\image\Plugin\migrate\process\d6\ImageCacheActions.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Plugin\migrate\process\d6;
|
||||
|
||||
use Drupal\migrate\MigrateExecutableInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Plugin\migrate\source\d6\ImageCachePreset.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Plugin\migrate\source\d7\ImageStyles.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Plugin\migrate\source\d7;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Routing\ImageStyleRoutes.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Routing;
|
||||
|
||||
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Tests\FileMoveTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Tests;
|
||||
|
||||
use Drupal\file\Entity\File;
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
use Drupal\image\Entity\ImageStyle;
|
||||
|
||||
|
@ -29,7 +25,7 @@ class FileMoveTest extends WebTestBase {
|
|||
*/
|
||||
function testNormal() {
|
||||
// Pick a file for testing.
|
||||
$file = entity_create('file', (array) current($this->drupalGetTestFiles('image')));
|
||||
$file = File::create((array) current($this->drupalGetTestFiles('image')));
|
||||
|
||||
// Create derivative image.
|
||||
$styles = ImageStyle::loadMultiple();
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Tests\ImageAdminStylesTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Tests;
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
|
@ -339,7 +334,7 @@ class ImageAdminStylesTest extends ImageFieldTestBase {
|
|||
// Create a new style.
|
||||
$style_name = strtolower($this->randomMachineName(10));
|
||||
$style_label = $this->randomString();
|
||||
$style = entity_create('image_style', array('name' => $style_name, 'label' => $style_label));
|
||||
$style = ImageStyle::create(array('name' => $style_name, 'label' => $style_label));
|
||||
$style->save();
|
||||
$style_path = 'admin/config/media/image-styles/manage/';
|
||||
|
||||
|
@ -444,7 +439,7 @@ class ImageAdminStylesTest extends ImageFieldTestBase {
|
|||
|
||||
// Create a new style.
|
||||
$style_name = strtolower($this->randomMachineName(10));
|
||||
$style = entity_create('image_style', array('name' => $style_name, 'label' => $this->randomString()));
|
||||
$style = ImageStyle::create(array('name' => $style_name, 'label' => $this->randomString()));
|
||||
$style->save();
|
||||
|
||||
// Create an image to make sure it gets flushed.
|
||||
|
@ -474,7 +469,7 @@ class ImageAdminStylesTest extends ImageFieldTestBase {
|
|||
// Create a new style.
|
||||
$style_name = strtolower($this->randomMachineName(10));
|
||||
$style_label = $this->randomString();
|
||||
$style = entity_create('image_style', array('name' => $style_name, 'label' => $style_label));
|
||||
$style = ImageStyle::create(array('name' => $style_name, 'label' => $style_label));
|
||||
$style->save();
|
||||
|
||||
// Create an image field that uses the new style.
|
||||
|
@ -520,7 +515,7 @@ class ImageAdminStylesTest extends ImageFieldTestBase {
|
|||
* Tests access for the image style listing.
|
||||
*/
|
||||
public function testImageStyleAccess() {
|
||||
$style = entity_create('image_style', array('name' => 'style_foo', 'label' => $this->randomString()));
|
||||
$style = ImageStyle::create(array('name' => 'style_foo', 'label' => $this->randomString()));
|
||||
$style->save();
|
||||
|
||||
$this->drupalGet('admin/config/media/image-styles');
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Tests\ImageDimensionsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Tests;
|
||||
|
||||
use Drupal\image\Entity\ImageStyle;
|
||||
|
@ -38,7 +33,7 @@ class ImageDimensionsTest extends WebTestBase {
|
|||
|
||||
// Create a style.
|
||||
/** @var $style \Drupal\image\ImageStyleInterface */
|
||||
$style = entity_create('image_style', array('name' => 'test', 'label' => 'Test'));
|
||||
$style = ImageStyle::create(array('name' => 'test', 'label' => 'Test'));
|
||||
$style->save();
|
||||
$generated_uri = 'public://styles/test/public/'. \Drupal::service('file_system')->basename($original_uri);
|
||||
$url = file_url_transform_relative($style->buildUrl($original_uri));
|
||||
|
@ -213,11 +208,14 @@ class ImageDimensionsTest extends WebTestBase {
|
|||
|
||||
$effect_id = $style->addImageEffect($effect);
|
||||
$style->save();
|
||||
$this->assertEqual($this->getImageTag($variables), '<img src="' . $url . '" alt="" class="image-style-test" />');
|
||||
$this->assertEqual($this->getImageTag($variables), '<img src="' . $url . '" width="41" height="41" alt="" class="image-style-test" />');
|
||||
$this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.');
|
||||
$this->drupalGet($this->getAbsoluteUrl($url));
|
||||
$this->assertResponse(200, 'Image was generated at the URL.');
|
||||
$this->assertTrue(file_exists($generated_uri), 'Generated file does exist after we accessed it.');
|
||||
$image_file = $image_factory->get($generated_uri);
|
||||
$this->assertEqual($image_file->getWidth(), 41);
|
||||
$this->assertEqual($image_file->getHeight(), 41);
|
||||
|
||||
$effect_plugin = $style->getEffect($effect_id);
|
||||
$style->deleteImageEffect($effect_plugin);
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Tests\ImageEffectsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Tests;
|
||||
|
||||
use Drupal\system\Tests\Image\ToolkitTestBase;
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Tests\ImageFieldDefaultImagesTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Tests;
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
use Drupal\Core\Entity\Entity\EntityViewDisplay;
|
||||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\file\Entity\File;
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
|
||||
/**
|
||||
* Tests setting up default images both to the field and field field.
|
||||
|
@ -36,12 +33,12 @@ class ImageFieldDefaultImagesTest extends ImageFieldTestBase {
|
|||
$filename = $this->randomMachineName() . "$i";
|
||||
$desired_filepath = 'public://' . $filename;
|
||||
file_unmanaged_copy($files[0]->uri, $desired_filepath, FILE_EXISTS_ERROR);
|
||||
$file = entity_create('file', array('uri' => $desired_filepath, 'filename' => $filename, 'name' => $filename));
|
||||
$file = File::create(['uri' => $desired_filepath, 'filename' => $filename, 'name' => $filename]);
|
||||
$file->save();
|
||||
}
|
||||
$default_images = array();
|
||||
foreach (array('field', 'field', 'field2', 'field_new', 'field_new') as $image_target) {
|
||||
$file = entity_create('file', (array) array_pop($files));
|
||||
$file = File::create((array) array_pop($files));
|
||||
$file->save();
|
||||
$default_images[$image_target] = $file;
|
||||
}
|
||||
|
@ -82,7 +79,7 @@ class ImageFieldDefaultImagesTest extends ImageFieldTestBase {
|
|||
$this->assertEqual($field_storage->getSettings()['default_image']['uuid'], $default_images['field']->uuid());
|
||||
|
||||
// Add another field with another default image to the page content type.
|
||||
$field2 = entity_create('field_config', array(
|
||||
$field2 = FieldConfig::create([
|
||||
'field_storage' => $field_storage,
|
||||
'bundle' => 'page',
|
||||
'label' => $field->label(),
|
||||
|
@ -96,7 +93,7 @@ class ImageFieldDefaultImagesTest extends ImageFieldTestBase {
|
|||
'height' => 0,
|
||||
),
|
||||
),
|
||||
));
|
||||
]);
|
||||
$field2->save();
|
||||
|
||||
$widget_settings = entity_get_form_display('node', $field->getTargetBundle(), 'default')->getComponent($field_name);
|
||||
|
@ -319,7 +316,7 @@ class ImageFieldDefaultImagesTest extends ImageFieldTestBase {
|
|||
* Tests image field and field having an invalid default image.
|
||||
*/
|
||||
public function testInvalidDefaultImage() {
|
||||
$field_storage = entity_create('field_storage_config', array(
|
||||
$field_storage = FieldStorageConfig::create(array(
|
||||
'field_name' => Unicode::strtolower($this->randomMachineName()),
|
||||
'entity_type' => 'node',
|
||||
'type' => 'image',
|
||||
|
@ -334,7 +331,7 @@ class ImageFieldDefaultImagesTest extends ImageFieldTestBase {
|
|||
// The non-existent default image should not be saved.
|
||||
$this->assertNull($settings['default_image']['uuid']);
|
||||
|
||||
$field = entity_create('field_config', array(
|
||||
$field = FieldConfig::create([
|
||||
'field_storage' => $field_storage,
|
||||
'bundle' => 'page',
|
||||
'label' => $this->randomMachineName(),
|
||||
|
@ -343,7 +340,7 @@ class ImageFieldDefaultImagesTest extends ImageFieldTestBase {
|
|||
'uuid' => 100000,
|
||||
)
|
||||
),
|
||||
));
|
||||
]);
|
||||
$field->save();
|
||||
$settings = $field->getSettings();
|
||||
// The non-existent default image should not be saved.
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Tests\ImageFieldDisplayTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Tests;
|
||||
|
||||
use Drupal\Core\Field\FieldStorageDefinitionInterface;
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Tests\ImageFieldTestBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Tests;
|
||||
|
||||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
|
||||
/**
|
||||
* TODO: Test the following functions.
|
||||
|
@ -69,9 +66,11 @@ abstract class ImageFieldTestBase extends WebTestBase {
|
|||
* Widget settings to be added to the widget defaults.
|
||||
* @param array $formatter_settings
|
||||
* Formatter settings to be added to the formatter defaults.
|
||||
* @param string $description
|
||||
* A description for the field.
|
||||
*/
|
||||
function createImageField($name, $type_name, $storage_settings = array(), $field_settings = array(), $widget_settings = array(), $formatter_settings = array()) {
|
||||
entity_create('field_storage_config', array(
|
||||
function createImageField($name, $type_name, $storage_settings = array(), $field_settings = array(), $widget_settings = array(), $formatter_settings = array(), $description = '') {
|
||||
FieldStorageConfig::create(array(
|
||||
'field_name' => $name,
|
||||
'entity_type' => 'node',
|
||||
'type' => 'image',
|
||||
|
@ -79,14 +78,15 @@ abstract class ImageFieldTestBase extends WebTestBase {
|
|||
'cardinality' => !empty($storage_settings['cardinality']) ? $storage_settings['cardinality'] : 1,
|
||||
))->save();
|
||||
|
||||
$field_config = entity_create('field_config', array(
|
||||
$field_config = FieldConfig::create([
|
||||
'field_name' => $name,
|
||||
'label' => $name,
|
||||
'entity_type' => 'node',
|
||||
'bundle' => $type_name,
|
||||
'required' => !empty($field_settings['required']),
|
||||
'settings' => $field_settings,
|
||||
));
|
||||
'description' => $description,
|
||||
]);
|
||||
$field_config->save();
|
||||
|
||||
entity_get_form_display('node', $type_name, 'default')
|
||||
|
@ -135,7 +135,7 @@ abstract class ImageFieldTestBase extends WebTestBase {
|
|||
* @param $type
|
||||
* The type of node to create.
|
||||
* @param $alt
|
||||
* The alt text for the image. Use if the field settings require alt text.
|
||||
* The alt text for the image. Use if the field settings require alt text.
|
||||
*/
|
||||
function uploadNodeImage($image, $field_name, $type, $alt = '') {
|
||||
$edit = array(
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Tests\ImageFieldValidateTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Tests;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Tests\ImageFieldWidgetTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Tests;
|
||||
|
||||
/**
|
||||
|
@ -27,9 +22,10 @@ class ImageFieldWidgetTest extends ImageFieldTestBase {
|
|||
'min_resolution' => $min_resolution . 'x' . $min_resolution,
|
||||
'alt_field' => 0,
|
||||
);
|
||||
$this->createImageField($field_name, 'article', array(), $field_settings);
|
||||
$this->createImageField($field_name, 'article', array(), $field_settings, array(), array(), 'Image test on [site:name]');
|
||||
$this->drupalGet('node/add/article');
|
||||
$this->assertNotEqual(0, count($this->xpath('//div[contains(@class, "field--widget-image-image")]')), 'Image field widget found on add/node page', 'Browser');
|
||||
$this->assertNoText('Image test on [site:name]');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Tests\ImageOnTranslatedEntityTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Tests;
|
||||
|
||||
use Drupal\file\Entity\File;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Tests\ImageStyleDeleteTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Tests;
|
||||
|
||||
use Drupal\Core\Entity\Entity\EntityFormDisplay;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Tests\ImageStyleFlushTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Tests;
|
||||
|
||||
use Drupal\image\Entity\ImageStyle;
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Tests\ImageStylesPathAndUrlTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Tests;
|
||||
|
||||
use Drupal\image\Entity\ImageStyle;
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
|
||||
/**
|
||||
|
@ -31,7 +27,7 @@ class ImageStylesPathAndUrlTest extends WebTestBase {
|
|||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->style = entity_create('image_style', array('name' => 'style_foo', 'label' => $this->randomString()));
|
||||
$this->style = ImageStyle::create(array('name' => 'style_foo', 'label' => $this->randomString()));
|
||||
$this->style->save();
|
||||
}
|
||||
|
||||
|
@ -237,7 +233,7 @@ class ImageStylesPathAndUrlTest extends WebTestBase {
|
|||
// image derivative using the first one as a source.
|
||||
$nested_url = $this->style->buildUrl($generated_uri, $clean_url);
|
||||
$matches_expected_url_format = (boolean) preg_match('/styles\/' . $this->style->id() . '\/' . $scheme . '\/styles\/' . $this->style->id() . '\/' . $scheme . '/', $nested_url);
|
||||
$this->assertTrue($matches_expected_url_format, "Url for a derivative of an image style matches expected format.");
|
||||
$this->assertTrue($matches_expected_url_format, "URL for a derivative of an image style matches expected format.");
|
||||
$nested_url_with_wrong_token = str_replace(IMAGE_DERIVATIVE_TOKEN . '=', 'wrongparam=', $nested_url);
|
||||
$this->drupalGet($nested_url_with_wrong_token);
|
||||
$this->assertResponse(403, 'Image generated from an earlier derivative was inaccessible at the URL with a missing token.');
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Tests\ImageThemeFunctionTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Tests;
|
||||
|
||||
use Drupal\Core\Field\FieldStorageDefinitionInterface;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\entity_test\Entity\EntityTest;
|
||||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\file\Entity\File;
|
||||
use Drupal\image\Entity\ImageStyle;
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
|
||||
/**
|
||||
* Tests image theme functions.
|
||||
|
@ -40,21 +40,21 @@ class ImageThemeFunctionTest extends WebTestBase {
|
|||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
entity_create('field_storage_config', array(
|
||||
FieldStorageConfig::create(array(
|
||||
'entity_type' => 'entity_test',
|
||||
'field_name' => 'image_test',
|
||||
'type' => 'image',
|
||||
'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
|
||||
))->save();
|
||||
entity_create('field_config', array(
|
||||
FieldConfig::create([
|
||||
'entity_type' => 'entity_test',
|
||||
'field_name' => 'image_test',
|
||||
'bundle' => 'entity_test',
|
||||
))->save();
|
||||
])->save();
|
||||
file_unmanaged_copy(\Drupal::root() . '/core/misc/druplicon.png', 'public://example.jpg');
|
||||
$this->image = entity_create('file', array(
|
||||
$this->image = File::create([
|
||||
'uri' => 'public://example.jpg',
|
||||
));
|
||||
]);
|
||||
$this->image->save();
|
||||
$this->imageFactory = $this->container->get('image.factory');
|
||||
}
|
||||
|
@ -72,12 +72,12 @@ class ImageThemeFunctionTest extends WebTestBase {
|
|||
$original_uri = file_unmanaged_copy($file->uri, 'public://', FILE_EXISTS_RENAME);
|
||||
|
||||
// Create a style.
|
||||
$style = entity_create('image_style', array('name' => 'test', 'label' => 'Test'));
|
||||
$style = ImageStyle::create(array('name' => 'test', 'label' => 'Test'));
|
||||
$style->save();
|
||||
$url = file_url_transform_relative($style->buildUrl($original_uri));
|
||||
|
||||
// Create a test entity with the image field set.
|
||||
$entity = entity_create('entity_test');
|
||||
$entity = EntityTest::create();
|
||||
$entity->image_test->target_id = $this->image->id();
|
||||
$entity->image_test->alt = NULL;
|
||||
$entity->image_test->uri = $original_uri;
|
||||
|
@ -134,7 +134,7 @@ class ImageThemeFunctionTest extends WebTestBase {
|
|||
$original_uri = file_unmanaged_copy($file->uri, 'public://', FILE_EXISTS_RENAME);
|
||||
|
||||
// Create a style.
|
||||
$style = entity_create('image_style', array('name' => 'image_test', 'label' => 'Test'));
|
||||
$style = ImageStyle::create(array('name' => 'image_test', 'label' => 'Test'));
|
||||
$style->save();
|
||||
$url = file_url_transform_relative($style->buildUrl($original_uri));
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Tests\Update\ImageUpdateTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Tests\Update;
|
||||
|
||||
use Drupal\system\Tests\Update\UpdatePathTestBase;
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Tests\Views\RelationshipUserImageDataTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Tests\Views;
|
||||
|
||||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\file\Entity\File;
|
||||
use Drupal\views\Tests\ViewTestBase;
|
||||
use Drupal\views\Views;
|
||||
use Drupal\views\Tests\ViewTestData;
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
|
||||
/**
|
||||
* Tests image on user relationship handler.
|
||||
|
@ -36,20 +34,20 @@ class RelationshipUserImageDataTest extends ViewTestBase {
|
|||
parent::setUp();
|
||||
|
||||
// Create the user profile field and instance.
|
||||
entity_create('field_storage_config', array(
|
||||
FieldStorageConfig::create(array(
|
||||
'entity_type' => 'user',
|
||||
'field_name' => 'user_picture',
|
||||
'type' => 'image',
|
||||
'translatable' => '0',
|
||||
))->save();
|
||||
entity_create('field_config', array(
|
||||
FieldConfig::create([
|
||||
'label' => 'User Picture',
|
||||
'description' => '',
|
||||
'field_name' => 'user_picture',
|
||||
'entity_type' => 'user',
|
||||
'bundle' => 'user',
|
||||
'required' => 0,
|
||||
))->save();
|
||||
])->save();
|
||||
|
||||
ViewTestData::createTestViews(get_class($this), array('image_test_views'));
|
||||
}
|
||||
|
@ -58,7 +56,7 @@ class RelationshipUserImageDataTest extends ViewTestBase {
|
|||
* Tests using the views image relationship.
|
||||
*/
|
||||
public function testViewsHandlerRelationshipUserImageData() {
|
||||
$file = entity_create('file', array(
|
||||
$file = File::create([
|
||||
'fid' => 2,
|
||||
'uid' => 2,
|
||||
'filename' => 'image-test.jpg',
|
||||
|
@ -67,7 +65,7 @@ class RelationshipUserImageDataTest extends ViewTestBase {
|
|||
'created' => 1,
|
||||
'changed' => 1,
|
||||
'status' => FILE_STATUS_PERMANENT,
|
||||
));
|
||||
]);
|
||||
$file->enforceIsNew();
|
||||
file_put_contents($file->getFileUri(), file_get_contents('core/modules/simpletest/files/image-1.png'));
|
||||
$file->save();
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image_module_test\Plugin\ImageEffect\AjaxTestImageEffect.
|
||||
*/
|
||||
|
||||
namespace Drupal\image_module_test\Plugin\ImageEffect;
|
||||
|
||||
use Drupal\Core\Ajax\AjaxResponse;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image_module_test\Plugin\ImageEffect\NullTestImageEffect.
|
||||
*/
|
||||
|
||||
namespace Drupal\image_module_test\Plugin\ImageEffect;
|
||||
|
||||
use Drupal\Core\Image\ImageInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image_module_test\Plugin\ImageEffect\UriDependentTestImageEffect.
|
||||
*/
|
||||
|
||||
namespace Drupal\image_module_test\Plugin\ImageEffect;
|
||||
|
||||
use Drupal\Core\Image\ImageInterface;
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Tests\ImageImportTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Tests;
|
||||
namespace Drupal\Tests\image\Kernel;
|
||||
|
||||
use Drupal\image\Entity\ImageStyle;
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
|
||||
/**
|
||||
* Tests config import for Image styles.
|
|
@ -1,23 +1,22 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Tests\ImageItemTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Tests;
|
||||
namespace Drupal\Tests\image\Kernel;
|
||||
|
||||
use Drupal\Core\Field\FieldItemInterface;
|
||||
use Drupal\Core\Field\FieldItemListInterface;
|
||||
use Drupal\Core\Field\FieldStorageDefinitionInterface;
|
||||
use Drupal\field\Tests\FieldUnitTestBase;
|
||||
use Drupal\entity_test\Entity\EntityTest;
|
||||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
use Drupal\file\Entity\File;
|
||||
|
||||
/**
|
||||
* Tests using entity fields of the image field type.
|
||||
*
|
||||
* @group image
|
||||
*/
|
||||
class ImageItemTest extends FieldUnitTestBase {
|
||||
class ImageItemTest extends FieldKernelTestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
|
@ -44,21 +43,21 @@ class ImageItemTest extends FieldUnitTestBase {
|
|||
$this->installEntitySchema('file');
|
||||
$this->installSchema('file', array('file_usage'));
|
||||
|
||||
entity_create('field_storage_config', array(
|
||||
FieldStorageConfig::create(array(
|
||||
'entity_type' => 'entity_test',
|
||||
'field_name' => 'image_test',
|
||||
'type' => 'image',
|
||||
'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
|
||||
))->save();
|
||||
entity_create('field_config', array(
|
||||
FieldConfig::create([
|
||||
'entity_type' => 'entity_test',
|
||||
'field_name' => 'image_test',
|
||||
'bundle' => 'entity_test',
|
||||
))->save();
|
||||
])->save();
|
||||
file_unmanaged_copy(\Drupal::root() . '/core/misc/druplicon.png', 'public://example.jpg');
|
||||
$this->image = entity_create('file', array(
|
||||
$this->image = File::create([
|
||||
'uri' => 'public://example.jpg',
|
||||
));
|
||||
]);
|
||||
$this->image->save();
|
||||
$this->imageFactory = $this->container->get('image.factory');
|
||||
}
|
||||
|
@ -68,7 +67,7 @@ class ImageItemTest extends FieldUnitTestBase {
|
|||
*/
|
||||
public function testImageItem() {
|
||||
// Create a test entity with the image field set.
|
||||
$entity = entity_create('entity_test');
|
||||
$entity = EntityTest::create();
|
||||
$entity->image_test->target_id = $this->image->id();
|
||||
$entity->image_test->alt = $alt = $this->randomMachineName();
|
||||
$entity->image_test->title = $title = $this->randomMachineName();
|
||||
|
@ -89,9 +88,9 @@ class ImageItemTest extends FieldUnitTestBase {
|
|||
|
||||
// Make sure the computed entity reflects updates to the referenced file.
|
||||
file_unmanaged_copy(\Drupal::root() . '/core/misc/druplicon.png', 'public://example-2.jpg');
|
||||
$image2 = entity_create('file', array(
|
||||
$image2 = File::create([
|
||||
'uri' => 'public://example-2.jpg',
|
||||
));
|
||||
]);
|
||||
$image2->save();
|
||||
|
||||
$entity->image_test->target_id = $image2->id();
|
||||
|
@ -112,7 +111,7 @@ class ImageItemTest extends FieldUnitTestBase {
|
|||
|
||||
// Delete the image and try to save the entity again.
|
||||
$this->image->delete();
|
||||
$entity = entity_create('entity_test', array('mame' => $this->randomMachineName()));
|
||||
$entity = EntityTest::create(array('mame' => $this->randomMachineName()));
|
||||
$entity->save();
|
||||
|
||||
// Test image item properties.
|
||||
|
@ -121,7 +120,7 @@ class ImageItemTest extends FieldUnitTestBase {
|
|||
$this->assertEqual(array_keys($properties), $expected);
|
||||
|
||||
// Test the generateSampleValue() method.
|
||||
$entity = entity_create('entity_test');
|
||||
$entity = EntityTest::create();
|
||||
$entity->image_test->generateSampleItems();
|
||||
$this->entityValidateAndSave($entity);
|
||||
}
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\image\Kernel\ImageStyleIntegrationTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\image\Kernel;
|
||||
|
||||
use Drupal\Core\Entity\Entity\EntityFormDisplay;
|
||||
|
|
|
@ -1,18 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Tests\Migrate\d6\MigrateImageCacheTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Tests\Migrate\d6;
|
||||
namespace Drupal\Tests\image\Kernel\Migrate\d6;
|
||||
|
||||
use Drupal\Core\Database\Database;
|
||||
use Drupal\image\Entity\ImageStyle;
|
||||
use Drupal\migrate\Entity\Migration;
|
||||
use Drupal\migrate\Entity\MigrationInterface;
|
||||
use Drupal\migrate\Plugin\MigrationInterface;
|
||||
use Drupal\migrate\Exception\RequirementsException;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Tests migration of ImageCache presets to image styles.
|
||||
|
@ -42,7 +36,7 @@ class MigrateImageCacheTest extends MigrateDrupal6TestBase {
|
|||
->execute();
|
||||
|
||||
try {
|
||||
Migration::load('d6_imagecache_presets')
|
||||
$this->getMigration('d6_imagecache_presets')
|
||||
->getSourcePlugin()
|
||||
->checkRequirements();
|
||||
$this->fail('Did not catch expected RequirementsException.');
|
|
@ -1,13 +1,8 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Tests\Migrate\d7\MigrateImageSettingsTest.
|
||||
*/
|
||||
namespace Drupal\Tests\image\Kernel\Migrate\d7;
|
||||
|
||||
namespace Drupal\image\Tests\Migrate\d7;
|
||||
|
||||
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
|
||||
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
|
||||
|
||||
/**
|
||||
* Tests migration of Image variables to configuration.
|
|
@ -1,16 +1,11 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Tests\Migrate\d7\MigrateImageStylesTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Tests\Migrate\d7;
|
||||
namespace Drupal\Tests\image\Kernel\Migrate\d7;
|
||||
|
||||
use Drupal\image\Entity\ImageStyle;
|
||||
use Drupal\image\ImageStyleInterface;
|
||||
use Drupal\image\ImageEffectBase;
|
||||
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
|
||||
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
|
||||
|
||||
/**
|
||||
* Test image styles migration to config entities.
|
|
@ -1,15 +1,10 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\image\Tests\Views\ImageViewsDataTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\image\Tests\Views;
|
||||
namespace Drupal\Tests\image\Kernel\Views;
|
||||
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\views\Tests\ViewKernelTestBase;
|
||||
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
|
||||
use Drupal\views\Views;
|
||||
|
||||
/**
|
||||
|
@ -17,7 +12,7 @@ use Drupal\views\Views;
|
|||
*
|
||||
* @group image
|
||||
*/
|
||||
class ImageViewsDataTest extends ViewKernelTestBase {
|
||||
class ImageViewsDataTest extends ViewsKernelTestBase {
|
||||
|
||||
/**
|
||||
* Modules to install.
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\image\Unit\ImageStyleTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\image\Unit;
|
||||
|
||||
use Drupal\Tests\UnitTestCase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\image\Unit\PageCache\DenyPrivateImageStyleDownloadTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\image\Unit\PageCache;
|
||||
|
||||
use Drupal\Core\PageCache\ResponsePolicyInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\image\Unit\Plugin\migrate\source\d6\ImageCachePresetTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\image\Unit\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\image\Plugin\migrate\source\d6\ImageCachePreset;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\image\Unit\Plugin\migrate\source\d7\MigrateImageStylesTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\image\Unit\Plugin\migrate\source\d7;
|
||||
|
||||
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
|
||||
|
|
Reference in a new issue