comparison core/modules/media/tests/src/Functional/MediaTemplateSuggestionsTest.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
20 20
21 /** 21 /**
22 * Tests template suggestions from media_theme_suggestions_media(). 22 * Tests template suggestions from media_theme_suggestions_media().
23 */ 23 */
24 public function testMediaThemeHookSuggestions() { 24 public function testMediaThemeHookSuggestions() {
25 $media_type = $this->createMediaType([ 25 $media_type = $this->createMediaType('test', [
26 'new_revision' => FALSE,
27 'queue_thumbnail_downloads' => FALSE, 26 'queue_thumbnail_downloads' => FALSE,
28 ]); 27 ]);
29 28
30 // Create media item to be rendered. 29 // Create media item to be rendered.
31 $media = Media::create([ 30 $media = Media::create([
38 // Simulate theming of the media item. 37 // Simulate theming of the media item.
39 $build = \Drupal::entityTypeManager()->getViewBuilder('media')->view($media, $view_mode); 38 $build = \Drupal::entityTypeManager()->getViewBuilder('media')->view($media, $view_mode);
40 39
41 $variables['elements'] = $build; 40 $variables['elements'] = $build;
42 $suggestions = \Drupal::moduleHandler()->invokeAll('theme_suggestions_media', [$variables]); 41 $suggestions = \Drupal::moduleHandler()->invokeAll('theme_suggestions_media', [$variables]);
43 $this->assertEquals($suggestions, ['media__full', 'media__' . $media_type->id(), 'media__' . $media_type->id() . '__full'], 'Found expected media suggestions.'); 42 $this->assertSame($suggestions, ['media__full', 'media__' . $media_type->id(), 'media__' . $media_type->id() . '__full', 'media__source_' . $media_type->getSource()->getPluginId()], 'Found expected media suggestions.');
44 } 43 }
45 44
46 } 45 }