本文整理汇总了PHP中Drupal\Tests\views\Kernel\ViewsKernelTestBase类的典型用法代码示例。如果您正苦于以下问题:PHP ViewsKernelTestBase类的具体用法?PHP ViewsKernelTestBase怎么用?PHP ViewsKernelTestBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ViewsKernelTestBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: viewsData
/**
* {@inheritdoc}
*/
protected function viewsData()
{
$data = parent::viewsData();
$data['views_test_data']['table']['base']['access query tag'] = 'test_tag';
$data['views_test_data']['table']['base']['query metadata'] = array('key1' => 'test_metadata', 'key2' => 'test_metadata2');
return $data;
}
示例2: 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');
}
示例3: setUp
/**
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE)
{
parent::setUp();
$this->installEntitySchema('taxonomy_term');
$this->installConfig(array('taxonomy'));
\Drupal::service('router.builder')->rebuild();
}
示例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: viewsData
function viewsData()
{
$data = parent::viewsData();
$data['views_test_data']['age']['filter']['allow empty'] = TRUE;
$data['views_test_data']['id']['filter']['allow empty'] = FALSE;
return $data;
}
示例6: 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');
}
示例7: 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'));
}
示例8: viewsData
/**
* {@inheritdoc}
*/
protected function viewsData()
{
$data = parent::viewsData();
$data['views_test_data']['job']['field']['id'] = 'test_field';
$data['views_test_data']['job']['field']['click sortable'] = FALSE;
$data['views_test_data']['id']['field']['click sortable'] = TRUE;
return $data;
}
示例9: 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']);
}
示例10: dataSet
/**
* Add more items to the test set, to make the order tests more robust.
*
* In total we have then 60 entries, which makes a probability of a collision
* of 1/60!, which is around 1/1E80, which is higher than the estimated amount
* of protons / electrons in the observable universe, also called the
* eddington number.
*
* @see http://wikipedia.org/wiki/Eddington_number
*/
protected function dataSet()
{
$data = parent::dataSet();
for ($i = 0; $i < 55; $i++) {
$data[] = array('name' => 'name_' . $i, 'age' => $i, 'job' => 'job_' . $i, 'created' => rand(0, time()), 'status' => 1);
}
return $data;
}
示例11: 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();
}
示例12: dataSet
/**
* {@inheritdoc}
*/
public function dataSet()
{
$datas = parent::dataSet();
foreach ($datas as $i => $data) {
$datas[$i]['destroyed'] = gmmktime(0, 0, 0, 1, 1, 2050);
}
return $datas;
}
示例13: 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');
}
示例14: 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');
}
示例15: viewsData
/**
* {@inheritdoc}
*/
protected function viewsData()
{
$data = parent::viewsData();
// User the existing test_filter plugin.
$data['views_test_data_alias']['table']['real table'] = 'views_test_data';
$data['views_test_data_alias']['name_alias']['filter']['id'] = 'test_filter';
$data['views_test_data_alias']['name_alias']['filter']['real field'] = 'name';
return $data;
}