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


PHP WebTestBase::setUp方法代码示例

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


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

示例1: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->adminUser = $this->drupalCreateUser(array('access content', 'access administration pages', 'administer site configuration', 'administer users', 'administer permissions', 'administer content types', 'administer node fields', 'administer node display', 'administer nodes', 'bypass node access'));
     $this->drupalLogin($this->adminUser);
     $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
 }
开发者ID:papillon-cendre,项目名称:d8,代码行数:7,代码来源:FileFieldTestBase.php

示例2: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     // Install Drupal.
     parent::setUp();
     // Add the system menu blocks to appropriate regions.
     $this->setupExamplesMenus();
 }
开发者ID:seongbae,项目名称:drumo-distribution,代码行数:10,代码来源:ExamplesTestBase.php

示例3: setUp

 function setUp()
 {
     parent::setUp();
     $this->drupalCreateContentType(array('type' => 'article'));
     $this->article_creator = $this->drupalCreateUser(array('create article content', 'edit own article content'));
     $this->drupalLogin($this->article_creator);
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:7,代码来源:reEnableModuleFieldTest.php

示例4: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Create and login user.
     $this->webUser = $this->drupalCreateUser(array('administer entity_test content'));
     $this->drupalLogin($this->webUser);
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:10,代码来源:EntityListBuilderTest.php

示例5: setUp

 function setUp()
 {
     parent::setUp();
     $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
     // Create and login user.
     $admin_user = $this->drupalCreateUser(array('administer site configuration', 'administer languages', 'access administration pages', 'administer content types', 'administer comments', 'create article content', 'access comments', 'post comments', 'skip comment approval'));
     $this->drupalLogin($admin_user);
     // Add language.
     $edit = array('predefined_langcode' => 'fr');
     $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
     // Set "Article" content type to use multilingual support.
     $edit = array('language_configuration[language_show]' => TRUE);
     $this->drupalPostForm('admin/structure/types/manage/article', $edit, t('Save content type'));
     // Enable content language negotiation UI.
     \Drupal::state()->set('language_test.content_language_type', TRUE);
     // Set interface language detection to user and content language detection
     // to URL. Disable inheritance from interface language to ensure content
     // language will fall back to the default language if no URL language can be
     // detected.
     $edit = array('language_interface[enabled][language-user]' => TRUE, 'language_content[enabled][language-url]' => TRUE, 'language_content[enabled][language-interface]' => FALSE);
     $this->drupalPostForm('admin/config/regional/language/detection', $edit, t('Save settings'));
     // Change user language preference, this way interface language is always
     // French no matter what path prefix the URLs have.
     $edit = array('preferred_langcode' => 'fr');
     $this->drupalPostForm("user/" . $admin_user->id() . "/edit", $edit, t('Save'));
     // Create comment field on article.
     $this->container->get('comment.manager')->addDefaultField('node', 'article');
     // Make comment body translatable.
     $field_storage = FieldStorageConfig::loadByName('comment', 'comment_body');
     $field_storage->translatable = TRUE;
     $field_storage->save();
     $this->assertTrue($field_storage->isTranslatable(), 'Comment body is translatable.');
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:33,代码来源:CommentLanguageTest.php

示例6: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->drupalPlaceBlock('local_tasks_block');
     $this->drupalPlaceBlock('local_actions_block');
     $this->drupalPlaceBlock('page_title_block');
 }
开发者ID:eric-shell,项目名称:eric-shell-d8,代码行数:10,代码来源:ParagraphsDemoTest.php

示例7: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Create and log in an administrative user.
     $this->adminUser = $this->drupalCreateUser(['access toolbar', 'access administration pages']);
     $this->drupalLogin($this->adminUser);
 }
开发者ID:eric-shell,项目名称:eric-shell-d8,代码行数:10,代码来源:AdminToolbarToolsAlterTest.php

示例8: setUp

 protected function setUp()
 {
     parent::setUp();
     // Create admin user and log in admin user.
     $this->drupalLogin($this->drupalCreateUser(array('administer site configuration', 'administer content types', 'administer nodes', 'administer node fields', 'administer node form display', 'administer node display')));
     $this->drupalPlaceBlock('local_actions_block');
 }
