Skip to content
Snippets Groups Projects
Commit 745efc7c authored by Malik Naik's avatar Malik Naik Committed by Sascha Grossenbacher
Browse files

Issue #3048451 by jyoti.ohol, maliknaik: Replace deprecated usage of...

Issue #3048451 by jyoti.ohol, maliknaik: Replace deprecated usage of entity_create('taxonomy_term') and entity_create('taxonomy_vocabulary') with a direct call to Term::create() and Vocabulary::create()
parent baf26525
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,8 @@ use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Language\Language;
use Drupal\simpletest\WebTestBase;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\taxonomy\Entity\Term;
use Drupal\taxonomy\Entity\Vocabulary;
/**
* Global redirect test cases.
......@@ -102,7 +104,7 @@ class GlobalRedirectTest extends WebTestBase {
\Drupal::service('path.alias_storage')->save('/admin/config/system/site-information', '/site-info');
// Create a taxonomy term for the forum.
$term = entity_create('taxonomy_term', [
$term = Term::create([
'name' => 'Test Forum Term',
'vid' => 'forums',
'langcode' => Language::LANGCODE_NOT_SPECIFIED,
......@@ -111,13 +113,13 @@ class GlobalRedirectTest extends WebTestBase {
$this->forumTerm = $term;
// Create another taxonomy vocabulary with a term.
$vocab = entity_create('taxonomy_vocabulary', [
$vocab = Vocabulary::create([
'name' => 'test vocab',
'vid' => 'test-vocab',
'langcode' => Language::LANGCODE_NOT_SPECIFIED,
]);
$vocab->save();
$term = entity_create('taxonomy_term', [
$term = Term::create([
'name' => 'Test Term',
'vid' => $vocab->id(),
'langcode' => Language::LANGCODE_NOT_SPECIFIED,
......
......@@ -7,6 +7,8 @@ use Drupal\Core\Language\Language;
use Drupal\Core\Logger\RfcLogLevel;
use Drupal\Core\Url;
use Drupal\simpletest\WebTestBase;
use Drupal\taxonomy\Entity\Term;
use Drupal\taxonomy\Entity\Vocabulary;
/**
* UI tests for redirect module.
......@@ -353,7 +355,7 @@ class RedirectUITest extends WebTestBase {
*/
function createVocabulary() {
// Create a vocabulary.
$vocabulary = entity_create('taxonomy_vocabulary', [
$vocabulary = Vocabulary::create([
'name' => $this->randomMachineName(),
'description' => $this->randomMachineName(),
'vid' => mb_strtolower($this->randomMachineName()),
......@@ -370,7 +372,7 @@ class RedirectUITest extends WebTestBase {
function createTerm($vocabulary) {
$filter_formats = filter_formats();
$format = array_pop($filter_formats);
$term = entity_create('taxonomy_term', [
$term = Term::create([
'name' => $this->randomMachineName(),
'description' => [
'value' => $this->randomMachineName(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment