165a1e4137bea1510659b67a950dda77cf51ccab
[yaffs-website] / web / modules / contrib / metatag / src / Tests / MetatagFieldUserTest.php
1 <?php
2
3 namespace Drupal\metatag\Tests;
4
5 use Drupal\Core\Cache\Cache;
6 use Drupal\metatag\Tests\MetatagFieldTestBase;
7
8 /**
9  * Ensures that the Metatag field works correctly on users.
10  *
11  * @group metatag
12  */
13 class MetatagFieldUserTest extends MetatagFieldTestBase {
14
15   /**
16    * {@inheritDoc}
17    */
18   public static $modules = [
19     // Needed for token handling.
20     'token',
21
22     // Needed for the field UI testing.
23     'field_ui',
24
25     // Needed to verify that nothing is broken for unsupported entities.
26     'contact',
27
28     // The base module.
29     'metatag',
30
31     // Some extra custom logic for testing Metatag.
32     'metatag_test_tag',
33
34     // Manages the entity type that is being tested.
35     'user',
36   ];
37
38   /**
39    * {@inheritDoc}
40    */
41   protected $entity_perms = [
42     // From Field UI.
43     'administer user fields',
44
45     // From User.
46     'administer account settings',
47     'administer users',
48   ];
49
50   /**
51    * {@inheritDoc}
52    */
53   protected $entity_type = 'user';
54
55   /**
56    * {@inheritDoc}
57    */
58   protected $entity_label = 'User';
59
60   /**
61    * {@inheritDoc}
62    */
63   protected $entity_bundle = 'user';
64
65   /**
66    * {@inheritDoc}
67    */
68   protected $entity_add_path = 'admin/people/create';
69
70   /**
71    * {@inheritDoc}
72    */
73   protected $entity_field_admin_path = 'admin/config/people/accounts/fields';
74
75   /**
76    * {@inheritDoc}
77    */
78   protected $entity_title_field = 'name';
79
80   /**
81    * {@inheritDoc}
82    */
83   protected $entity_save_button_label = 'Create new account';
84
85   /**
86    * {@inheritDoc}
87    */
88   protected function entity_default_values($title = 'Barfoo') {
89     $password = $this->randomString(16);
90     return [
91       'mail' => 'test' . $this->adminUser->getEmail(),
92       'name' => $title,
93       'pass[pass1]' => $password,
94       'pass[pass2]' => $password,
95     ];
96   }
97
98   /**
99    * Confirm the metatag field can be shown on a user registration page.
100    *
101    * @todo
102    */
103   // protected function testFieldsOnUserRegistrationForm() {}
104
105   /**
106    * Confirm the metatag field can be shown on a normal user's own edit form.
107    *
108    * @todo
109    */
110   // protected function testFieldsOnUserEditForm() {}
111
112 }