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


PHP Tests\NodeTestBase类代码示例

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


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

示例1: setUp

 protected function setUp()
 {
     parent::setUp();
     node_access_test_add_field(NodeType::load('article'));
     node_access_rebuild();
     \Drupal::state()->set('node_access_test.private', TRUE);
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:7,代码来源:NodeAccessBaseTableTest.php

示例2: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Create and login user.
     $admin_user = $this->drupalCreateUser(array('administer blocks', 'administer site configuration', 'access administration pages', 'administer sharethis', 'administer nodes'));
     $this->drupalLogin($admin_user);
 }
开发者ID:nB-MDSO,项目名称:mdso-d8blog,代码行数:10,代码来源:SharethisBlockTest.php

示例3: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->drupalPlaceBlock('system_menu_block:main');
     $this->contentAdminUser = $this->drupalCreateUser(array('access content', 'administer content types', 'administer menu'));
     $this->config('user.role.' . RoleInterface::ANONYMOUS_ID)->set('permissions', array())->save();
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:7,代码来源:NodeAccessMenuLinkTest.php

示例4: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     ConfigurableLanguage::createFromLangcode('it')->save();
     /** @var \Drupal\content_translation\ContentTranslationManagerInterface $manager */
     $manager = \Drupal::service('content_translation.manager');
     $manager->setEnabled('node', 'article', TRUE);
     // Create and log in user.
     $web_user = $this->drupalCreateUser(array('view page revisions', 'revert page revisions', 'delete page revisions', 'edit any page content', 'delete any page content', 'translate any entity'));
     $this->drupalLogin($web_user);
     // Create initial node.
     $node = $this->drupalCreateNode();
     $settings = get_object_vars($node);
     $settings['revision'] = 1;
     $settings['isDefaultRevision'] = TRUE;
     $nodes = array();
     $logs = array();
     // Get original node.
     $nodes[] = clone $node;
     // Create three revisions.
     $revision_count = 3;
     for ($i = 0; $i < $revision_count; $i++) {
         $logs[] = $node->revision_log = $this->randomMachineName(32);
         // Create revision with a random title and body and update variables.
         $node->title = $this->randomMachineName();
         $node->body = array('value' => $this->randomMachineName(32), 'format' => filter_default_format());
         $node->setNewRevision();
         $node->save();
         $node = Node::load($node->id());
         // Make sure we get revision information.
         $nodes[] = clone $node;
     }
     $this->nodes = $nodes;
     $this->revisionLogs = $logs;
 }
开发者ID:nsp15,项目名称:Drupal8,代码行数:38,代码来源:NodeRevisionsTest.php

示例5: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->adminUser = $this->drupalCreateUser(array('administer site configuration', 'access administration pages', 'access site reports'));
     $this->drupalLogin($this->adminUser);
     $this->webUser = $this->drupalCreateUser();
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:10,代码来源:NodeAccessRebuildNodeGrantsTest.php

