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


PHP simpletest\DrupalUnitTestBase类代码示例

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


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

示例1: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->actionManager = $this->container->get('plugin.manager.action');
     $this->installEntitySchema('user');
     $this->installSchema('system', array('sequences'));
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:10,代码来源:ActionUnitTest.php

示例2: setUp

 /**
  * {@inheritdoc}
  */
 function setUp()
 {
     parent::setUp();
     $this->installSchema('system', array('url_alias', 'router'));
     $this->installEntitySchema('user');
     $this->installEntitySchema('entity_test');
     $this->installConfig(array('field', 'language'));
     // Add English as a language.
     $english = new Language(array('id' => 'en', 'name' => 'English'));
     language_save($english);
     // Add German as a language.
     $german = new Language(array('id' => 'de', 'name' => 'Deutsch', 'weight' => -1));
     language_save($german);
     // Create the test text field.
     entity_create('field_storage_config', array('name' => 'field_test_text', 'entity_type' => 'entity_test', 'type' => 'text'))->save();
     entity_create('field_instance_config', array('entity_type' => 'entity_test', 'field_name' => 'field_test_text', 'bundle' => 'entity_test', 'translatable' => FALSE))->save();
     // Create the test translatable field.
     entity_create('field_storage_config', array('name' => 'field_test_translatable_text', 'entity_type' => 'entity_test', 'type' => 'text'))->save();
     entity_create('field_instance_config', array('entity_type' => 'entity_test', 'field_name' => 'field_test_translatable_text', 'bundle' => 'entity_test', 'translatable' => TRUE))->save();
     // Create the test entity reference field.
     entity_create('field_storage_config', array('name' => 'field_test_entity_reference', 'entity_type' => 'entity_test', 'type' => 'entity_reference', 'settings' => array('target_type' => 'entity_test')))->save();
     entity_create('field_instance_config', array('entity_type' => 'entity_test', 'field_name' => 'field_test_entity_reference', 'bundle' => 'entity_test', 'translatable' => TRUE))->save();
     $entity_manager = \Drupal::entityManager();
     $link_manager = new LinkManager(new TypeLinkManager(new MemoryBackend('default')), new RelationLinkManager(new MemoryBackend('default'), $entity_manager));
     $chain_resolver = new ChainEntityResolver(array(new UuidResolver($entity_manager), new TargetIdResolver()));
     // Set up the mock serializer.
     $normalizers = array(new ContentEntityNormalizer($link_manager, $entity_manager, \Drupal::moduleHandler()), new EntityReferenceItemNormalizer($link_manager, $chain_resolver), new FieldItemNormalizer(), new FieldNormalizer());
     $encoders = array(new JsonEncoder());
     $this->serializer = new Serializer($normalizers, $encoders);
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:33,代码来源:NormalizerTestBase.php

示例3: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->container->get('module_handler')->loadInclude('user', 'install');
     $this->installEntitySchema('user');
     user_install();
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:10,代码来源:UserInstallTest.php

示例4: setUp

 protected function setUp()
 {
     parent::setUp();
     // Ensure the global variable being asserted by this test does not exist;
     // a previous test executed in this request/process might have set it.
     unset($GLOBALS['hook_config_test']);
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:7,代码来源:ConfigInstallTest.php

示例5: setUp

 function setUp()
 {
     parent::setUp();
     // Configure the theme system.
     $this->installConfig(array('system', 'field'));
     $this->installEntitySchema('entity_test');
     // @todo Add helper methods for all of the following.
     $this->entity_type = 'entity_test';
     if (!isset($this->bundle)) {
         $this->bundle = $this->entity_type;
     }
     $this->field_name = drupal_strtolower($this->randomName());
     $this->field_type = 'text_long';
     $this->field_settings = array();
     $this->instance_settings = array('text_processing' => FALSE);
     $this->formatter_type = 'string';
     $this->formatter_settings = array();
     $this->fieldStorage = entity_create('field_storage_config', array('name' => $this->field_name, 'entity_type' => $this->entity_type, 'type' => $this->field_type, 'settings' => $this->field_settings));
     $this->fieldStorage->save();
     $this->instance = entity_create('field_instance_config', array('field_storage' => $this->fieldStorage, 'bundle' => $this->bundle, 'label' => $this->randomName(), 'settings' => $this->instance_settings));
     $this->instance->save();
     $this->view_mode = 'default';
     $this->display = entity_get_display($this->entity_type, $this->bundle, $this->view_mode)->setComponent($this->field_name, array('type' => $this->formatter_type, 'settings' => $this->formatter_settings));
     $this->display->save();
     $this->langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED;
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:26,代码来源:TextPlainUnitTest.php

示例6: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->installConfig(array('system'));
     $this->installSchema('system', array('router'));
     \Drupal::service('router.builder')->rebuild();
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:7,代码来源:RenderElementTypesTest.php

示例7: setUp

 function setUp()
 {
     parent::setUp();
     // There are dependencies in drupal_get_js() on the theme layer so we need
     // to initialize it.
     drupal_theme_initialize();
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:7,代码来源:RenderTest.php

示例8: setUp

 /**
  * Set the default field storage backend for fields created during tests.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('user');
     // Set default storage backend.
     $this->installConfig(array('field'));
 }
开发者ID:anyforsoft,项目名称:csua_d8,代码行数:10,代码来源:NodeImportCreateTest.php

示例9: setUp

 /**
  * Sets the default field storage backend for fields created during tests.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->fields = new \ArrayObject(array(), \ArrayObject::ARRAY_AS_PROPS);
     $this->installEntitySchema('entity_test');
     $this->installConfig(array('field', 'filter'));
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:10,代码来源:QuickEditTestBase.php

示例10: setUp

 public function setUp()
 {
     parent::setUp();
     // Update the config snapshot. This allows the parent::setUp() to write
     // configuration files.
     \Drupal::service('config.manager')->createSnapshot(\Drupal::service('config.storage'), \Drupal::service('config.storage.snapshot'));
     $this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.staging'));
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:8,代码来源:ConfigSnapshotTest.php

示例11: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('user');
     $this->installSchema('system', array('sequences'));
     // Make sure that the default roles exist.
     $this->installConfig(array('user'));
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:11,代码来源:UserValidationTest.php

示例12: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->installConfig(array('language'));
     // Setup Italian.
     ConfigurableLanguage::createFromLangcode('it')->save();
     $this->manager = $this->container->get('plugin.manager.condition');
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:8,代码来源:LanguageConditionTest.php

示例13: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->installConfig(array('system'));
     $manager = $this->container->get('plugin.manager.filter');
     $bag = new FilterBag($manager, array());
     $this->filters = $bag->getAll();
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:8,代码来源:FilterUnitTest.php

示例14: checkRequirements

 protected function checkRequirements()
 {
     // GD2 support is available.
     if (!function_exists('imagegd2')) {
         return array('Image manipulations for the GD toolkit cannot run because the GD toolkit is not available.');
     }
     return parent::checkRequirements();
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:8,代码来源:ToolkitGdTest.php

示例15: tearDown

 function tearDown()
 {
     // Restore configured value for JavaScript preprocessing.
     $config = \Drupal::config('system.performance');
     $config->set('js.preprocess', $this->preprocess_js);
     $config->save();
     parent::tearDown();
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:8,代码来源:JavaScriptTest.php


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