comparison core/modules/taxonomy/src/Tests/TaxonomyTestTrait.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
2 2
3 namespace Drupal\taxonomy\Tests; 3 namespace Drupal\taxonomy\Tests;
4 4
5 @trigger_error(__NAMESPACE__ . '\TaxonomyTestTrait is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, use \Drupal\Tests\taxonomy\Functional\TaxonomyTestTrait', E_USER_DEPRECATED); 5 @trigger_error(__NAMESPACE__ . '\TaxonomyTestTrait is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, use \Drupal\Tests\taxonomy\Functional\TaxonomyTestTrait', E_USER_DEPRECATED);
6 6
7 use Drupal\Component\Utility\Unicode;
8 use Drupal\Core\Language\LanguageInterface; 7 use Drupal\Core\Language\LanguageInterface;
9 use Drupal\taxonomy\Entity\Vocabulary; 8 use Drupal\taxonomy\Entity\Vocabulary;
10 use Drupal\taxonomy\Entity\Term; 9 use Drupal\taxonomy\Entity\Term;
11 10
12 /** 11 /**
23 public function createVocabulary() { 22 public function createVocabulary() {
24 // Create a vocabulary. 23 // Create a vocabulary.
25 $vocabulary = Vocabulary::create([ 24 $vocabulary = Vocabulary::create([
26 'name' => $this->randomMachineName(), 25 'name' => $this->randomMachineName(),
27 'description' => $this->randomMachineName(), 26 'description' => $this->randomMachineName(),
28 'vid' => Unicode::strtolower($this->randomMachineName()), 27 'vid' => mb_strtolower($this->randomMachineName()),
29 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 28 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
30 'weight' => mt_rand(0, 10), 29 'weight' => mt_rand(0, 10),
31 ]); 30 ]);
32 $vocabulary->save(); 31 $vocabulary->save();
33 return $vocabulary; 32 return $vocabulary;