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


PHP Tests\ViewTestBase类代码示例

本文整理汇总了PHP中Drupal\views\Tests\ViewTestBase的典型用法代码示例。如果您正苦于以下问题:PHP ViewTestBase类的具体用法?PHP ViewTestBase怎么用?PHP ViewTestBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ViewTestBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->enableViewsTestModule();
     // Add an admin user will full rights;
     $this->admin = $this->drupalCreateUser(array('administer views'));
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:7,代码来源:AnalyzeTest.php

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

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

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

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

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

示例7: setUp

 protected function setUp()
 {
     parent::setUp();
     // Create and log in a user with administer views permission.
     $views_admin = $this->drupalCreateUser(array('administer views', 'administer blocks', 'bypass node access', 'access user profiles', 'view all revisions'));
     $this->drupalLogin($views_admin);
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:7,代码来源:WizardTestBase.php

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

示例9: setUp

 protected function setUp()
 {
     parent::setUp();
     // Create a new content type
     $content_type = $this->drupalCreateContentType();
     // Add a node of the new content type.
     $node_data = array('type' => $content_type->id());
     $this->addDefaultCommentField('node', $content_type->id());
     $this->node = $this->drupalCreateNode($node_data);
     // Force a flush of the in-memory storage.
     $this->container->get('views.views_data')->clear();
     // Create some comments and attach them to the created node.
     for ($i = 0; $i < $this->masterDisplayResults; $i++) {
         /** @var \Drupal\comment\CommentInterface $comment */
         $comment = Comment::create(array('status' => CommentInterface::PUBLISHED, 'field_name' => 'comment', 'entity_type' => 'node', 'entity_id' => $this->node->id()));
         $comment->setOwnerId(0);
         $comment->setSubject('Test comment ' . $i);
         $comment->comment_body->value = 'Test body ' . $i;
         $comment->comment_body->format = 'full_html';
         // Ensure comments are sorted in ascending order.
         $time = REQUEST_TIME + ($this->masterDisplayResults - $i);
         $comment->setCreatedTime($time);
         $comment->changed->value = $time;
         $comment->save();
     }
     // Store all the nodes just created to access their properties on the tests.
     $this->commentsCreated = Comment::loadMultiple();
     // Sort created comments in descending order.
     ksort($this->commentsCreated, SORT_NUMERIC);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:30,代码来源:DefaultViewRecentCommentsTest.php

示例10: setUp

 protected function setUp()
 {
     parent::setUp();
     // Create Basic page node type.
     $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
     $this->vocabulary = entity_create('taxonomy_vocabulary', array('name' => $this->randomMachineName(), 'description' => $this->randomMachineName(), 'vid' => drupal_strtolower($this->randomMachineName()), 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'help' => '', 'nodes' => array('page' => 'page'), 'weight' => mt_rand(0, 10)));
     $this->vocabulary->save();
     // Setup a field and instance.
     $this->field_name = drupal_strtolower($this->randomMachineName());
     entity_create('field_storage_config', array('name' => $this->field_name, 'entity_type' => 'node', 'type' => 'taxonomy_term_reference', 'settings' => array('allowed_values' => array(array('vocabulary' => $this->vocabulary->id(), 'parent' => '0')))))->save();
     entity_create('field_instance_config', array('field_name' => $this->field_name, 'entity_type' => 'node', 'bundle' => 'page'))->save();
     // Create a time in the past for the archive.
     $time = REQUEST_TIME - 3600;
     $this->container->get('comment.manager')->addDefaultField('node', 'page');
     $this->container->get('views.views_data')->clear();
     for ($i = 0; $i <= 10; $i++) {
         $user = $this->drupalCreateUser();
         $term = $this->createTerm($this->vocabulary);
         $values = array('created' => $time, 'type' => 'page');
         $values[$this->field_name][]['target_id'] = $term->id();
         // Make every other node promoted.
         if ($i % 2) {
             $values['promote'] = TRUE;
         }
         $values['body'][]['value'] = l('Node ' . 1, 'node/' . 1);
         $node = $this->drupalCreateNode($values);
         $comment = array('uid' => $user->id(), 'status' => CommentInterface::PUBLISHED, 'entity_id' => $node->id(), 'entity_type' => 'node', 'field_name' => 'comment');
         entity_create('comment', $comment)->save();
     }
     // Some views, such as the "Who's Online" view, only return results if at
     // least one user is logged in.
     $account = $this->drupalCreateUser(array());
     $this->drupalLogin($account);
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:34,代码来源:DefaultViewsTest.php

示例11: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->enableViewsTestModule();
     $this->adminUser = $this->drupalCreateUser(['administer views', 'administer menu']);
     $this->drupalPlaceBlock('system_menu_block:main');
     $this->drupalCreateContentType(['type' => 'page']);
 }
开发者ID:briefmedia-digital,项目名称:drupal8,代码行数:11,代码来源:MenuLinkTest.php

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

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

示例14: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->enableViewsTestModule();
     // Set up a render array to use. We need to copy this as drupal_render
     // passes by reference.
     $this->render = array('view' => array('#type' => 'view', '#name' => 'test_view_embed', '#display_id' => 'default', '#arguments' => array(25), '#embed' => FALSE));
 }
开发者ID:ravibarnwal,项目名称:laraitassociate.in,代码行数:8,代码来源:ViewElementTest.php

示例15: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->enableViewsTestModule();
     $this->adminUser = $this->drupalCreateUser(array('administer views'));
     $this->fullAdminUser = $this->drupalCreateUser(array('administer views', 'administer blocks', 'bypass node access', 'access user profiles', 'view all revisions'));
     $this->drupalLogin($this->fullAdminUser);
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:8,代码来源:UITestBase.php


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