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,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;
|
||||
|
|
46
core/modules/image/tests/src/Kernel/ImageImportTest.php
Normal file
46
core/modules/image/tests/src/Kernel/ImageImportTest.php
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\image\Kernel;
|
||||
|
||||
use Drupal\image\Entity\ImageStyle;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
|
||||
/**
|
||||
* Tests config import for Image styles.
|
||||
*
|
||||
* @group image
|
||||
*/
|
||||
class ImageImportTest extends KernelTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['system', 'image', 'image_module_test'];
|
||||
|
||||
/**
|
||||
* Tests importing image styles.
|
||||
*/
|
||||
public function testImport() {
|
||||
$style = ImageStyle::create([
|
||||
'name' => 'test'
|
||||
]);
|
||||
|
||||
$style->addImageEffect(['id' => 'image_module_test_null']);
|
||||
$style->addImageEffect(['id' => 'image_module_test_null']);
|
||||
$style->save();
|
||||
|
||||
$this->assertEqual(count($style->getEffects()), 2);
|
||||
|
||||
$uuid = \Drupal::service('uuid')->generate();
|
||||
$style->set('effects', [
|
||||
$uuid => [
|
||||
'id' => 'image_module_test_null',
|
||||
],
|
||||
]);
|
||||
$style->save();
|
||||
|
||||
$style = ImageStyle::load('test');
|
||||
$this->assertEqual(count($style->getEffects()), 1);
|
||||
}
|
||||
|
||||
}
|
128
core/modules/image/tests/src/Kernel/ImageItemTest.php
Normal file
128
core/modules/image/tests/src/Kernel/ImageItemTest.php
Normal file
|
@ -0,0 +1,128 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\image\Kernel;
|
||||
|
||||
use Drupal\Core\Field\FieldItemInterface;
|
||||
use Drupal\Core\Field\FieldItemListInterface;
|
||||
use Drupal\Core\Field\FieldStorageDefinitionInterface;
|
||||
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 FieldKernelTestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('file', 'image');
|
||||
|
||||
/**
|
||||
* Created file entity.
|
||||
*
|
||||
* @var \Drupal\file\Entity\File
|
||||
*/
|
||||
protected $image;
|
||||
|
||||
/**
|
||||
* @var \Drupal\Core\Image\ImageFactory
|
||||
*/
|
||||
protected $imageFactory;
|
||||
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->installEntitySchema('file');
|
||||
$this->installSchema('file', array('file_usage'));
|
||||
|
||||
FieldStorageConfig::create(array(
|
||||
'entity_type' => 'entity_test',
|
||||
'field_name' => 'image_test',
|
||||
'type' => 'image',
|
||||
'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
|
||||
))->save();
|
||||
FieldConfig::create([
|
||||
'entity_type' => 'entity_test',
|
||||
'field_name' => 'image_test',
|
||||
'bundle' => 'entity_test',
|
||||
])->save();
|
||||
file_unmanaged_copy(\Drupal::root() . '/core/misc/druplicon.png', 'public://example.jpg');
|
||||
$this->image = File::create([
|
||||
'uri' => 'public://example.jpg',
|
||||
]);
|
||||
$this->image->save();
|
||||
$this->imageFactory = $this->container->get('image.factory');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests using entity fields of the image field type.
|
||||
*/
|
||||
public function testImageItem() {
|
||||
// Create a test entity with the image field set.
|
||||
$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();
|
||||
$entity->name->value = $this->randomMachineName();
|
||||
$entity->save();
|
||||
|
||||
$entity = entity_load('entity_test', $entity->id());
|
||||
$this->assertTrue($entity->image_test instanceof FieldItemListInterface, 'Field implements interface.');
|
||||
$this->assertTrue($entity->image_test[0] instanceof FieldItemInterface, 'Field item implements interface.');
|
||||
$this->assertEqual($entity->image_test->target_id, $this->image->id());
|
||||
$this->assertEqual($entity->image_test->alt, $alt);
|
||||
$this->assertEqual($entity->image_test->title, $title);
|
||||
$image = $this->imageFactory->get('public://example.jpg');
|
||||
$this->assertEqual($entity->image_test->width, $image->getWidth());
|
||||
$this->assertEqual($entity->image_test->height, $image->getHeight());
|
||||
$this->assertEqual($entity->image_test->entity->id(), $this->image->id());
|
||||
$this->assertEqual($entity->image_test->entity->uuid(), $this->image->uuid());
|
||||
|
||||
// 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 = File::create([
|
||||
'uri' => 'public://example-2.jpg',
|
||||
]);
|
||||
$image2->save();
|
||||
|
||||
$entity->image_test->target_id = $image2->id();
|
||||
$entity->image_test->alt = $new_alt = $this->randomMachineName();
|
||||
// The width and height is only updated when width is not set.
|
||||
$entity->image_test->width = NULL;
|
||||
$entity->save();
|
||||
$this->assertEqual($entity->image_test->entity->id(), $image2->id());
|
||||
$this->assertEqual($entity->image_test->entity->getFileUri(), $image2->getFileUri());
|
||||
$image = $this->imageFactory->get('public://example-2.jpg');
|
||||
$this->assertEqual($entity->image_test->width, $image->getWidth());
|
||||
$this->assertEqual($entity->image_test->height, $image->getHeight());
|
||||
$this->assertEqual($entity->image_test->alt, $new_alt);
|
||||
|
||||
// Check that the image item can be set to the referenced file directly.
|
||||
$entity->image_test = $this->image;
|
||||
$this->assertEqual($entity->image_test->target_id, $this->image->id());
|
||||
|
||||
// Delete the image and try to save the entity again.
|
||||
$this->image->delete();
|
||||
$entity = EntityTest::create(array('mame' => $this->randomMachineName()));
|
||||
$entity->save();
|
||||
|
||||
// Test image item properties.
|
||||
$expected = array('target_id', 'entity', 'alt', 'title', 'width', 'height');
|
||||
$properties = $entity->getFieldDefinition('image_test')->getFieldStorageDefinition()->getPropertyDefinitions();
|
||||
$this->assertEqual(array_keys($properties), $expected);
|
||||
|
||||
// Test the generateSampleValue() method.
|
||||
$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;
|
||||
|
|
|
@ -0,0 +1,175 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\image\Kernel\Migrate\d6;
|
||||
|
||||
use Drupal\Core\Database\Database;
|
||||
use Drupal\image\Entity\ImageStyle;
|
||||
use Drupal\migrate\Plugin\MigrationInterface;
|
||||
use Drupal\migrate\Exception\RequirementsException;
|
||||
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Tests migration of ImageCache presets to image styles.
|
||||
*
|
||||
* @group image
|
||||
*/
|
||||
class MigrateImageCacheTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installConfig(['image']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that an exception is thrown when ImageCache is not installed.
|
||||
*/
|
||||
public function testMissingTable() {
|
||||
$this->sourceDatabase->update('system')
|
||||
->fields(array(
|
||||
'status' => 0,
|
||||
))
|
||||
->condition('name', 'imagecache')
|
||||
->condition('type', 'module')
|
||||
->execute();
|
||||
|
||||
try {
|
||||
$this->getMigration('d6_imagecache_presets')
|
||||
->getSourcePlugin()
|
||||
->checkRequirements();
|
||||
$this->fail('Did not catch expected RequirementsException.');
|
||||
}
|
||||
catch (RequirementsException $e) {
|
||||
$this->pass('Caught expected RequirementsException: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test basic passing migrations.
|
||||
*/
|
||||
public function testPassingMigration() {
|
||||
$this->executeMigration('d6_imagecache_presets');
|
||||
|
||||
/** @var \Drupal\image\Entity\ImageStyle $style */
|
||||
$style = ImageStyle::load('big_blue_cheese');
|
||||
|
||||
// Check basic Style info.
|
||||
$this->assertIdentical('big_blue_cheese', $style->get('name'), 'ImageStyle name set correctly');
|
||||
$this->assertIdentical('big_blue_cheese', $style->get('label'), 'ImageStyle label set correctly');
|
||||
|
||||
// Test effects.
|
||||
$effects = $style->getEffects();
|
||||
|
||||
// Check crop effect.
|
||||
$this->assertImageEffect($effects, 'image_crop', [
|
||||
'width' => 555,
|
||||
'height' => 5555,
|
||||
'anchor' => 'center-center',
|
||||
]);
|
||||
|
||||
// Check resize effect.
|
||||
$this->assertImageEffect($effects, 'image_resize', [
|
||||
'width' => 55,
|
||||
'height' => 55,
|
||||
]);
|
||||
|
||||
// Check rotate effect.
|
||||
$this->assertImageEffect($effects, 'image_rotate', [
|
||||
'degrees' => 55,
|
||||
'random' => FALSE,
|
||||
'bgcolor' => '',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that missing actions causes failures.
|
||||
*/
|
||||
public function testMissingEffectPlugin() {
|
||||
Database::getConnection('default', 'migrate')->insert("imagecache_action")
|
||||
->fields([
|
||||
'presetid',
|
||||
'weight',
|
||||
'module',
|
||||
'action',
|
||||
'data',
|
||||
])
|
||||
->values([
|
||||
'presetid' => '1',
|
||||
'weight' => '0',
|
||||
'module' => 'imagecache',
|
||||
'action' => 'imagecache_deprecated_scale',
|
||||
'data' => 'a:3:{s:3:"fit";s:7:"outside";s:5:"width";s:3:"200";s:6:"height";s:3:"200";}',
|
||||
])->execute();
|
||||
|
||||
$this->startCollectingMessages();
|
||||
$this->executeMigration('d6_imagecache_presets');
|
||||
$messages = $this->migration->getIdMap()->getMessageIterator();
|
||||
$count = 0;
|
||||
foreach ($messages as $message) {
|
||||
$count++;
|
||||
$this->assertEqual($message->message, 'The "image_deprecated_scale" plugin does not exist.');
|
||||
$this->assertEqual($message->level, MigrationInterface::MESSAGE_ERROR);
|
||||
}
|
||||
// There should be only the one message.
|
||||
$this->assertEqual($count, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that missing action's causes failures.
|
||||
*/
|
||||
public function testInvalidCropValues() {
|
||||
Database::getConnection('default', 'migrate')->insert("imagecache_action")
|
||||
->fields([
|
||||
'presetid',
|
||||
'weight',
|
||||
'module',
|
||||
'action',
|
||||
'data',
|
||||
])
|
||||
->values([
|
||||
'presetid' => '1',
|
||||
'weight' => '0',
|
||||
'module' => 'imagecache',
|
||||
'action' => 'imagecache_crop',
|
||||
'data' => serialize([
|
||||
'xoffset' => '10',
|
||||
'yoffset' => '10',
|
||||
]),
|
||||
])->execute();
|
||||
|
||||
$this->startCollectingMessages();
|
||||
$this->executeMigration('d6_imagecache_presets');
|
||||
$this->assertEqual(['error' => [
|
||||
'The Drupal 8 image crop effect does not support numeric values for x and y offsets. Use keywords to set crop effect offsets instead.'
|
||||
]], $this->migrateMessages);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that a given image effect is migrated.
|
||||
*
|
||||
* @param array $collection
|
||||
* Collection of effects
|
||||
* @param $id
|
||||
* Id that should exist in the collection.
|
||||
* @param $config
|
||||
* Expected configuration for the collection.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function assertImageEffect($collection, $id, $config) {
|
||||
/** @var \Drupal\image\ConfigurableImageEffectBase $effect */
|
||||
foreach ($collection as $key => $effect) {
|
||||
$effect_config = $effect->getConfiguration();
|
||||
|
||||
if ($effect_config['id'] == $id && $effect_config['data'] == $config) {
|
||||
// We found this effect so succeed and return.
|
||||
return $this->pass('Effect ' . $id . ' imported correctly');
|
||||
}
|
||||
}
|
||||
// The loop did not find the effect so we it was not imported correctly.
|
||||
return $this->fail('Effect ' . $id . ' did not import correctly');
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\image\Kernel\Migrate\d7;
|
||||
|
||||
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
|
||||
|
||||
/**
|
||||
* Tests migration of Image variables to configuration.
|
||||
*
|
||||
* @group image
|
||||
*/
|
||||
class MigrateImageSettingsTest extends MigrateDrupal7TestBase {
|
||||
|
||||
public static $modules = ['image'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->executeMigration('d7_image_settings');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the migration.
|
||||
*/
|
||||
public function testMigration() {
|
||||
$config = $this->config('image.settings');
|
||||
// These settings are not recommended...
|
||||
$this->assertTrue($config->get('allow_insecure_derivatives'));
|
||||
$this->assertTrue($config->get('suppress_itok_output'));
|
||||
$this->assertIdentical("core/modules/image/testsample.png", $config->get('preview_image'));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\image\Kernel\Migrate\d7;
|
||||
|
||||
use Drupal\image\Entity\ImageStyle;
|
||||
use Drupal\image\ImageStyleInterface;
|
||||
use Drupal\image\ImageEffectBase;
|
||||
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
|
||||
|
||||
/**
|
||||
* Test image styles migration to config entities.
|
||||
*
|
||||
* @group image
|
||||
*/
|
||||
class MigrateImageStylesTest extends MigrateDrupal7TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = array('image');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installConfig(static::$modules);
|
||||
$this->executeMigration('d7_image_styles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the image styles migration.
|
||||
*/
|
||||
public function testImageStylesMigration() {
|
||||
$this->assertEntity('custom_image_style_1', "Custom image style 1", ['image_scale_and_crop', 'image_desaturate'], [['width' => 55, 'height' => 55], []]);
|
||||
$this->assertEntity('custom_image_style_2', "Custom image style 2", ['image_resize', 'image_rotate'], [['width' => 55, 'height' => 100], ['degrees' => 45, 'bgcolor' => '#FFFFFF', 'random' => false]]);
|
||||
$this->assertEntity('custom_image_style_3', "Custom image style 3", ['image_scale', 'image_crop'], [['width' => 150, 'height' => NULL, 'upscale' => false], ['width' => 50, 'height' => 50, 'anchor' => 'left-top']]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts various aspects of an ImageStyle entity.
|
||||
*
|
||||
* @param string $id
|
||||
* The expected image style ID.
|
||||
* @param string $label
|
||||
* The expected image style label.
|
||||
* @param array $expected_effect_plugins
|
||||
* An array of expected plugins attached to the image style entity
|
||||
* @param array $expected_effect_config
|
||||
* An array of expected configuration for each effect in the image style
|
||||
*/
|
||||
protected function assertEntity($id, $label, array $expected_effect_plugins, array $expected_effect_config) {
|
||||
$style = ImageStyle::load($id);
|
||||
$this->assertTrue($style instanceof ImageStyleInterface);
|
||||
/** @var \Drupal\image\ImageStyleInterface $style */
|
||||
$this->assertIdentical($id, $style->id());
|
||||
$this->assertIdentical($label, $style->label());
|
||||
|
||||
// Check the number of effects associated with the style.
|
||||
$effects = $style->getEffects();
|
||||
$this->assertIdentical(count($effects), count($expected_effect_plugins));
|
||||
|
||||
$index = 0;
|
||||
foreach ($effects as $effect) {
|
||||
$this->assertTrue($effect instanceof ImageEffectBase);
|
||||
$this->assertIdentical($expected_effect_plugins[$index], $effect->getPluginId());
|
||||
$config = $effect->getConfiguration();
|
||||
$this->assertIdentical($expected_effect_config[$index], $config['data']);
|
||||
$index++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\image\Kernel\Views;
|
||||
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
|
||||
use Drupal\views\Views;
|
||||
|
||||
/**
|
||||
* Tests image views data.
|
||||
*
|
||||
* @group image
|
||||
*/
|
||||
class ImageViewsDataTest extends ViewsKernelTestBase {
|
||||
|
||||
/**
|
||||
* Modules to install.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('image', 'file', 'views', 'entity_test', 'user', 'field');
|
||||
|
||||
/**
|
||||
* Tests views data generated for image field relationship.
|
||||
*
|
||||
* @see image_field_views_data()
|
||||
* @see image_field_views_data_views_data_alter()
|
||||
*/
|
||||
public function testRelationshipViewsData() {
|
||||
// Create image field to entity_test.
|
||||
FieldStorageConfig::create(array(
|
||||
'entity_type' => 'entity_test',
|
||||
'field_name' => 'field_base_image',
|
||||
'type' => 'image',
|
||||
))->save();
|
||||
FieldConfig::create(array(
|
||||
'entity_type' => 'entity_test',
|
||||
'field_name' => 'field_base_image',
|
||||
'bundle' => 'entity_test',
|
||||
))->save();
|
||||
// Check the generated views data.
|
||||
$views_data = Views::viewsData()->get('entity_test__field_base_image');
|
||||
$relationship = $views_data['field_base_image_target_id']['relationship'];
|
||||
$this->assertEqual($relationship['id'], 'standard');
|
||||
$this->assertEqual($relationship['base'], 'file_managed');
|
||||
$this->assertEqual($relationship['base field'], 'fid');
|
||||
$this->assertEqual($relationship['entity type'], 'file');
|
||||
// Check the backwards reference.
|
||||
$views_data = Views::viewsData()->get('file_managed');
|
||||
$relationship = $views_data['reverse_field_base_image_entity_test']['relationship'];
|
||||
$this->assertEqual($relationship['id'], 'entity_reverse');
|
||||
$this->assertEqual($relationship['base'], 'entity_test');
|
||||
$this->assertEqual($relationship['base field'], 'id');
|
||||
$this->assertEqual($relationship['field table'], 'entity_test__field_base_image');
|
||||
$this->assertEqual($relationship['field field'], 'field_base_image_target_id');
|
||||
$this->assertEqual($relationship['field_name'], 'field_base_image');
|
||||
$this->assertEqual($relationship['entity_type'], 'entity_test');
|
||||
$this->assertEqual($relationship['join_extra'][0], ['field' => 'deleted', 'value' => 0, 'numeric' => TRUE]);
|
||||
|
||||
// Create image field to entity_test_mul.
|
||||
FieldStorageConfig::create(array(
|
||||
'entity_type' => 'entity_test_mul',
|
||||
'field_name' => 'field_data_image',
|
||||
'type' => 'image',
|
||||
))->save();
|
||||
FieldConfig::create(array(
|
||||
'entity_type' => 'entity_test_mul',
|
||||
'field_name' => 'field_data_image',
|
||||
'bundle' => 'entity_test_mul',
|
||||
))->save();
|
||||
// Check the generated views data.
|
||||
$views_data = Views::viewsData()->get('entity_test_mul__field_data_image');
|
||||
$relationship = $views_data['field_data_image_target_id']['relationship'];
|
||||
$this->assertEqual($relationship['id'], 'standard');
|
||||
$this->assertEqual($relationship['base'], 'file_managed');
|
||||
$this->assertEqual($relationship['base field'], 'fid');
|
||||
$this->assertEqual($relationship['entity type'], 'file');
|
||||
// Check the backwards reference.
|
||||
$views_data = Views::viewsData()->get('file_managed');
|
||||
$relationship = $views_data['reverse_field_data_image_entity_test_mul']['relationship'];
|
||||
$this->assertEqual($relationship['id'], 'entity_reverse');
|
||||
$this->assertEqual($relationship['base'], 'entity_test_mul_property_data');
|
||||
$this->assertEqual($relationship['base field'], 'id');
|
||||
$this->assertEqual($relationship['field table'], 'entity_test_mul__field_data_image');
|
||||
$this->assertEqual($relationship['field field'], 'field_data_image_target_id');
|
||||
$this->assertEqual($relationship['field_name'], 'field_data_image');
|
||||
$this->assertEqual($relationship['entity_type'], 'entity_test_mul');
|
||||
$this->assertEqual($relationship['join_extra'][0], ['field' => 'deleted', 'value' => 0, 'numeric' => TRUE]);
|
||||
}
|
||||
|
||||
}
|
|
@ -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