当前位置: 首页>>代码示例>>PHP>>正文


PHP entity_test_install函数代码示例

本文整理汇总了PHP中entity_test_install函数的典型用法代码示例。如果您正苦于以下问题:PHP entity_test_install函数的具体用法?PHP entity_test_install怎么用?PHP entity_test_install使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了entity_test_install函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->languageManager = $this->container->get('language_manager');
     $this->installEntitySchema('entity_test_rev');
     $this->installEntitySchema('entity_test_mul');
     $this->installEntitySchema('entity_test_mulrev');
     $this->installConfig(array('language'));
     // Create the test field.
     entity_test_install();
     // Enable translations for the test entity type.
     $this->state->set('entity_test.translation', TRUE);
     // Create a translatable test field.
     $this->field_name = drupal_strtolower($this->randomMachineName() . '_field_name');
     // Create an untranslatable test field.
     $this->untranslatable_field_name = drupal_strtolower($this->randomMachineName() . '_field_name');
     // Create field fields in all entity variations.
     foreach (entity_test_entity_types() as $entity_type) {
         entity_create('field_storage_config', array('field_name' => $this->field_name, 'entity_type' => $entity_type, 'type' => 'text', 'cardinality' => 4))->save();
         entity_create('field_config', array('field_name' => $this->field_name, 'entity_type' => $entity_type, 'bundle' => $entity_type, 'translatable' => TRUE))->save();
         $this->field[$entity_type] = entity_load('field_config', $entity_type . '.' . $entity_type . '.' . $this->field_name);
         entity_create('field_storage_config', array('field_name' => $this->untranslatable_field_name, 'entity_type' => $entity_type, 'type' => 'text', 'cardinality' => 4))->save();
         entity_create('field_config', array('field_name' => $this->untranslatable_field_name, 'entity_type' => $entity_type, 'bundle' => $entity_type, 'translatable' => FALSE))->save();
     }
     // Create the default languages.
     $this->installConfig(array('language'));
     // Create test languages.
     $this->langcodes = array();
     for ($i = 0; $i < 3; ++$i) {
         $language = ConfigurableLanguage::create(array('id' => 'l' . $i, 'label' => $this->randomString(), 'weight' => $i));
         $this->langcodes[$i] = $language->getId();
         $language->save();
     }
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:34,代码来源:EntityLanguageTestBase.php

示例2: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Create the test field.
     entity_test_install();
     // Install required default configuration for filter module.
     $this->installConfig(array('system', 'filter'));
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:11,代码来源:EntityValidationTest.php

