本文整理汇总了PHP中Drupal\Tests\views\Kernel\ViewsKernelTestBase::setUpFixtures方法的典型用法代码示例。如果您正苦于以下问题:PHP ViewsKernelTestBase::setUpFixtures方法的具体用法?PHP ViewsKernelTestBase::setUpFixtures怎么用?PHP ViewsKernelTestBase::setUpFixtures使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Tests\views\Kernel\ViewsKernelTestBase
的用法示例。
在下文中一共展示了ViewsKernelTestBase::setUpFixtures方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUpFixtures
/**
* {@inheritdoc}
*/
protected function setUpFixtures()
{
$this->installEntitySchema('user');
$this->installEntitySchema('entity_test');
$this->installConfig(['entity_test']);
Block::create(['id' => 'test_block', 'plugin' => 'system_main_block'])->save();
parent::setUpFixtures();
}
示例2: setUpFixtures
protected function setUpFixtures()
{
$this->installEntitySchema('user');
$this->installEntitySchema('node');
$this->installEntitySchema('comment');
$this->installSchema('comment', array('comment_entity_statistics'));
$this->installConfig(array('system', 'field', 'node', 'comment'));
NodeType::create(['type' => 'page', 'name' => 'Page'])->save();
$this->addDefaultCommentField('node', 'page');
parent::setUpFixtures();
$this->installConfig(array('filter'));
}
示例3: setUpFixtures
/**
* {@inheritdoc}
*/
protected function setUpFixtures()
{
parent::setUpFixtures();
$this->installEntitySchema('user');
$this->installEntitySchema('entity_test');
$this->installConfig(['user']);
// Create some test entities.
for ($i = 0; $i < 5; $i++) {
EntityTest::create(['name' => $this->randomString()])->save();
}
// Create and admin user.
$this->adminUser = $this->createUser(['view test entity'], FALSE, TRUE);
Role::load(AccountInterface::ANONYMOUS_ROLE)->grantPermission('view test entity')->save();
}
示例4: setUpFixtures
/**
* {@inheritdoc}
*/
protected function setUpFixtures()
{
parent::setUpFixtures();
$this->installEntitySchema('user');
$this->installEntitySchema('node');
$this->installSchema('node', 'node_access');
$type = NodeType::create(['type' => 'test']);
$type->save();
$this->editorUser = $this->createUser(['bypass node access']);
$this->powerUser = $this->createUser(['access content', 'create test content', 'edit own test content', 'delete own test content']);
$this->regularUser = $this->createUser(['access content']);
// Create some test entities.
for ($i = 0; $i < 5; $i++) {
Node::create(['title' => 'b' . $i . $this->randomMachineName(), 'type' => 'test'])->save();
}
// Create a power user node.
Node::create(['title' => 'z' . $this->randomMachineName(), 'uid' => $this->powerUser->id(), 'type' => 'test'])->save();
}
示例5: setUpFixtures
/**
* {@inheritdoc}
*/
protected function setUpFixtures()
{
$this->installEntitySchema('user');
$this->installEntitySchema('entity_test');
$this->installConfig(['entity_test']);
EntityViewMode::create(['id' => 'entity_test.foobar', 'targetEntityType' => 'entity_test', 'status' => TRUE, 'enabled' => TRUE, 'label' => 'My view mode'])->save();
$display = EntityViewDisplay::create(['targetEntityType' => 'entity_test', 'bundle' => 'entity_test', 'mode' => 'foobar', 'label' => 'My view mode', 'status' => TRUE]);
$display->save();
$field_storage = FieldStorageConfig::create(['field_name' => 'test_field', 'entity_type' => 'entity_test', 'type' => 'string']);
$field_storage->save();
$field_config = FieldConfig::create(['field_name' => 'test_field', 'entity_type' => 'entity_test', 'bundle' => 'entity_test']);
$field_config->save();
// Create some test entities.
for ($i = 1; $i <= 3; $i++) {
EntityTest::create(['name' => "Article title {$i}", 'test_field' => "Test {$i}"])->save();
}
$this->user = User::create(['name' => 'test user']);
$this->user->save();
parent::setUpFixtures();
}
示例6: setUpFixtures
/**
* {@inheritdoc}
*/
protected function setUpFixtures()
{
Block::create(['id' => 'bartik_branding', 'theme' => 'bartik', 'plugin' => 'system_branding_block', 'weight' => 1])->save();
Block::create(['id' => 'bartik_powered', 'theme' => 'bartik', 'plugin' => 'system_powered_by_block', 'weight' => 2])->save();
parent::setUpFixtures();
}