コード例 #1
0
 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'));
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     // Install Drupal.
     parent::setUp();
     // Add the system menu blocks to appropriate regions.
     $this->setupExamplesMenus();
 }
コード例 #3
0
 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);
 }
コード例 #4
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Create and login user.
     $this->webUser = $this->drupalCreateUser(array('administer entity_test content'));
     $this->drupalLogin($this->webUser);
 }
コード例 #5
0
 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.');
 }
コード例 #6
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->drupalPlaceBlock('local_tasks_block');
     $this->drupalPlaceBlock('local_actions_block');
     $this->drupalPlaceBlock('page_title_block');
 }
コード例 #7
0
 /**
  * {@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);
 }
コード例 #8
0
ファイル: DateTimeTest.php プロジェクト: 318io/318-io
 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');
 }
コード例 #9
0
 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);
 }
コード例 #10
0
  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);
  }
コード例 #11
0
ファイル: DbLogTest.php プロジェクト: anatalsceo/en-classe
 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());
 }
コード例 #12
0
 /**
  * {@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);
 }
コード例 #13
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $permissions = ['access administration pages', 'administer piwik'];
     // User to set up piwik.
     $this->admin_user = $this->drupalCreateUser($permissions);
 }
コード例 #14
0
 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);
 }
コード例 #15
0
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     /** @var \Drupal\currency\ConfigImporterInterface $config_importer */
     $config_importer = \Drupal::service('currency.config_importer');
     $config_importer->importCurrency('EUR');
 }
コード例 #16
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Create a new administrator user for the test.
     $admin = $this->drupalCreateUser(array('administer site configuration'));
     $this->drupalLogin($admin);
 }
コード例 #17
0
 protected function setUp()
 {
     parent::setUp();
     $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
     $this->webUser = $this->drupalCreateUser(array('access content'));
     $this->drupalLogin($this->webUser);
 }
コード例 #18
0
 protected function setUp()
 {
     parent::setUp();
     $this->drupalPlaceBlock('page_title_block');
     $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
     // Create a user who can administer text formats, but does not have
     // specific permission to use any of them.
     $this->filterAdminUser = $this->drupalCreateUser(array('administer filters', 'create page content', 'edit any page content'));
     // Create three text formats. Two text formats are created for all users so
     // that the drop-down list appears for all tests.
     $this->drupalLogin($this->filterAdminUser);
     $formats = array();
     for ($i = 0; $i < 3; $i++) {
         $edit = array('format' => Unicode::strtolower($this->randomMachineName()), 'name' => $this->randomMachineName());
         $this->drupalPostForm('admin/config/content/formats/add', $edit, t('Save configuration'));
         $this->resetFilterCaches();
         $formats[] = FilterFormat::load($edit['format']);
     }
     list($this->allowedFormat, $this->secondAllowedFormat, $this->disallowedFormat) = $formats;
     $this->drupalLogout();
     // Create a regular user with access to two of the formats.
     $this->webUser = $this->drupalCreateUser(array('create page content', 'edit any page content', $this->allowedFormat->getPermissionName(), $this->secondAllowedFormat->getPermissionName()));
     // Create an administrative user who has access to use all three formats.
     $this->adminUser = $this->drupalCreateUser(array('administer filters', 'create page content', 'edit any page content', $this->allowedFormat->getPermissionName(), $this->secondAllowedFormat->getPermissionName(), $this->disallowedFormat->getPermissionName()));
     $this->drupalPlaceBlock('local_tasks_block');
 }
コード例 #19
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Create a test user.
     $web_user = $this->drupalCreateUser(array('administer entity_test content', 'administer entity_test fields', 'view test entity'));
     $this->drupalLogin($web_user);
 }
コード例 #20
0
 protected function setUp()
 {
     parent::setUp();
     $this->updateUrl = Url::fromRoute('system.db_update');
     $this->updateUser = $this->drupalCreateUser(array('administer software updates', 'access site in maintenance mode'));
     \Drupal::service('entity.definition_update_manager')->applyUpdates();
 }
コード例 #21
0
ファイル: NameTestBase.php プロジェクト: darrylri/protovbmwmo
 function setUp()
 {
     parent::setUp();
     // Base set up is done, we can call drupalCreateUser.
     $this->web_user = $this->drupalCreateUser(array());
     $this->admin_user = $this->drupalCreateUser(array('administer site configuration', 'administer content types', 'access content', 'access administration pages', 'administer node fields'));
 }
コード例 #22
0
 /**
  * Implement setUp().
  */
 protected function setUp()
 {
     parent::setUp();
     $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
     $this->content_user = $this->drupalCreateUser(array('create page content', 'access content', 'administer themes', 'administer site configuration'));
     $this->drupalLogin($this->content_user);
 }
コード例 #23
0
 protected function setUp()
 {
     parent::setUp();
     $this->adminUser = $this->drupalCreateUser(array('access vertical_tab_test tabs'));
     $this->webUser = $this->drupalCreateUser();
     $this->drupalLogin($this->adminUser);
 }
コード例 #24
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Create and login administrative user.
     $admin_user = $this->drupalCreateUser(array('access site-wide contact form', 'administer languages'));
     $this->drupalLogin($admin_user);
 }
コード例 #25
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->drupalPlaceBlock('system_breadcrumb_block');
     $this->drupalPlaceBlock('local_actions_block');
     $this->drupalPlaceBlock('page_title_block');
 }
コード例 #26
0
 function setUp()
 {
     parent::setUp();
     // Set up two users with different permissions to test access.
     $this->unprivileged_user = $this->drupalCreateUser();
     $this->privileged_user = $this->drupalCreateUser(array('access user profiles'));
 }
コード例 #27
0
ファイル: TwitterBlockTest.php プロジェクト: pulibrary/recap
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Create and login user.
     $admin_user = $this->drupalCreateUser(array('administer blocks', 'administer site configuration', 'access administration pages'));
     $this->drupalLogin($admin_user);
 }
コード例 #28
0
 function setUp()
 {
     parent::setUp();
     // Create an administrator user.
     $this->admin_user = $this->drupalCreateUser(array('administer software updates'));
     $this->drupalLogin($this->admin_user);
 }
コード例 #29
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $permissions = ['access administration pages', 'administer google analytics'];
     // User to set up google_analytics.
     $this->admin_user = $this->drupalCreateUser($permissions);
 }
コード例 #30
0
 /**
  * Overrides \Drupal\simpletest\WebTestBase::installParameters().
  */
 protected function installParameters()
 {
     $this->siteName = $this->randomMachineName();
     $parameters = parent::installParameters();
     $parameters['forms']['install_configure_form']['site_name'] = $this->siteName;
     return $parameters;
 }