示例3: setUp

 protected function setUp()
 {
     parent::setUp();
     // Install field configuration.
     $this->installConfig(array('field'));
     // The users table is needed for creating dummy user accounts.
     $this->installEntitySchema('user');
     // Register entity_test text field.
     module_load_install('entity_test');
     entity_test_install();
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:11,代码来源:FieldAccessTest.php

示例4: setUp

 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('entity_test_rev');
     $this->installEntitySchema('entity_test_mul');
     $this->installEntitySchema('entity_test_mulrev');
     // Create the test field.
     entity_test_install();
     // Install required default configuration for filter module.
     $this->installConfig(array('system', 'filter'));
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:14,代码来源:EntityValidationTest.php

示例5: setUp

 protected function setUp()
 {
     parent::setUp();
     foreach (entity_test_entity_types() as $entity_type_id) {
         // The entity_test schema is installed by the parent.
         if ($entity_type_id != 'entity_test') {
             $this->installEntitySchema($entity_type_id);
         }
     }
     // Create the test field.
     entity_test_install();
     // Install required default configuration for filter module.
     $this->installConfig(array('system', 'filter'));
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:14,代码来源:EntityFieldTest.php

示例6: setUp

 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     // Add the languages.
     $this->installConfig(['language']);
     ConfigurableLanguage::createFromLangcode('de')->save();
     ConfigurableLanguage::createFromLangcode('cs')->save();
     $this->installEntitySchema('tmgmt_job');
     $this->installEntitySchema('tmgmt_job_item');
     $this->installEntitySchema('tmgmt_remote');
     $this->installEntitySchema('tmgmt_message');
     $this->installEntitySchema('entity_test_rev');
     $this->installEntitySchema('entity_test_mulrev');
     $this->installEntitySchema('entity_test_mul');
     $this->container->get('content_translation.manager')->setEnabled('entity_test_mul', 'entity_test_mul', TRUE);
     $this->installSchema('system', array('router'));
     $this->installSchema('node', array('node_access'));
     \Drupal::moduleHandler()->loadInclude('entity_test', 'install');
     entity_test_install();
     // Make the test field translatable.
     $field_storage = FieldStorageConfig::loadByName('entity_test_mul', 'field_test_text');
     $field_storage->setCardinality(2);
     $field_storage->save();
     $field = FieldConfig::loadByName('entity_test_mul', 'entity_test_mul', 'field_test_text');
     $field->setTranslatable(TRUE);
     $field->save();
     // Add an image field and make it translatable.
     $this->installEntitySchema('file');
     $this->installSchema('file', array('file_usage'));
     $this->installConfig(array('node'));
     \Drupal::service('router.builder')->rebuild();
     $field_storage = FieldStorageConfig::create(array('field_name' => 'image_test', 'entity_type' => $this->entityTypeId, 'type' => 'image', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED, 'translatable' => TRUE));
     $field_storage->save();
     FieldConfig::create(array('entity_type' => $this->entityTypeId, 'field_storage' => $field_storage, 'bundle' => $this->entityTypeId, 'label' => $this->image_label = $this->randomMachineName()))->save();
     file_unmanaged_copy(DRUPAL_ROOT . '/core/misc/druplicon.png', 'public://example.jpg');
     $this->image = entity_create('file', array('uri' => 'public://example.jpg'));
     $this->image->save();
     tmgmt_translator_auto_create(\Drupal::service('plugin.manager.tmgmt.translator')->getDefinition('test_translator'));
 }
开发者ID:andrewl,项目名称:andrewlnet,代码行数:42,代码来源:ContentEntitySourceUnitTest.php

示例7: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->languageManager = $this->container->get('language_manager');
     foreach (entity_test_entity_types() as $entity_type_id) {
         // The entity_test schema is installed by the parent.
         if ($entity_type_id != 'entity_test') {
             $this->installEntitySchema($entity_type_id);
         }
     }
     $this->installConfig(array('language'));
     // Create the test field.
     module_load_install('entity_test');
     entity_test_install();
     // Enable translations for the test entity type.
     $this->state->set('entity_test.translation', TRUE);
     // Create a translatable test field.
     $this->fieldName = Unicode::strtolower($this->randomMachineName() . '_field_name');
     // Create an untranslatable test field.
     $this->untranslatableFieldName = Unicode::strtolower($this->randomMachineName() . '_field_name');
     // Create field fields in all entity variations.
     foreach (entity_test_entity_types() as $entity_type) {
         FieldStorageConfig::create(array('field_name' => $this->fieldName, 'entity_type' => $entity_type, 'type' => 'text', 'cardinality' => 4))->save();
         FieldConfig::create(['field_name' => $this->fieldName, 'entity_type' => $entity_type, 'bundle' => $entity_type, 'translatable' => TRUE])->save();
         FieldStorageConfig::create(array('field_name' => $this->untranslatableFieldName, 'entity_type' => $entity_type, 'type' => 'text', 'cardinality' => 4))->save();
         FieldConfig::create(['field_name' => $this->untranslatableFieldName, 'entity_type' => $entity_type, 'bundle' => $entity_type, 'translatable' => FALSE])->save();
     }
     // Create the default languages.
     $this->installConfig(array('language'));
     // Create test languages.
     $this->langcodes = array();
     for ($i = 0; $i < 3; ++$i) {
         $language = ConfigurableLanguage::create(array('id' => 'l' . $i, 'label' => $this->randomString(), 'weight' => $i));
         $this->langcodes[$i] = $language->getId();
         $language->save();
     }
 }
开发者ID:sojo,项目名称:d8_friendsofsilence,代码行数:37,代码来源:EntityLanguageTestBase.php


注:本文中的entity_test_install函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。