Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663
This commit is contained in:
parent
eb34d130a8
commit
f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions
|
|
@ -77,7 +77,10 @@ class ResponsiveImageAdminUITest extends WebTestBase {
|
|||
array('wide', '1x'),
|
||||
array('wide', '2x'),
|
||||
);
|
||||
|
||||
$image_styles = array_merge(
|
||||
[RESPONSIVE_IMAGE_EMPTY_IMAGE, RESPONSIVE_IMAGE_ORIGINAL_IMAGE],
|
||||
array_keys(image_style_options(FALSE))
|
||||
);
|
||||
foreach ($cases as $case) {
|
||||
// Check if the radio buttons are present.
|
||||
$this->assertFieldByName('keyed_styles[responsive_image_test_module.' . $case[0] . '][' . $case[1] . '][image_mapping_type]', '');
|
||||
|
|
@ -85,8 +88,17 @@ class ResponsiveImageAdminUITest extends WebTestBase {
|
|||
$this->assertFieldByName('keyed_styles[responsive_image_test_module.' . $case[0] . '][' . $case[1] . '][image_style]', '');
|
||||
// Check if the sizes textfields are present.
|
||||
$this->assertFieldByName('keyed_styles[responsive_image_test_module.' . $case[0] . '][' . $case[1] . '][sizes]', '');
|
||||
// Check if the image styles checkboxes are present.
|
||||
foreach (array_keys(image_style_options(FALSE)) as $image_style_name) {
|
||||
|
||||
foreach ($image_styles as $image_style_name) {
|
||||
// Check if the image styles are available in the dropdowns.
|
||||
$this->assertTrue($this->xpath(
|
||||
'//select[@name=:name]//option[@value=:style]',
|
||||
[
|
||||
':name' => 'keyed_styles[responsive_image_test_module.' . $case[0] . '][' . $case[1] . '][image_style]',
|
||||
':style' => $image_style_name,
|
||||
]
|
||||
));
|
||||
// Check if the image styles checkboxes are present.
|
||||
$this->assertFieldByName('keyed_styles[responsive_image_test_module.' . $case[0] . '][' . $case[1] . '][sizes_image_styles][' . $image_style_name . ']');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,6 +148,11 @@ class ResponsiveImageFieldDisplayTest extends ImageFieldTestBase {
|
|||
'image_mapping_type' => 'image_style',
|
||||
'image_mapping' => 'large',
|
||||
))
|
||||
// Test the output of the original image.
|
||||
->addImageStyleMapping('responsive_image_test_module.wide', '3x', array(
|
||||
'image_mapping_type' => 'image_style',
|
||||
'image_mapping' => RESPONSIVE_IMAGE_ORIGINAL_IMAGE,
|
||||
))
|
||||
->save();
|
||||
}
|
||||
}
|
||||
|
|
@ -244,6 +249,7 @@ class ResponsiveImageFieldDisplayTest extends ImageFieldTestBase {
|
|||
$cache_tags_header = $this->drupalGetHeader('X-Drupal-Cache-Tags');
|
||||
$this->assertTrue(!preg_match('/ image_style\:/', $cache_tags_header), 'No image style cache tag found.');
|
||||
|
||||
$this->removeWhiteSpace();
|
||||
$this->assertRaw($default_output, 'Image linked to file formatter displaying correctly on full node view.');
|
||||
// Verify that the image can be downloaded.
|
||||
$this->assertEqual(file_get_contents($test_image->uri), $this->drupalGet(file_create_url($image_uri)), 'File was downloaded successfully.');
|
||||
|
|
@ -285,6 +291,8 @@ class ResponsiveImageFieldDisplayTest extends ImageFieldTestBase {
|
|||
// Assert the output of the 'srcset' attribute (small multipliers first).
|
||||
$this->assertRaw('data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== 1x, ' . $thumbnail_style->buildUrl($image_uri) . ' 1.5x');
|
||||
$this->assertRaw('/styles/medium/');
|
||||
// Assert the output of the original image.
|
||||
$this->assertRaw(file_create_url($image_uri) . ' 3x');
|
||||
// Assert the output of the breakpoints.
|
||||
$this->assertRaw('media="(min-width: 0px)"');
|
||||
$this->assertRaw('media="(min-width: 560px)"');
|
||||
|
|
@ -398,6 +406,52 @@ class ResponsiveImageFieldDisplayTest extends ImageFieldTestBase {
|
|||
$this->assertPattern('/srcset="' . preg_quote($thumbnail_style->buildUrl($image_uri), '/') . ' 1x".+?media="\(min-width: 0px\)"/');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests responsive image formatter on node display with one source.
|
||||
*/
|
||||
public function testResponsiveImageFieldFormattersOneSource() {
|
||||
$this->responsiveImgStyle
|
||||
// Test the output of an empty media query.
|
||||
->addImageStyleMapping('responsive_image_test_module.empty', '1x', array(
|
||||
'image_mapping_type' => 'image_style',
|
||||
'image_mapping' => 'medium',
|
||||
))
|
||||
->addImageStyleMapping('responsive_image_test_module.empty', '2x', array(
|
||||
'image_mapping_type' => 'image_style',
|
||||
'image_mapping' => 'large',
|
||||
))
|
||||
->save();
|
||||
$node_storage = $this->container->get('entity.manager')->getStorage('node');
|
||||
$field_name = Unicode::strtolower($this->randomMachineName());
|
||||
$this->createImageField($field_name, 'article', array('uri_scheme' => 'public'));
|
||||
// Create a new node with an image attached.
|
||||
$test_image = current($this->drupalGetTestFiles('image'));
|
||||
$nid = $this->uploadNodeImage($test_image, $field_name, 'article', $this->randomMachineName());
|
||||
$node_storage->resetCache(array($nid));
|
||||
|
||||
// Use the responsive image formatter linked to file formatter.
|
||||
$display_options = array(
|
||||
'type' => 'responsive_image',
|
||||
'settings' => array(
|
||||
'image_link' => '',
|
||||
'responsive_image_style' => 'style_one',
|
||||
),
|
||||
);
|
||||
$display = entity_get_display('node', 'article', 'default');
|
||||
$display->setComponent($field_name, $display_options)
|
||||
->save();
|
||||
|
||||
// View the node.
|
||||
$this->drupalGet('node/' . $nid);
|
||||
|
||||
// Assert the media attribute is present if it has a value.
|
||||
$large_style = ImageStyle::load('large');
|
||||
$medium_style = ImageStyle::load('medium');
|
||||
$node = $node_storage->load($nid);
|
||||
$image_uri = File::load($node->{$field_name}->target_id)->getFileUri();
|
||||
$this->assertRaw('<img srcset="' . $medium_style->buildUrl($image_uri) . ' 1x, ' . $large_style->buildUrl($image_uri) . ' 2x"');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests responsive image formatters linked to the file or node.
|
||||
*
|
||||
|
|
@ -451,6 +505,7 @@ class ResponsiveImageFieldDisplayTest extends ImageFieldTestBase {
|
|||
|
||||
// Output should contain all image styles and all breakpoints.
|
||||
$this->drupalGet('node/' . $nid);
|
||||
$this->removeWhiteSpace();
|
||||
switch ($link_type) {
|
||||
case 'file':
|
||||
// Make sure the link to the file is present.
|
||||
|
|
|
|||
Reference in a new issue