开发者ID:318io,项目名称:318-io,代码行数:7,代码来源:DateTimeTest.php

示例9: setUp

 function setUp()
 {
     parent::setUp();
     // Create an administrative user and log it in.
     $this->admin_user = $this->drupalCreateUser(array('access toolbar'));
     $this->drupalLogin($this->admin_user);
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:7,代码来源:ToolbarHookToolbarTest.php

示例10: setUp

  function setUp() {
    parent::setUp();

    $this->type = entity_create('profile_type', [
      'id' => 'personal',
      'label' => 'Personal data',
      'weight' => 0,
      'registration' => TRUE,
    ]);
    $this->type->save();

    $this->checkPermissions([], TRUE);
    $this->admin_user = $this->drupalCreateUser([
      'access user profiles',
      'administer profile types',
      'administer profile fields',
      'administer profile display',
      'bypass profile access',
    ]);
    $user_permissions = [
      'access user profiles',
      'add own personal profile',
      'edit own personal profile',
      'view any personal profile',
    ];
    $this->web_user = $this->drupalCreateUser($user_permissions);
    $this->other_user = $this->drupalCreateUser($user_permissions);
  }
开发者ID:housineali,项目名称:drpl8_dv,代码行数:28,代码来源:ProfileFieldAccessTest.php

示例11: setUp

 function setUp()
 {
     parent::setUp();
     // Create users with specific permissions.
     $this->big_user = $this->drupalCreateUser(array('administer site configuration', 'access administration pages', 'access site reports', 'administer users'));
     $this->any_user = $this->drupalCreateUser(array());
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:7,代码来源:DbLogTest.php

示例12: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Create a test entity.
     $random_label = $this->randomMachineName();
     $data = array('type' => 'entity_test', 'name' => $random_label);
     $this->entity = entity_create('entity_test', $data);
     $this->entity->save();
     // Create a test entity with only canonical route.
     $random_label = $this->randomMachineName();
     $data = array('type' => 'devel_entity_test_canonical', 'name' => $random_label);
     $this->entity_canonical = entity_create('devel_entity_test_canonical', $data);
     $this->entity_canonical->save();
     // Create a test entity with only edit route.
     $random_label = $this->randomMachineName();
     $data = array('type' => 'devel_entity_test_edit', 'name' => $random_label);
     $this->entity_edit = entity_create('devel_entity_test_edit', $data);
     $this->entity_edit->save();
     // Create a test entity with no routes.
     $random_label = $this->randomMachineName();
     $data = array('type' => 'devel_entity_test_no_links', 'name' => $random_label);
     $this->entity_no_links = entity_create('devel_entity_test_no_links', $data);
     $this->entity_no_links->save();
     $this->drupalPlaceBlock('local_tasks_block');
     $web_user = $this->drupalCreateUser(array('view test entity', 'administer entity_test content', 'access devel information'));
     $this->drupalLogin($web_user);
 }
开发者ID:atif-shaikh,项目名称:DCX-Profile,代码行数:30,代码来源:DevelControllerTest.php

示例13: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $permissions = ['access administration pages', 'administer piwik'];
     // User to set up piwik.
     $this->admin_user = $this->drupalCreateUser($permissions);
 }
开发者ID:rsmccc,项目名称:drupal-bootstrap,代码行数:10,代码来源:PiwikStatusMessagesTest.php

示例14: setUp

 protected function setUp()
 {
     parent::setUp();
     // Create an administrative user and log it in.
     $this->adminUser = $this->drupalCreateUser(array('access toolbar', 'translate interface', 'administer languages', 'access administration pages'));
     $this->drupalLogin($this->adminUser);
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:7,代码来源:ToolbarMenuTranslationTest.php

示例15: setUp

 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     /** @var \Drupal\currency\ConfigImporterInterface $config_importer */
     $config_importer = \Drupal::service('currency.config_importer');
     $config_importer->importCurrency('EUR');
 }
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:10,代码来源:PaymentReferenceWebTest.php


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