当前位置: 首页>>代码示例>>PHP>>正文


PHP ViewTestData::createTestViews方法代码示例

本文整理汇总了PHP中Drupal\views\Tests\ViewTestData::createTestViews方法的典型用法代码示例。如果您正苦于以下问题:PHP ViewTestData::createTestViews方法的具体用法?PHP ViewTestData::createTestViews怎么用?PHP ViewTestData::createTestViews使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\views\Tests\ViewTestData的用法示例。


在下文中一共展示了ViewTestData::createTestViews方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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($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

示例5: 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

示例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

 /**
  * {@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

示例8: 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

示例9: 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

示例10: 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

示例11: setUp

 protected function setUp($import_test_views = TRUE)
 {
     parent::setUp();
     if ($import_test_views) {
         ViewTestData::createTestViews(get_class($this), array('views_test_config'));
     }
 }
开发者ID:sojo,项目名称:d8_friendsofsilence,代码行数:7,代码来源:ViewTestBase.php

示例12: 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

示例13: 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

示例14: 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

示例15: 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


注:本文中的Drupal\views\Tests\ViewTestData::createTestViews方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。