本文整理汇总了PHP中Drupal\KernelTests\KernelTestBase类的典型用法代码示例。如果您正苦于以下问题:PHP KernelTestBase类的具体用法?PHP KernelTestBase怎么用?PHP KernelTestBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KernelTestBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* {@inheritdoc}
*/
public function setUp()
{
parent::setUp();
$this->installSchema('system', ['sequence']);
$this->installEntitySchema('user');
$this->installEntitySchema('block_content');
}
示例2: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->container->get('module_handler')->loadInclude('user', 'install');
$this->installEntitySchema('user');
user_install();
}
示例3: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->installEntitySchema('ceb_test_content');
$this->installEntitySchema('user');
$this->installSchema('system', ['sequences']);
}
示例4: 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');
}
示例5: 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');
}
示例6: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->installSchema('system', 'sequences');
$this->installEntitySchema('user');
$this->typedDataResolver = \Drupal::service('ctools.typed_data.resolver');
}
示例7: 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'));
}
示例8: setUp
protected function setUp()
{
parent::setUp();
$this->installEntitySchema('node');
$this->installEntitySchema('user');
$this->installConfig(array('field', 'node', 'user'));
}
示例9: 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();
}
示例10: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->installEntitySchema('node');
$this->installEntitySchema('user');
$this->installConfig('workbench_moderation');
}
示例11: 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');
}
示例12: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->actionManager = $this->container->get('plugin.manager.action');
$this->installEntitySchema('user');
$this->installSchema('system', array('sequences'));
}
示例13: 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();
}
示例14: register
/**
* {@inheritdoc}
*/
public function register(ContainerBuilder $container)
{
parent::register($container);
$parameters = $container->getParameter('twig.config');
$parameters['debug'] = TRUE;
$container->setParameter('twig.config', $parameters);
}
示例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');
}