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 module permissions.
17 'access media overview',
19 'administer media fields',
20 'administer media form display',
21 'administer media display',
22 'administer media types',
26 'access content overview',
28 'administer content types',
29 'administer node fields',
30 'administer node form display',
31 'administer node display',
36 * An admin test user account.
38 * @var \Drupal\Core\Session\AccountInterface
43 * A non-admin test user account.
45 * @var \Drupal\user\UserInterface
47 protected $nonAdminUser;
50 * The storage service.
52 * @var \Drupal\Core\Entity\EntityStorageInterface
59 protected function setUp() {
62 // Have two users ready to be used in tests.
63 $this->adminUser = $this->drupalCreateUser(static::$adminUserPermissions);
64 $this->nonAdminUser = $this->drupalCreateUser([]);
65 // Start off logged in as admin.
66 $this->drupalLogin($this->adminUser);
68 $this->storage = $this->container->get('entity_type.manager')->getStorage('media');