Yaffs site version 1.1
[yaffs-website] / web / modules / contrib / metatag / src / Tests / MetatagFieldTermTest.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 taxonomy terms.
10  *
11  * @group metatag
12  */
13 class MetatagFieldTermTest 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     'taxonomy',
36   ];
37
38   /**
39    * {@inheritDoc}
40    */
41   protected $entity_perms = [
42     // From Field UI.
43     'administer taxonomy_term fields',
44
45     // From Taxonomy.
46     'administer taxonomy',
47     'edit terms in tags',
48     'delete terms in tags',
49   ];
50
51   /**
52    * {@inheritDoc}
53    */
54   protected $entity_type = 'taxonomy_term';
55
56   /**
57    * {@inheritDoc}
58    */
59   protected $entity_label = 'Taxonomy term';
60
61   /**
62    * {@inheritDoc}
63    */
64   protected $entity_bundle = 'entity_test';
65
66   /**
67    * {@inheritDoc}
68    */
69   protected $entity_add_path = 'admin/structure/taxonomy/manage/tags/add';
70
71   /**
72    * {@inheritDoc}
73    */
74   protected $entity_field_admin_path = 'admin/structure/taxonomy/manage/tags/overview/fields';
75
76   /**
77    * {@inheritDoc}
78    */
79   protected $entity_title_field = 'name';
80
81   /**
82    * {@inheritDoc}
83    */
84   protected function setUpEntityType() {
85     $new_perms = [
86       // From Taxonomy.
87       'administer taxonomy',
88     ];
89     $all_perms = array_merge($this->base_perms, $new_perms);
90     $this->adminUser = $this->drupalCreateUser($all_perms);
91     $this->drupalLogin($this->adminUser);
92     $this->drupalGet('admin/structure/taxonomy/add');
93     $this->assertResponse(200);
94     $edit = [
95       'name' => 'Tags',
96       'vid' => 'tags',
97     ];
98     $this->drupalPostForm(NULL, $edit, t('Save'));
99     $this->drupalLogout();
100   }
101
102 }