function TaxonomyPrivateFileTestCase::setUp

Overrides DrupalWebTestCase::setUp

File

modules/taxonomy/taxonomy.test, line 2274

Class

TaxonomyPrivateFileTestCase
Tests appropriate access control to private file fields on a term.

Code

public function setUp() {
    parent::setUp('taxonomy_test');
    // Remove access content permission from registered users.
    user_role_revoke_permissions(DRUPAL_AUTHENTICATED_RID, array(
        'access content',
    ));
    $this->vocabulary = $this->createVocabulary();
    // Add a field instance to the vocabulary.
    $field = array(
        'field_name' => 'field_test',
        'type' => 'image',
        'settings' => array(
            'uri_scheme' => 'private',
        ),
    );
    field_create_field($field);
    $instance = array(
        'field_name' => 'field_test',
        'entity_type' => 'taxonomy_term',
        'label' => 'test',
        'bundle' => $this->vocabulary->machine_name,
        'widget' => array(
            'type' => 'image_image',
            'settings' => array(),
        ),
    );
    field_create_instance($instance);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.