Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / media / tests / src / Functional / MediaTranslationUITest.php
1 <?php
2
3 namespace Drupal\Tests\media\Functional;
4
5 use Drupal\Tests\content_translation\Functional\ContentTranslationUITestBase;
6 use Drupal\Tests\media\Traits\MediaTypeCreationTrait;
7
8 /**
9  * Tests the Media Translation UI.
10  *
11  * @group media
12  */
13 class MediaTranslationUITest extends ContentTranslationUITestBase {
14
15   use MediaTypeCreationTrait;
16
17   /**
18    * {inheritdoc}
19    */
20   protected $defaultCacheContexts = [
21     'languages:language_interface',
22     'theme',
23     'timezone',
24     'url.query_args:_wrapper_format',
25     'user.permissions',
26   ];
27
28   /**
29    * {inheritdoc}
30    */
31   public static $modules = [
32     'language',
33     'content_translation',
34     'media',
35     'media_test_source',
36   ];
37
38   /**
39    * {@inheritdoc}
40    */
41   protected function setUp() {
42     $this->entityTypeId = 'media';
43     $this->bundle = 'test';
44     parent::setUp();
45   }
46
47   /**
48    * {@inheritdoc}
49    */
50   public function setupBundle() {
51     $this->createMediaType('test', [
52       'id' => $this->bundle,
53       'queue_thumbnail_downloads' => FALSE,
54     ]);
55   }
56
57   /**
58    * {@inheritdoc}
59    */
60   protected function getTranslatorPermissions() {
61     return array_merge(parent::getTranslatorPermissions(), [
62       'administer media',
63       'edit any test media',
64     ]);
65   }
66
67   /**
68    * {@inheritdoc}
69    */
70   protected function getEditorPermissions() {
71     return ['administer media', 'create test media'];
72   }
73
74   /**
75    * {@inheritdoc}
76    */
77   protected function getAdministratorPermissions() {
78     return array_merge(parent::getAdministratorPermissions(), [
79       'access administration pages',
80       'administer media types',
81       'access media overview',
82       'administer languages',
83     ]);
84   }
85
86   /**
87    * {@inheritdoc}
88    */
89   protected function getNewEntityValues($langcode) {
90     return [
91       'name' => [['value' => $this->randomMachineName()]],
92       'field_media_test' => [['value' => $this->randomMachineName()]],
93     ] + parent::getNewEntityValues($langcode);
94   }
95
96 }