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


PHP KernelTestBase::setUp方法代码示例

本文整理汇总了PHP中Drupal\KernelTests\KernelTestBase::setUp方法的典型用法代码示例。如果您正苦于以下问题:PHP KernelTestBase::setUp方法的具体用法?PHP KernelTestBase::setUp怎么用?PHP KernelTestBase::setUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\KernelTests\KernelTestBase的用法示例。


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

示例1: setUp

 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $this->installSchema('system', ['sequence']);
     $this->installEntitySchema('user');
     $this->installEntitySchema('block_content');
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:10,代码来源:BlockContentDeletionTest.php

示例2: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('ceb_test_content');
     $this->installEntitySchema('user');
     $this->installSchema('system', ['sequences']);
 }
开发者ID:heddn,项目名称:content_entity_base,代码行数:10,代码来源:ContentEntityBaseStorageTest.php

示例3: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Determine what database backend is running, and set the skip flag.
     $this->skipTests = Database::getConnection()->databaseType() !== 'mysql';
     // Create some schemas so our export contains tables.
     $this->installSchema('system', ['key_value_expire', 'sessions']);
     $this->installSchema('dblog', ['watchdog']);
     $this->installEntitySchema('block_content');
     $this->installEntitySchema('user');
     $this->installEntitySchema('file');
     $this->installEntitySchema('menu_link_content');
     $this->installSchema('system', 'sequences');
     // Place some sample config to test for in the export.
     $this->data = ['foo' => $this->randomMachineName(), 'bar' => $this->randomMachineName()];
     $storage = new DatabaseStorage(Database::getConnection(), 'config');
     $storage->write('test_config', $this->data);
     // Create user account with some potential syntax issues.
     $account = User::create(['mail' => 'q\'uote$dollar@example.com', 'name' => '$dollar']);
     $account->save();
     // Create url_alias (this will create 'url_alias').
     $this->container->get('path.alias_storage')->save('/user/' . $account->id(), '/user/example');
     // Create a cache table (this will create 'cache_discovery').
     \Drupal::cache('discovery')->set('test', $this->data);
     // These are all the tables that should now be in place.
     $this->tables = ['block_content', 'block_content_field_data', 'block_content_field_revision', 'block_content_revision', 'cachetags', 'config', 'cache_bootstrap', 'cache_config', 'cache_data', 'cache_discovery', 'cache_entity', 'file_managed', 'key_value_expire', 'menu_link_content', 'menu_link_content_data', 'sequences', 'sessions', 'url_alias', 'user__roles', 'users', 'users_field_data', 'watchdog'];
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:30,代码来源:DbDumpTest.php

示例4: setUp

  /**
   * {@inheritdoc}
   */
  public function setUp() {
    parent::setUp();

    $this->state = $this->container->get('state');

    $this->installEntitySchema('user');
    $this->installSchema('search_api', array('search_api_item', 'search_api_task'));

    // Create a test server.
    $this->server = Server::create(array(
      'name' => $this->randomString(),
      'id' => $this->randomMachineName(),
      'status' => 1,
      'backend' => 'search_api_test_backend',
    ));
    $this->server->save();

    // Create a test index.
    $this->index = Index::create(array(
      'name' => $this->randomString(),
      'id' => $this->randomMachineName(),
      'status' => 1,
      'datasources' => array('entity:user'),
      'tracker' => 'default',
      'server' => $this->server->id(),
      'options' => array('index_directly' => FALSE),
    ));
    $this->index->save();

    $this->serverTaskManager = $this->container->get('search_api.server_task_manager');
  }
开发者ID:jkyto,项目名称:agolf,代码行数:34,代码来源:ServerTaskUnitTest.php

示例5: setUp

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

示例6: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('user');
     $this->installConfig(['user']);
     $this->installSchema('system', ['sequences']);
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:10,代码来源:RenderCacheTest.php

示例7: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installSchema('system', 'key_value_expire');
     $this->installSchema('search_api', array('search_api_task'));
     $this->storage = $this->container->get('entity_type.manager')->getStorage('search_api_server');
 }
开发者ID:curveagency,项目名称:intranet,代码行数:10,代码来源:ServerStorageTest.php

