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