示例6: setUp

 protected function setUp()
 {
     parent::setUp();
     // Create and log in user.
     $web_user = $this->drupalCreateUser(array('view page revisions', 'revert page revisions', 'delete page revisions', 'edit any page content', 'delete any page content'));
     $this->drupalLogin($web_user);
     // Create initial node.
     $node = $this->drupalCreateNode();
     $settings = get_object_vars($node);
     $settings['revision'] = 1;
     $settings['isDefaultRevision'] = TRUE;
     $nodes = array();
     $logs = array();
     // Get original node.
     $nodes[] = clone $node;
     // Create three revisions.
     $revision_count = 3;
     for ($i = 0; $i < $revision_count; $i++) {
         $logs[] = $node->revision_log = $this->randomMachineName(32);
         // Create revision with a random title and body and update variables.
         $node->title = $this->randomMachineName();
         $node->body = array('value' => $this->randomMachineName(32), 'format' => filter_default_format());
         $node->setNewRevision();
         $node->save();
         $node = Node::load($node->id());
         // Make sure we get revision information.
         $nodes[] = clone $node;
     }
     $this->nodes = $nodes;
     $this->revisionLogs = $logs;
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:31,代码来源:NodeRevisionsTest.php

示例7: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Create and log in user.
     $web_user = $this->drupalCreateUser(array('administer nodes', 'edit any page content'));
     $this->drupalLogin($web_user);
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:10,代码来源:NodeRevisionsUiTest.php

示例8: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->addDefaultCommentField('node', 'page');
     $web_user = $this->drupalCreateUser(array('edit own page content', 'create page content'));
     $this->drupalLogin($web_user);
     // Add a vocabulary so we can test different view modes.
     $vocabulary = entity_create('taxonomy_vocabulary', array('name' => $this->randomMachineName(), 'description' => $this->randomMachineName(), 'vid' => $this->randomMachineName(), 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'help' => ''));
     $vocabulary->save();
     $this->vocabulary = $vocabulary;
     // Add a term to the vocabulary.
     $term = entity_create('taxonomy_term', array('name' => $this->randomMachineName(), 'description' => $this->randomMachineName(), 'vid' => $this->vocabulary->id(), 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED));
     $term->save();
     $this->term = $term;
     // Create an image field.
     FieldStorageConfig::create(['field_name' => 'field_image', 'entity_type' => 'node', 'type' => 'image', 'settings' => [], 'cardinality' => FieldStorageConfig::CARDINALITY_UNLIMITED])->save();
     $field_config = FieldConfig::create(['field_name' => 'field_image', 'label' => 'Images', 'entity_type' => 'node', 'bundle' => 'page', 'required' => FALSE, 'settings' => []]);
     $field_config->save();
     // Create a field.
     $this->fieldName = Unicode::strtolower($this->randomMachineName());
     $handler_settings = array('target_bundles' => array($this->vocabulary->id() => $this->vocabulary->id()), 'auto_create' => TRUE);
     $this->createEntityReferenceField('node', 'page', $this->fieldName, 'Tags', 'taxonomy_term', 'default', $handler_settings, FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
     entity_get_form_display('node', 'page', 'default')->setComponent($this->fieldName, array('type' => 'entity_reference_autocomplete_tags'))->save();
     // Show on default display and teaser.
     entity_get_display('node', 'page', 'default')->setComponent($this->fieldName, array('type' => 'entity_reference_label'))->save();
     entity_get_display('node', 'page', 'teaser')->setComponent($this->fieldName, array('type' => 'entity_reference_label'))->save();
     entity_get_form_display('node', 'page', 'default')->setComponent('field_image', array('type' => 'image_image', 'settings' => []))->save();
     entity_get_display('node', 'page', 'default')->setComponent('field_image')->save();
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:29,代码来源:PagePreviewTest.php

示例9: setUp

 protected function setUp()
 {
     parent::setUp();
     // Create users and test node.
     $this->adminUser = $this->drupalCreateUser(array('administer content types', 'administer nodes', 'administer blocks', 'access content overview'));
     $this->webUser = $this->drupalCreateUser(array('access content', 'create article content'));
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:7,代码来源:NodeBlockFunctionalTest.php

示例10: setUp

 protected function setUp()
 {
     parent::setUp();
     // Create a user that is allowed to post; we'll use this to test the submission.
     $web_user = $this->drupalCreateUser(array('create article content'));
     $this->drupalLogin($web_user);
     $this->webUser = $web_user;
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:8,代码来源:NodeSaveTest.php

示例11: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->drupalPlaceBlock('system_breadcrumb_block');
     $this->adminUser = $this->drupalCreateUser(array('administer nodes', 'create article content', 'create page content', 'post comments'));
     $this->drupalLogin($this->adminUser);
     $this->addDefaultCommentField('node', 'page');
 }
开发者ID:318io,项目名称:318-io,代码行数:11,代码来源:NodeTitleTest.php

示例12: setUp

 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $this->config = \Drupal::configFactory()->getEditable('sharethis.settings');
     // Create and log in admin user.
     $this->adminUser = $this->drupalCreateUser(['administer sharethis', 'administer nodes']);
     $this->drupalLogin($this->adminUser);
 }
开发者ID:nB-MDSO,项目名称:mdso-d8blog,代码行数:11,代码来源:SharethisConfigFormTest.php

示例13: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->webUser = $this->drupalCreateUser(array('edit own page content', 'create page content'));
     $this->adminUser = $this->drupalCreateUser(array('bypass node access', 'administer nodes'));
     $this->drupalPlaceBlock('local_tasks_block');
     $this->nodeStorage = $this->container->get('entity.manager')->getStorage('node');
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:8,代码来源:NodeEditFormTest.php

示例14: setUp

 protected function setUp()
 {
     parent::setUp();
     // Use bypass node access permission here, because the test class uses
     // hook_grants_alter() to deny access to everyone on node_access
     // queries.
     $user = $this->drupalCreateUser(array('bypass node access', 'access content', 'create article content'));
     $this->drupalLogin($user);
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:9,代码来源:NodeRSSContentTest.php

示例15: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     node_access_rebuild();
     // Create some content.
     $this->drupalCreateNode();
     $this->drupalCreateNode();
     $this->drupalCreateNode();
     $this->drupalCreateNode();
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:13,代码来源:NodeAccessAutoBubblingTest.php


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