本文整理汇总了PHP中Drupal\taxonomy\Tests\TaxonomyTestBase::setUp方法的典型用法代码示例。如果您正苦于以下问题:PHP TaxonomyTestBase::setUp方法的具体用法?PHP TaxonomyTestBase::setUp怎么用?PHP TaxonomyTestBase::setUp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\taxonomy\Tests\TaxonomyTestBase
的用法示例。
在下文中一共展示了TaxonomyTestBase::setUp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
function setUp()
{
parent::setUp();
$this->admin_user = $this->drupalCreateUser(array('administer taxonomy'));
$this->drupalLogin($this->admin_user);
$this->vocabulary = $this->createVocabulary();
}
示例2: setUp
protected function setUp()
{
parent::setUp();
$this->drupalLogin($this->drupalCreateUser(['administer taxonomy']));
$this->vocabulary = $this->createVocabulary();
$this->drupalPlaceBlock('local_actions_block');
}
示例3: setUp
protected function setUp()
{
parent::setUp();
$this->vocabulary = $this->createVocabulary();
// RDF mapping - term bundle.
rdf_get_mapping('taxonomy_term', $this->vocabulary->id())->setBundleMapping(array('types' => array('skos:Concept')))->setFieldMapping('name', array('properties' => array('rdfs:label', 'skos:prefLabel')))->save();
}
示例4: setUp
protected function setUp()
{
parent::setUp();
$admin_user = $this->drupalCreateUser(array('create article content', 'administer taxonomy'));
$this->drupalLogin($admin_user);
$this->vocabulary = $this->createVocabulary();
}
示例5: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->setupLanguages();
$this->vocabulary = $this->createVocabulary();
$this->enableTranslation();
$this->setUpTerms();
$this->setUpTermReferenceField();
}
示例6: setUp
protected function setUp()
{
parent::setUp();
// Create an administrative user.
$this->drupalLogin($this->drupalCreateUser(['administer taxonomy']));
// Add some custom languages.
ConfigurableLanguage::create(array('id' => 'aa', 'label' => $this->randomMachineName()))->save();
ConfigurableLanguage::create(array('id' => 'bb', 'label' => $this->randomMachineName()))->save();
}
示例7: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
// Create filter format.
$restricted_html_format = entity_create('filter_format', array('format' => 'restricted_html', 'name' => 'Restricted HTML', 'filters' => array('filter_html' => array('status' => TRUE, 'weight' => -10, 'settings' => array('allowed_html' => '<p> <br /> <strong> <a> <em> <h4>')), 'filter_autop' => array('status' => TRUE, 'weight' => 0), 'filter_url' => array('status' => TRUE, 'weight' => 0), 'filter_htmlcorrector' => array('status' => TRUE, 'weight' => 10))));
$restricted_html_format->save();
// Create user then login.
$this->user = $this->drupalCreateUser(array('administer site configuration', 'access site map', 'administer menu', 'administer nodes', 'create article content', 'administer taxonomy', $restricted_html_format->getPermissionName()));
$this->drupalLogin($this->user);
}
示例8: setUp
protected function setUp()
{
parent::setUp();
$this->drupalLogin($this->drupalCreateUser(['administer taxonomy', 'bypass node access', 'administer content types', 'administer node display']));
$this->vocabulary = $this->createVocabulary();
$this->fieldName = 'taxonomy_' . $this->vocabulary->id();
$handler_settings = array('target_bundles' => array($this->vocabulary->id() => $this->vocabulary->id()), 'auto_create' => TRUE);
$this->createEntityReferenceField('node', 'article', $this->fieldName, NULL, 'taxonomy_term', 'default', $handler_settings, FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
entity_get_form_display('node', 'article', 'default')->setComponent($this->fieldName, array('type' => 'options_select'))->save();
entity_get_display('node', 'article', 'default')->setComponent($this->fieldName, array('type' => 'entity_reference_label'))->save();
}
示例9: setUp
protected function setUp()
{
parent::setUp();
$this->drupalLogin($this->drupalCreateUser(['administer taxonomy', 'bypass node access']));
$this->vocabulary = $this->createVocabulary();
$this->fieldName = 'taxonomy_' . $this->vocabulary->id();
entity_create('field_storage_config', array('field_name' => $this->fieldName, 'entity_type' => 'node', 'type' => 'taxonomy_term_reference', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED, 'settings' => array('allowed_values' => array(array('vocabulary' => $this->vocabulary->id(), 'parent' => 0)))))->save();
entity_create('field_config', array('field_name' => $this->fieldName, 'bundle' => 'article', 'entity_type' => 'node'))->save();
entity_get_form_display('node', 'article', 'default')->setComponent($this->fieldName, array('type' => 'options_select'))->save();
entity_get_display('node', 'article', 'default')->setComponent($this->fieldName, array('type' => 'taxonomy_term_reference_link'))->save();
}
示例10: setUp
protected function setUp()
{
parent::setUp();
// Create a tags vocabulary for the 'article' content type.
$vocabulary = Vocabulary::create(['name' => 'Tags', 'vid' => 'tags']);
$vocabulary->save();
$field_name = 'field_' . $vocabulary->id();
$handler_settings = array('target_bundles' => array($vocabulary->id() => $vocabulary->id()), 'auto_create' => TRUE);
$this->createEntityReferenceField('node', 'article', $field_name, 'Tags', 'taxonomy_term', 'default', $handler_settings, FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
entity_get_form_display('node', 'article', 'default')->setComponent($field_name, array('type' => 'entity_reference_autocomplete_tags'))->save();
$this->drupalLogin($this->drupalCreateUser(['administer taxonomy', 'administer nodes', 'bypass node access']));
}
示例11: setUp
protected function setUp()
{
parent::setUp();
// Create an administrative user.
$this->drupalLogin($this->drupalCreateUser(['administer taxonomy']));
// Create a vocabulary to which the terms will be assigned.
$this->vocabulary = $this->createVocabulary();
// Add some custom languages.
foreach (array('aa', 'bb', 'cc') as $language_code) {
ConfigurableLanguage::create(array('id' => $language_code, 'label' => $this->randomMachineName()))->save();
}
}
示例12: setUp
function setUp()
{
parent::setUp();
// Create an administrative user.
$this->admin_user = $this->drupalCreateUser(array('administer taxonomy'));
$this->drupalLogin($this->admin_user);
// Add some custom languages.
$language = new Language(array('id' => 'aa', 'name' => $this->randomMachineName()));
language_save($language);
$language = new Language(array('id' => 'bb', 'name' => $this->randomMachineName()));
language_save($language);
}
示例13: setUp
protected function setUp()
{
parent::setUp();
// Create a tags vocabulary for the 'article' content type.
$vocabulary = entity_create('taxonomy_vocabulary', array('name' => 'Tags', 'vid' => 'tags'));
$vocabulary->save();
$field_name = 'field_' . $vocabulary->id();
entity_create('field_storage_config', array('field_name' => $field_name, 'entity_type' => 'node', 'type' => 'taxonomy_term_reference', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED, 'settings' => array('allowed_values' => array(array('vocabulary' => $vocabulary->id(), 'parent' => 0)))))->save();
entity_create('field_config', array('entity_type' => 'node', 'field_name' => $field_name, 'bundle' => 'article', 'label' => 'Tags'))->save();
entity_get_form_display('node', 'article', 'default')->setComponent($field_name, array('type' => 'taxonomy_autocomplete'))->save();
$this->drupalLogin($this->drupalCreateUser(['administer taxonomy', 'administer nodes', 'bypass node access']));
}
示例14: setUp
protected function setUp()
{
parent::setUp();
$this->drupalLogin($this->drupalCreateUser(['view test entity', 'administer entity_test content', 'administer taxonomy']));
$this->vocabulary1 = $this->createVocabulary();
$this->vocabulary2 = $this->createVocabulary();
// Set up a field storage and a field.
$this->fieldName = Unicode::strtolower($this->randomMachineName());
entity_create('field_storage_config', array('field_name' => $this->fieldName, 'entity_type' => 'entity_test', 'type' => 'taxonomy_term_reference', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED, 'settings' => array('allowed_values' => array(array('vocabulary' => $this->vocabulary1->id(), 'parent' => '0'), array('vocabulary' => $this->vocabulary2->id(), 'parent' => '0')))))->save();
entity_create('field_config', array('field_name' => $this->fieldName, 'entity_type' => 'entity_test', 'bundle' => 'entity_test'))->save();
entity_get_form_display('entity_test', 'entity_test', 'default')->setComponent($this->fieldName, array('type' => 'options_select'))->save();
entity_get_display('entity_test', 'entity_test', 'full')->setComponent($this->fieldName, array('type' => 'taxonomy_term_reference_link'))->save();
}
示例15: setUp
protected function setUp()
{
parent::setUp();
$web_user = $this->drupalCreateUser(array('bypass node access', 'administer taxonomy'));
$this->drupalLogin($web_user);
$this->vocabulary = $this->createVocabulary();
// Create the field.
$this->fieldName = 'field_taxonomy_test';
$this->createTaxonomyTermReferenceField($this->fieldName, $this->vocabulary);
// Set the RDF mapping for the new field.
rdf_get_mapping('node', 'article')->setFieldMapping($this->fieldName, array('properties' => array('dc:subject'), 'mapping_type' => 'rel'))->save();
rdf_get_mapping('taxonomy_term', $this->vocabulary->id())->setBundleMapping(array('types' => array('skos:Concept')))->setFieldMapping('name', array('properties' => array('rdfs:label')))->save();
}