Skip to content
Snippets Groups Projects
Commit 2025cf7d authored by Adam G-H's avatar Adam G-H
Browse files

Issue #3494297 by phenaproxima, breidert: The teaser display for News content...

Issue #3494297 by phenaproxima, breidert: The teaser display for News content references an image style that doesn't exist
parent bd6c16a6
No related branches found
No related tags found
1 merge request!319Fix the teaser view and add a regression test
Pipeline #370515 failed
......@@ -7,7 +7,6 @@ dependencies:
- field.field.node.news.field_description
- field.field.node.news.field_featured_image
- field.field.node.news.field_tags
- image.style.medium_focal_point
- node.type.news
module:
- layout_builder
......@@ -36,7 +35,7 @@ third_party_settings:
label: hidden
settings:
image_link: ''
image_style: medium_focal_point
image_style: 1_1_300x300_focal_point_webp
image_loading:
attribute: lazy
third_party_settings: { }
......@@ -97,13 +96,11 @@ content:
weight: 1
region: content
field_featured_image:
type: media_thumbnail
type: entity_reference_entity_view
label: hidden
settings:
image_link: ''
image_style: medium_focal_point
image_loading:
attribute: lazy
view_mode: small
link: false
third_party_settings: { }
weight: 0
region: content
......
......@@ -5,7 +5,9 @@ declare(strict_types=1);
namespace Drupal\Tests\drupal_cms_news\Functional;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\file\Entity\File;
use Drupal\FunctionalTests\Core\Recipe\RecipeTestTrait;
use Drupal\media\Entity\Media;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\drupal_cms_content_type_base\ContentModelTestTrait;
......@@ -100,4 +102,44 @@ class ComponentValidationTest extends BrowserTestBase {
$this->assertStringEndsWith("/news/$now/test-news", $node->toUrl()->toString());
}
public function testListingPage(): void {
$uri = uniqid('public://') . '.png';
$this->getRandomGenerator()->image($uri, '600x600', '800x800');
$file = File::create([
'uri' => $uri,
]);
$file->save();
$featured_image = Media::create([
'bundle' => 'image',
'field_media_image' => $file,
]);
$featured_image->save();
$this->drupalCreateNode([
'type' => 'news',
'title' => 'Item 1',
'field_featured_image' => $featured_image,
'moderation_state' => 'published',
]);
$this->drupalCreateNode([
'type' => 'news',
'title' => 'Item 2',
'field_featured_image' => $featured_image,
'moderation_state' => 'published',
]);
$this->drupalCreateNode([
'type' => 'news',
'title' => 'Item 3',
'field_featured_image' => $featured_image,
'status' => FALSE,
]);
$this->drupalGet('/news');
$assert_session = $this->assertSession();
$assert_session->statusCodeEquals(200);
$assert_session->linkExists('Item 1');
$assert_session->linkExists('Item 2');
$assert_session->linkNotExists('Item 3');
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment