本文整理汇总了PHP中Drupal\views\Tests\ViewTestData类的典型用法代码示例。如果您正苦于以下问题:PHP ViewTestData类的具体用法?PHP ViewTestData怎么用?PHP ViewTestData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ViewTestData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: setUp
function setUp()
{
parent::setUp();
// Add two new languages.
ConfigurableLanguage::createFromLangcode('fr')->save();
ConfigurableLanguage::createFromLangcode('es')->save();
// Set up term names.
$this->termNames = array('en' => 'Food in Paris', 'es' => 'Comida en Paris', 'fr' => 'Nouriture en Paris');
// Create a vocabulary.
$this->vocabulary = Vocabulary::create(['name' => 'Views testing tags', 'vid' => 'views_testing_tags']);
$this->vocabulary->save();
// Add a translatable field to the vocabulary.
$field = FieldStorageConfig::create(array('field_name' => 'field_foo', 'entity_type' => 'taxonomy_term', 'type' => 'text'));
$field->save();
FieldConfig::create(['field_name' => 'field_foo', 'entity_type' => 'taxonomy_term', 'label' => 'Foo', 'bundle' => 'views_testing_tags'])->save();
// Create term with translations.
$taxonomy = $this->createTermWithProperties(array('name' => $this->termNames['en'], 'langcode' => 'en', 'description' => $this->termNames['en'], 'field_foo' => $this->termNames['en']));
foreach (array('es', 'fr') as $langcode) {
$translation = $taxonomy->addTranslation($langcode, array('name' => $this->termNames[$langcode]));
$translation->description->value = $this->termNames[$langcode];
$translation->field_foo->value = $this->termNames[$langcode];
}
$taxonomy->save();
Views::viewsData()->clear();
ViewTestData::createTestViews(get_class($this), array('taxonomy_test_views'));
$this->container->get('router.builder')->rebuild();
}
开发者ID:eigentor,项目名称:tommiblog,代码行数:27,代码来源:TaxonomyFieldFilterTest.php
示例2: setUp
/**
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE)
{
parent::setUp($import_test_views);
if ($import_test_views) {
ViewTestData::createTestViews(get_class($this), ['entity_module_test']);
}
}
开发者ID:darrylri,项目名称:protovbmwmo,代码行数:10,代码来源:RenderedEntityTest.php
示例3: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->installEntitySchema('user');
$this->installEntitySchema('entity_test');
ViewTestData::createTestViews(get_class($this), array('entity_reference_test_views'));
$field_storage = FieldStorageConfig::create(array('entity_type' => 'entity_test', 'field_name' => 'field_test', 'type' => 'entity_reference', 'settings' => array('target_type' => 'entity_test'), 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED));
$field_storage->save();
$field = FieldConfig::create(array('entity_type' => 'entity_test', 'field_name' => 'field_test', 'bundle' => 'entity_test', 'settings' => array('handler' => 'default', 'handler_settings' => array())));
$field->save();
// Create some test entities which link each other.
$entity_storage = \Drupal::entityManager()->getStorage('entity_test');
$referenced_entity = $entity_storage->create(array());
$referenced_entity->save();
$this->entities[$referenced_entity->id()] = $referenced_entity;
$entity = $entity_storage->create(array());
$entity->field_test->target_id = $referenced_entity->id();
$entity->save();
$this->assertEqual($entity->field_test[0]->entity->id(), $referenced_entity->id());
$this->entities[$entity->id()] = $entity;
$entity = $entity_storage->create(array());
$entity->field_test->target_id = $referenced_entity->id();
$entity->save();
$this->assertEqual($entity->field_test[0]->entity->id(), $referenced_entity->id());
$this->entities[$entity->id()] = $entity;
Views::viewsData()->clear();
}
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:30,代码来源:EntityReferenceRelationshipTest.php
示例4: setUp
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
ViewTestData::createTestViews(get_class($this), array('views_test_config'));
// Create a Content type and some test nodes with titles that start with
// different letters.
$this->createContentType(['type' => 'page']);
$titles = [
'Page One',
'Page Two',
'Another page',
];
foreach ($titles as $title) {
$this->createNode([
'title' => $title,
'language' => 'en',
]);
$this->createNode([
'title' => $title,
'language' => 'nl',
]);
}
// Create a user privileged enough to use exposed filters and view content.
$user = $this->drupalCreateUser([
'administer site configuration',
'access content',
'access content overview',
]);
$this->drupalLogin($user);
}
开发者ID:Greg-Boggs,项目名称:electric-dev,代码行数:36,代码来源:GlossaryViewTest.php
示例5: viewsData
/**
* Returns the views data definition.
*/
protected function viewsData()
{
$data = ViewTestData::viewsData();
// Tweak the views data to have a base for testing.
unset($data['views_test_data']['id']['field']);
unset($data['views_test_data']['name']['argument']);
unset($data['views_test_data']['age']['filter']);
unset($data['views_test_data']['job']['sort']);
$data['views_test_data']['created']['area']['id'] = 'text';
$data['views_test_data']['age']['area']['id'] = 'text';
$data['views_test_data']['age']['area']['sub_type'] = 'header';
$data['views_test_data']['job']['area']['id'] = 'text';
$data['views_test_data']['job']['area']['sub_type'] = array('header', 'footer');
// Duplicate the example views test data for different weight, different title,
// and matching data.
$data['views_test_data_2'] = $data['views_test_data'];
$data['views_test_data_2']['table']['base']['weight'] = 50;
$data['views_test_data_3'] = $data['views_test_data'];
$data['views_test_data_3']['table']['base']['weight'] = -50;
$data['views_test_data_4'] = $data['views_test_data'];
$data['views_test_data_4']['table']['base']['title'] = 'A different title';
$data['views_test_data_5'] = $data['views_test_data'];
$data['views_test_data_5']['table']['base']['title'] = 'Z different title';
$data['views_test_data_6'] = $data['views_test_data'];
return $data;
}
开发者ID:ddrozdik,项目名称:dmaps,代码行数:29,代码来源:ViewsDataTest.php
示例6: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
// Create users.
$this->bookAuthor = $this->drupalCreateUser(array('create new books', 'create book content', 'edit own book content', 'add content to books'));
ViewTestData::createTestViews(get_class($this), array('book_test_views'));
}
开发者ID:eigentor,项目名称:tommiblog,代码行数:10,代码来源:BookRelationshipTest.php
示例7: setUp
protected function setUp($import_test_views = TRUE)
{
parent::setUp($import_test_views);
if ($import_test_views) {
ViewTestData::createTestViews(get_class($this), array('node_test_views'));
}
}
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:7,代码来源:NodeTestBase.php
示例8: setUp
/**
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE)
{
parent::setUp(FALSE);
$this->drupalCreateContentType(array('type' => 'page'));
$this->addDefaultCommentField('node', 'page');
ViewTestData::createTestViews(get_class($this), array('views_test_config'));
}
开发者ID:nsp15,项目名称:Drupal8,代码行数:10,代码来源:FieldEntityTest.php
示例9: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->enableModules(array('system', 'dblog'));
$this->installSchema('dblog', array('watchdog'));
ViewTestData::createTestViews(get_class($this), array('dblog_test_views'));
}
开发者ID:anatalsceo,项目名称:en-classe,代码行数:10,代码来源:ViewsIntegrationTest.php
示例10: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp(FALSE);
// Create Page content type.
if ($this->profile != 'standard') {
$this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
ViewTestData::createTestViews(get_class($this), array('node_test_views'));
}
// Add two new languages.
ConfigurableLanguage::createFromLangcode('fr')->save();
ConfigurableLanguage::createFromLangcode('es')->save();
// Make the body field translatable. The title is already translatable by
// definition.
$field_storage = FieldStorageConfig::loadByName('node', 'body');
$field_storage->setTranslatable(TRUE);
$field_storage->save();
// Set up node titles. They should not include the words "French",
// "English", or "Spanish", as there is a language field in the view
// that prints out those words.
$this->node_titles = array('es' => array('Primero nodo es', 'Segundo nodo es', 'Tercera nodo es'), 'en' => array('First node en', 'Second node en'), 'fr' => array('Premier nœud fr'));
// Create nodes with translations.
foreach ($this->node_titles['es'] as $index => $title) {
$node = $this->drupalCreateNode(array('title' => $title, 'langcode' => 'es', 'type' => 'page', 'promote' => 1));
foreach (array('en', 'fr') as $langcode) {
if (isset($this->node_titles[$langcode][$index])) {
$translation = $node->addTranslation($langcode, array('title' => $this->node_titles[$langcode][$index]));
$translation->body->value = $this->randomMachineName(32);
}
}
$node->save();
}
$this->container->get('router.builder')->rebuild();
$user = $this->drupalCreateUser(array('access content overview', 'access content'));
$this->drupalLogin($user);
}
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:38,代码来源:NodeLanguageTest.php
示例11: setUp
protected function setUp()
{
parent::setUp();
// Ensure the page node type exists.
NodeType::create(['type' => 'page', 'name' => 'page'])->save();
ViewTestData::createTestViews(get_class($this), array('field_test_views'));
}
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:7,代码来源:FieldTestBase.php
示例12: setUp
protected function setUp($import_test_views = TRUE)
{
parent::setUp($import_test_views);
if ($import_test_views) {
ViewTestData::createTestViews(get_class($this), ['multiversion_test_views']);
}
}
开发者ID:sedurzu,项目名称:ildeposito8,代码行数:7,代码来源:MultiversionTestBase.php
示例13: setUp
protected function setUp()
{
parent::setUp();
$this->installEntitySchema('user');
$this->installEntitySchema('profile');
$this->installEntitySchema('profile_type');
ViewTestData::createTestViews(get_class($this), ['profile_test']);
}
开发者ID:nB-MDSO,项目名称:mdso-d8blog,代码行数:8,代码来源:ProfileViewTest.php
示例14: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
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'));
}
开发者ID:nstielau,项目名称:drops-8,代码行数:11,代码来源:ViewsIntegrationTest.php
示例15: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
// Create and login user.
$this->privileged_user = $this->drupalCreateUser(array('administer site configuration', 'access administration pages'));
$this->drupalLogin($this->privileged_user);
ViewTestData::createTestViews(get_class($this), array('sharethis_test_views'));
}
开发者ID:nB-MDSO,项目名称:mdso-d8blog,代码行数:11,代码来源:SharethisViewsPluginTest.php
示例16: setUp
protected function setUp()
{
parent::setUp();
// Create the user profile field and instance.
entity_create('field_storage_config', array('entity_type' => 'user', 'field_name' => 'user_file', 'type' => 'file', 'translatable' => '0'))->save();
entity_create('field_config', array('label' => 'User File', 'description' => '', 'field_name' => 'user_file', 'entity_type' => 'user', 'bundle' => 'user', 'required' => 0))->save();
ViewTestData::createTestViews(get_class($this), array('file_test_views'));
}
开发者ID:papillon-cendre,项目名称:d8,代码行数:8,代码来源:RelationshipUserFileDataTest.php
示例17: 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']);
}
开发者ID:ddrozdik,项目名称:dmaps,代码行数:11,代码来源:NidArgumentTest.php
示例18: setUp
protected function setUp()
{
parent::setUp();
// Create the user profile field and instance.
FieldStorageConfig::create(array('entity_type' => 'user', 'field_name' => 'user_picture', 'type' => 'image', 'translatable' => '0'))->save();
FieldConfig::create(['label' => 'User Picture', 'description' => '', 'field_name' => 'user_picture', 'entity_type' => 'user', 'bundle' => 'user', 'required' => 0])->save();
ViewTestData::createTestViews(get_class($this), array('image_test_views'));
}
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:8,代码来源:RelationshipUserImageDataTest.php
示例19: setUp
protected function setUp()
{
parent::setUp();
// Ensure that the plugin definitions are cleared.
foreach (ViewExecutable::getPluginTypes() as $plugin_type) {
$this->container->get("plugin.manager.views.{$plugin_type}")->clearCachedDefinitions();
}
ViewTestData::createTestViews(get_class($this), array('ds_test'));
}
开发者ID:darrylri,项目名称:protovbmwmo,代码行数:9,代码来源:ViewsTest.php
示例20: setUp
protected function setUp()
{
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');
}
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:9,代码来源:IntegrationTest.php
注:本文中的Drupal\views\Tests\ViewTestData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论