Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / metatag / src / Tests / MetatagFieldTermTest.php
1 <?php
2
3 namespace Drupal\metatag\Tests;
4
5 /**
6  * Ensures that the Metatag field works correctly on taxonomy terms.
7  *
8  * @group metatag
9  */
10 class MetatagFieldTermTest extends MetatagFieldTestBase {
11
12   /**
13    * {@inheritdoc}
14    */
15   public static $modules = [
16     // Needed for token handling.
17     'token',
18
19     // Needed for the field UI testing.
20     'field_ui',
21
22     // Needed to verify that nothing is broken for unsupported entities.
23     'contact',
24
25     // The base module.
26     'metatag',
27
28     // Some extra custom logic for testing Metatag.
29     'metatag_test_tag',
30
31     // Manages the entity type that is being tested.
32     'taxonomy',
33   ];
34
35   /**
36    * {@inheritdoc}
37    */
38   protected $entityPerms = [
39     // From Field UI.
40     'administer taxonomy_term fields',
41
42     // From Taxonomy.
43     'administer taxonomy',
44     'edit terms in tags',
45     'delete terms in tags',
46   ];
47
48   /**
49    * {@inheritdoc}
50    */
51   protected $entityType = 'taxonomy_term';
52
53   /**
54    * {@inheritdoc}
55    */
56   protected $entityLabel = 'Taxonomy term';
57
58   /**
59    * {@inheritdoc}
60    */
61   protected $entityBundle = 'entity_test';
62
63   /**
64    * {@inheritdoc}
65    */
66   protected $entityAddPath = 'admin/structure/taxonomy/manage/tags/add';
67
68   /**
69    * {@inheritdoc}
70    */
71   protected $entityFieldAdminPath = 'admin/structure/taxonomy/manage/tags/overview/fields';
72
73   /**
74    * {@inheritdoc}
75    */
76   protected $entityTitleField = 'name';
77
78   /**
79    * {@inheritdoc}
80    */
81   protected function setUpEntityType() {
82     $new_perms = [
83       // From Taxonomy.
84       'administer taxonomy',
85     ];
86     $all_perms = array_merge($this->basePerms, $new_perms);
87     $this->adminUser = $this->drupalCreateUser($all_perms);
88     $this->drupalLogin($this->adminUser);
89     $this->drupalGet('admin/structure/taxonomy/add');
90     $this->assertResponse(200);
91     $edit = [
92       'name' => 'Tags',
93       'vid' => 'tags',
94     ];
95     $this->drupalPostForm(NULL, $edit, t('Save'));
96     $this->drupalLogout();
97   }
98
99 }