Example #1
0
 protected function setUp()
 {
     parent::setUp();
     $this->adminUser = $this->drupalCreateUser(array('access files overview', 'bypass node access'));
     $this->baseUser = $this->drupalCreateUser();
     $this->createFileField('file', 'node', 'article', array(), array('file_extensions' => 'txt png'));
 }
 protected function setUp()
 {
     parent::setUp();
     node_access_test_add_field(entity_load('node_type', 'article'));
     node_access_rebuild();
     \Drupal::state()->set('node_access_test.private', TRUE);
 }
  /**
   * Sets up a Drupal site for running functional and integration tests.
   */
  protected function setUp() {
    parent::setUp();

    // Create a content type.
    $content_type = $this->drupalCreateContentType();
    $this->contentType = $content_type->get('name');
  }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Create the "Basic page" node type.
     // @todo Remove the disabling of new revision creation in
     //   https://www.drupal.org/node/1239558.
     $this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page', 'new_revision' => FALSE]);
     // Create a file field on the "Basic page" node type.
     $this->fieldName = strtolower($this->randomMachineName());
     $this->createFileField($this->fieldName, 'node', 'page');
     // Create and log in user.
     $permissions = array('access administration pages', 'administer content translation', 'administer content types', 'administer languages', 'create content translations', 'create page content', 'edit any page content', 'translate any entity', 'delete any page content');
     $admin_user = $this->drupalCreateUser($permissions);
     $this->drupalLogin($admin_user);
     // Add a second and third language.
     $edit = array();
     $edit['predefined_langcode'] = 'fr';
     $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
     $edit = array();
     $edit['predefined_langcode'] = 'nl';
     $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
     // Enable translation for "Basic page" nodes.
     $edit = array('entity_types[node]' => 1, 'settings[node][page][translatable]' => 1, "settings[node][page][fields][{$this->fieldName}]" => 1);
     $this->drupalPostForm('admin/config/regional/content-language', $edit, t('Save configuration'));
     \Drupal::entityManager()->clearCachedDefinitions();
 }
 protected function setUp()
 {
     parent::setUp();
     $this->fieldName = strtolower($this->randomMachineName());
     $type_name = 'article';
     $this->createFileField($this->fieldName, 'node', $type_name);
     // Set the teaser display to show this field.
     entity_get_display('node', 'article', 'teaser')->setComponent($this->fieldName, array('type' => 'file_default'))->save();
     // Set the RDF mapping for the new field.
     $mapping = rdf_get_mapping('node', 'article');
     $mapping->setFieldMapping($this->fieldName, array('properties' => array('rdfs:seeAlso'), 'mapping_type' => 'rel'))->save();
     $test_file = $this->getTestFile('text');
     // Create a new node with the uploaded file.
     $nid = $this->uploadNodeFile($test_file, $this->fieldName, $type_name);
     $this->node = node_load($nid, TRUE);
     $this->file = file_load($this->node->{$this->fieldName}->target_id);
 }
Example #6
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->drupalPlaceBlock('system_breadcrumb_block');
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Set up permissions for anonymous attacker user.
     user_role_change_permissions(RoleInterface::ANONYMOUS_ID, array('create article content' => TRUE, 'access content' => TRUE));
 }