comparison core/modules/taxonomy/tests/src/Functional/VocabularyCrudTest.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
1 <?php 1 <?php
2 2
3 namespace Drupal\Tests\taxonomy\Functional; 3 namespace Drupal\Tests\taxonomy\Functional;
4 4
5 use Drupal\Component\Utility\Unicode;
6 use Drupal\field\Entity\FieldConfig; 5 use Drupal\field\Entity\FieldConfig;
7 use Drupal\taxonomy\Entity\Vocabulary; 6 use Drupal\taxonomy\Entity\Vocabulary;
8 use Drupal\field\Entity\FieldStorageConfig; 7 use Drupal\field\Entity\FieldStorageConfig;
9 8
10 /** 9 /**
142 * Test uninstall and reinstall of the taxonomy module. 141 * Test uninstall and reinstall of the taxonomy module.
143 */ 142 */
144 public function testUninstallReinstall() { 143 public function testUninstallReinstall() {
145 // Field storages and fields attached to taxonomy term bundles should be 144 // Field storages and fields attached to taxonomy term bundles should be
146 // removed when the module is uninstalled. 145 // removed when the module is uninstalled.
147 $field_name = Unicode::strtolower($this->randomMachineName() . '_field_name'); 146 $field_name = mb_strtolower($this->randomMachineName() . '_field_name');
148 $storage_definition = [ 147 $storage_definition = [
149 'field_name' => $field_name, 148 'field_name' => $field_name,
150 'entity_type' => 'taxonomy_term', 149 'entity_type' => 'taxonomy_term',
151 'type' => 'text', 150 'type' => 'text',
152 'cardinality' => 4 151 'cardinality' => 4,
153 ]; 152 ];
154 FieldStorageConfig::create($storage_definition)->save(); 153 FieldStorageConfig::create($storage_definition)->save();
155 $field_definition = [ 154 $field_definition = [
156 'field_name' => $field_name, 155 'field_name' => $field_name,
157 'entity_type' => 'taxonomy_term', 156 'entity_type' => 'taxonomy_term',
163 // Remove the third party setting from the memory copy of the vocabulary. 162 // Remove the third party setting from the memory copy of the vocabulary.
164 // We keep this invalid copy around while the taxonomy module is not even 163 // We keep this invalid copy around while the taxonomy module is not even
165 // installed for testing below. 164 // installed for testing below.
166 $this->vocabulary->unsetThirdPartySetting('taxonomy_crud', 'foo'); 165 $this->vocabulary->unsetThirdPartySetting('taxonomy_crud', 'foo');
167 166
168 require_once \Drupal::root() . '/core/includes/install.inc'; 167 require_once $this->root . '/core/includes/install.inc';
169 $this->container->get('module_installer')->uninstall(['taxonomy']); 168 $this->container->get('module_installer')->uninstall(['taxonomy']);
170 $this->container->get('module_installer')->install(['taxonomy']); 169 $this->container->get('module_installer')->install(['taxonomy']);
171 170
172 // Now create a vocabulary with the same name. All fields 171 // Now create a vocabulary with the same name. All fields
173 // connected to this vocabulary name should have been removed when the 172 // connected to this vocabulary name should have been removed when the