當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。