Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / media / tests / src / Functional / MediaFunctionalTestTrait.php
1 <?php
2
3 namespace Drupal\Tests\media\Functional;
4
5 /**
6  * Trait with helpers for Media functional tests.
7  */
8 trait MediaFunctionalTestTrait {
9
10   /**
11    * Permissions for the admin user that will be logged-in for test.
12    *
13    * @var array
14    */
15   protected static $adminUserPermissions = [
16     // Media entity permissions.
17     'administer media',
18     'administer media fields',
19     'administer media form display',
20     'administer media display',
21     'administer media types',
22     'view media',
23     'create media',
24     'update media',
25     'update any media',
26     'delete media',
27     'delete any media',
28     // Other permissions.
29     'administer views',
30     'access content overview',
31     'view all revisions',
32     'administer content types',
33     'administer node fields',
34     'administer node form display',
35     'bypass node access',
36   ];
37
38   /**
39    * An admin test user account.
40    *
41    * @var \Drupal\Core\Session\AccountInterface
42    */
43   protected $adminUser;
44
45   /**
46    * A non-admin test user account.
47    *
48    * @var \Drupal\user\UserInterface
49    */
50   protected $nonAdminUser;
51
52   /**
53    * The storage service.
54    *
55    * @var \Drupal\Core\Entity\EntityStorageInterface
56    */
57   protected $storage;
58
59   /**
60    * {@inheritdoc}
61    */
62   protected function setUp() {
63     parent::setUp();
64
65     // Have two users ready to be used in tests.
66     $this->adminUser = $this->drupalCreateUser(static::$adminUserPermissions);
67     $this->nonAdminUser = $this->drupalCreateUser([]);
68     // Start off logged in as admin.
69     $this->drupalLogin($this->adminUser);
70
71     $this->storage = $this->container->get('entity_type.manager')->getStorage('media');
72   }
73
74 }