示例8: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->entityTypeId = 'config_test';
     $this->entityId = 'test_1';
     $this->container->get('entity_type.manager')->getStorage($this->entityTypeId)->create(array('id' => $this->entityId, 'label' => 'Original label'))->save();
 }
开发者ID:318io,项目名称:318-io,代码行数:10,代码来源:ConfigEntityStaticCacheTest.php

示例9: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->moduleHandler = $this->container->get('module_handler');
     $this->projectStorage = $this->container->get('locale.project');
     \Drupal::state()->set('locale.remove_core_project', TRUE);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:10,代码来源:LocaleTranslationProjectsTest.php

示例10: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->container->get('router.builder')->rebuild();
     $this->assetResolver = $this->container->get('asset.resolver');
     $this->renderer = $this->container->get('renderer');
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:10,代码来源:AttachedAssetsTest.php

示例11: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('node');
     $this->installEntitySchema('user');
     $this->installConfig(array('field', 'node', 'user'));
 }
开发者ID:ravibarnwal,项目名称:laraitassociate.in,代码行数:7,代码来源:EntityDisplayTest.php

示例12: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('node');
     $this->installEntitySchema('user');
     $this->installConfig('workbench_moderation');
 }
开发者ID:tedbow,项目名称:scheduled-updates-demo,代码行数:10,代码来源:EntityStateChangeValidationTest.php

示例13: setUp

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

示例14: setUp

 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     // Enable translation for the entity_test module.
     \Drupal::state()->set('entity_test.translation', TRUE);
     $this->installSchema('search_api', array('search_api_item', 'search_api_task'));
     $this->installEntitySchema('entity_test_mul');
     // Create the default languages.
     $this->installConfig(array('language'));
     $this->langcodes = array();
     for ($i = 0; $i < 3; ++$i) {
         /** @var \Drupal\language\Entity\ConfigurableLanguage $language */
         $language = ConfigurableLanguage::create(array('id' => 'l' . $i, 'label' => 'language - ' . $i, 'weight' => $i));
         $this->langcodes[$i] = $language->getId();
         $language->save();
     }
     // Do not use a batch for tracking the initial items after creating an
     // index when running the tests via the GUI. Otherwise, it seems Drupal's
     // Batch API gets confused and the test fails.
     \Drupal::state()->set('search_api_use_tracking_batch', FALSE);
     // Create a test server.
     $this->server = Server::create(array('name' => 'Test Server', 'id' => 'test_server', 'status' => 1, 'backend' => 'search_api_test_backend'));
     $this->server->save();
     // Create a test index.
     $this->index = Index::create(array('name' => 'Test Index', 'id' => 'test_index', 'status' => 1, 'datasource_settings' => array('entity:' . $this->testEntityTypeId => array('plugin_id' => 'entity:' . $this->testEntityTypeId, 'settings' => array())), 'tracker_settings' => array('default' => array('plugin_id' => 'default', 'settings' => array())), 'server' => $this->server->id(), 'options' => array('index_directly' => FALSE)));
     $this->index->save();
 }
开发者ID:curveagency,项目名称:intranet,代码行数:30,代码来源:LanguageKernelTest.php

示例15: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Install all core themes.
     sort($this->allThemes);
     $this->container->get('theme_installer')->install($this->allThemes);
     // Enable all core modules.
     $all_modules = system_rebuild_module_data();
     $all_modules = array_filter($all_modules, function ($module) {
         // Filter contrib, hidden, already enabled modules and modules in the
         // Testing package.
         if ($module->origin !== 'core' || !empty($module->info['hidden']) || $module->status == TRUE || $module->info['package'] == 'Testing') {
             return FALSE;
         }
         return TRUE;
     });
     $this->allModules = array_keys($all_modules);
     $this->allModules[] = 'system';
     sort($this->allModules);
     $this->container->get('module_installer')->install($this->allModules);
     $this->themeHandler = $this->container->get('theme_handler');
     $this->themeInitialization = $this->container->get('theme.initialization');
     $this->themeManager = $this->container->get('theme.manager');
     $this->libraryDiscovery = $this->container->get('library.discovery');
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:28,代码来源:ResolvedLibraryDefinitionsFilesMatchTest.php


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