3 namespace Drupal\Tests\media\Functional;
6 * Trait with helpers for Media functional tests.
8 trait MediaFunctionalTestTrait {
11 * Permissions for the admin user that will be logged-in for test.
15 protected static $adminUserPermissions = [
16 // Media entity permissions.
18 'administer media fields',
19 'administer media form display',
20 'administer media display',
21 'administer media types',
30 'access content overview',
32 'administer content types',
33 'administer node fields',
34 'administer node form display',
39 * An admin test user account.
41 * @var \Drupal\Core\Session\AccountInterface
46 * A non-admin test user account.
48 * @var \Drupal\user\UserInterface
50 protected $nonAdminUser;
53 * The storage service.
55 * @var \Drupal\Core\Entity\EntityStorageInterface
62 protected function setUp() {
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);
71 $this->storage = $this->container->get('entity_type.manager')->getStorage('media');