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


PHP simpletest\KernelTestBase类代码示例

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


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

示例1: setUp

 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $this->destination = new TestEntityFile([]);
     $this->installConfig(['system']);
     file_put_contents('/tmp/test-file.jpg', '');
 }
开发者ID:dev981,项目名称:gaptest,代码行数:10,代码来源:EntityFileTest.php

示例2: 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:ddrozdik,项目名称:dmaps,代码行数:10,代码来源:NodeImportCreateTest.php

示例3: setUp

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

示例4: setUp

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

示例5: 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:ddrozdik,项目名称:dmaps,代码行数:10,代码来源:LocaleTranslationProjectsTest.php

示例6: setUp

 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $this->entityTypeId = 'config_test';
     $this->entityId = 'test_1';
     entity_create($this->entityTypeId, array('id' => $this->entityId, 'label' => 'Original label'))->save();
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:10,代码来源:ConfigEntityStaticCacheTest.php

示例7: containerBuild

 /**
  * {@inheritdoc}
  */
 public function containerBuild(ContainerBuilder $container)
 {
     parent::containerBuild($container);
     $container->register('default_config_test.schema_storage')->setClass('\\Drupal\\config_test\\TestInstallStorage')->addArgument(InstallStorage::CONFIG_SCHEMA_DIRECTORY);
     $definition = $container->getDefinition('config.typed');
     $definition->replaceArgument(1, new Reference('default_config_test.schema_storage'));
 }
开发者ID:sarahwillem,项目名称:OD8,代码行数:10,代码来源:DefaultConfigTest.php

示例8: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installSchema('system', 'sequences');
     $this->installEntitySchema('user');
     $this->manager = $this->container->get('plugin.manager.condition');
     // Set up the authenticated and anonymous roles.
     Role::create(array('id' => RoleInterface::ANONYMOUS_ID, 'label' => 'Anonymous user'))->save();
     Role::create(array('id' => RoleInterface::AUTHENTICATED_ID, 'label' => 'Authenticated user'))->save();
     // Create new role.
     $rid = strtolower($this->randomMachineName(8));
     $label = $this->randomString(8);
     $role = Role::create(array('id' => $rid, 'label' => $label));
     $role->save();
     $this->role = $role;
     // Setup an anonymous user for our tests.
     $this->anonymous = User::create(array('name' => '', 'uid' => 0));
     $this->anonymous->save();
     // Loading the anonymous user adds the correct role.
     $this->anonymous = User::load($this->anonymous->id());
     // Setup an authenticated user for our tests.
     $this->authenticated = User::create(array('name' => $this->randomMachineName()));
     $this->authenticated->save();
     // Add the custom role.
     $this->authenticated->addRole($this->role->id());
 }
开发者ID:neetumorwani,项目名称:blogging,代码行数:29,代码来源:UserRoleConditionTest.php

示例9: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->authmap = \Drupal::service('externalauth.authmap');
     $this->installSchema('externalauth', ['authmap']);
     $this->installEntitySchema('user');
 }
开发者ID:C4AProjects,项目名称:c4apage,代码行数:10,代码来源:AuthmapTest.php

示例10: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->treeStorage = new MenuTreeStorage($this->container->get('database'), $this->container->get('cache.menu'), 'menu_tree');
     $this->connection = $this->container->get('database');
     $this->installEntitySchema('menu_link_content');
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:10,代码来源:MenuTreeStorageTest.php

示例11: 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_data', 'cache_default', '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:sojo,项目名称:d8_friendsofsilence,代码行数:30,代码来源:DbDumpTest.php

示例12: setUp

 /**
  * {@inheritdoc}
  */
 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:sojo,项目名称:d8_friendsofsilence,代码行数:10,代码来源:ConfigInstallTest.php

示例13: tearDown

 /**
  * {@inheritdoc}
  */
 protected function tearDown()
 {
     parent::tearDown();
     // Restore the previous container.
     $this->container = $this->previousContainer;
     \Drupal::setContainer($this->previousContainer);
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:10,代码来源:GetFilenameUnitTest.php

示例14: setUp

  public function setUp() {
    parent::setup();

    $this->installConfig(array('pathauto', 'taxonomy', 'system', 'node'));

    $this->installEntitySchema('user');
    $this->installEntitySchema('node');
    $this->installEntitySchema('taxonomy_term');

    ConfigurableLanguage::createFromLangcode('fr')->save();

    $this->installSchema('node', array('node_access'));
    $this->installSchema('system', array('url_alias', 'sequences', 'router'));

    $type = NodeType::create(['type' => 'page']);
    $type->save();
    node_add_body_field($type);

    $this->nodePattern = $this->createPattern('node', '/content/[node:title]');
    $this->userPattern = $this->createPattern('user', '/users/[user:name]');

    \Drupal::service('router.builder')->rebuild();

    $this->currentUser = entity_create('user', array('name' => $this->randomMachineName()));
    $this->currentUser->save();
  }
开发者ID:AshishNaik021,项目名称:iimisac-d8,代码行数:26,代码来源:PathautoUnitTest.php

示例15: setUp

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


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