本文整理汇总了PHP中Drupal\Tests\views\Kernel\ViewsKernelTestBase::setUp方法的典型用法代码示例。如果您正苦于以下问题:PHP ViewsKernelTestBase::setUp方法的具体用法?PHP ViewsKernelTestBase::setUp怎么用?PHP ViewsKernelTestBase::setUp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Tests\views\Kernel\ViewsKernelTestBase
的用法示例。
在下文中一共展示了ViewsKernelTestBase::setUp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE)
{
parent::setUp();
$this->installEntitySchema('taxonomy_term');
$this->installConfig(array('taxonomy'));
\Drupal::service('router.builder')->rebuild();
}
示例2: setUp
/**
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE)
{
parent::setUp($import_test_views);
$this->installEntitySchema('node');
$this->installEntitySchema('user');
$this->installSchema('node', 'node_access');
}
示例3: setUp
/**
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE)
{
parent::setUp($import_test_views);
$this->entityManger = $this->container->get('entity.manager');
$this->menuLinkManager = $this->container->get('plugin.manager.menu.link');
$this->menuLinkOverrides = $this->container->get('menu_link.static.overrides');
}
示例4: setUp
/**
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE)
{
parent::setUp($import_test_views);
$this->installEntitySchema('user');
$this->installEntitySchema('comment');
// Create the anonymous role.
$this->installConfig(['user']);
// Create an anonymous user.
$storage = \Drupal::entityManager()->getStorage('user');
// Insert a row for the anonymous user.
$storage->create(array('uid' => 0, 'name' => '', 'status' => 0))->save();
$admin_role = Role::create(['id' => 'admin', 'permissions' => ['administer comments', 'access user profiles']]);
$admin_role->save();
/* @var \Drupal\user\RoleInterface $anonymous_role */
$anonymous_role = Role::load(Role::ANONYMOUS_ID);
$anonymous_role->grantPermission('access comments');
$anonymous_role->save();
$this->adminUser = User::create(['name' => $this->randomMachineName(), 'roles' => [$admin_role->id()]]);
$this->adminUser->save();
// Create some comments.
$comment = Comment::create(['subject' => 'My comment title', 'uid' => $this->adminUser->id(), 'name' => $this->adminUser->label(), 'entity_type' => 'entity_test', 'comment_type' => 'entity_test', 'status' => 1]);
$comment->save();
$comment_anonymous = Comment::create(['subject' => 'Anonymous comment title', 'uid' => 0, 'name' => 'barry', 'mail' => 'test@example.com', 'homepage' => 'https://example.com', 'entity_type' => 'entity_test', 'comment_type' => 'entity_test', 'created' => 123456, 'status' => 1]);
$comment_anonymous->save();
}
示例5: setUp
protected function setUp($import_test_views = TRUE)
{
parent::setUp();
$this->installConfig(array('language'));
// Create another language beside English.
ConfigurableLanguage::create(array('id' => 'xx-lolspeak', 'label' => 'Lolspeak'))->save();
}
示例6: setUp
/**
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE)
{
parent::setUp();
// Rebuild the router, otherwise we can't generate links.
$this->container->get('router.builder')->rebuild();
$this->installSchema('dblog', array('watchdog'));
ViewTestData::createTestViews(get_class($this), array('dblog_test_views'));
}
示例7: setUp
/**
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE)
{
parent::setUp($import_test_views);
$this->installEntitySchema('node');
$this->installEntitySchema('user');
$this->installConfig(['node', 'field']);
ViewTestData::createTestViews(get_class($this), ['node_test_views']);
}
示例8: setUp
/**
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE)
{
parent::setUp();
$this->installEntitySchema('user');
$this->installEntitySchema('entity_test');
$this->installEntitySchema('entity_test_mul');
$this->storage = $this->container->get('entity.manager')->getStorage('entity_test');
ConfigurableLanguage::createFromLangcode('it')->save();
}
示例9: setUp
/**
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE)
{
parent::setUp($import_test_views);
$this->installEntitySchema('node');
$this->installEntitySchema('taxonomy_term');
$this->installEntitySchema('user');
// Setup the current time properly.
\Drupal::request()->server->set('REQUEST_TIME', time());
}
示例10: setUp
/**
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE)
{
parent::setUp();
$this->installEntitySchema('aggregator_item');
$this->installEntitySchema('aggregator_feed');
ViewTestData::createTestViews(get_class($this), array('aggregator_test_views'));
$this->itemStorage = $this->container->get('entity.manager')->getStorage('aggregator_item');
$this->feedStorage = $this->container->get('entity.manager')->getStorage('aggregator_feed');
}
示例11: setUp
protected function setUp($import_test_views = TRUE)
{
parent::setUp();
ViewTestData::createTestViews(get_class($this), array('user_test_views'));
$this->installEntitySchema('user');
$entity_manager = $this->container->get('entity.manager');
$this->roleStorage = $entity_manager->getStorage('user_role');
$this->userStorage = $entity_manager->getStorage('user');
}
示例12: setUp
/**
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE)
{
parent::setUp($import_test_views);
$this->installSchema('node', 'node_access');
$this->installEntitySchema('node');
$this->installEntitySchema('user');
if ($import_test_views) {
ViewTestData::createTestViews(get_class($this), ['node_test_views']);
}
}
示例13: setUp
/**
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE)
{
parent::setUp();
$this->installEntitySchema('user');
$this->installEntitySchema('entity_test');
$this->installEntitySchema('entity_test_mul');
// Create reference from entity_test to entity_test_mul.
$this->createEntityReferenceField('entity_test', 'entity_test', 'field_test_data', 'field_test_data', 'entity_test_mul');
// Create reference from entity_test_mul to entity_test.
$this->createEntityReferenceField('entity_test_mul', 'entity_test_mul', 'field_data_test', 'field_data_test', 'entity_test');
ViewTestData::createTestViews(get_class($this), array('entity_reference_test_views'));
}
示例14: setUp
/**
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE)
{
parent::setUp($import_test_views);
$this->installEntitySchema('node');
$this->installEntitySchema('user');
$this->installEntitySchema('content_moderation_state');
$this->installSchema('node', 'node_access');
$this->installConfig('content_moderation_test_views');
$this->installConfig('content_moderation');
$node_type = NodeType::create(['type' => 'page']);
$node_type->setThirdPartySetting('content_moderation', 'enabled', TRUE);
$node_type->save();
}
示例15: setUp
/**
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE)
{
parent::setUp($import_test_views);
$this->installEntitySchema('user');
$role_with_access = Role::create(['id' => 'with_access', 'permissions' => ['view test entity field']]);
$role_with_access->save();
$role_without_access = Role::create(['id' => 'without_access', 'permissions' => []]);
$role_without_access->save();
$this->userWithAccess = User::create(['name' => $this->randomMachineName(), 'roles' => [$role_with_access->id()]]);
$this->userWithAccess->save();
$this->userWithoutAccess = User::create(['name' => $this->randomMachineName(), 'roles' => [$role_without_access->id()]]);
$this->userWithoutAccess->save();
}