function UserPictureTestCase::setUp

Overrides DrupalWebTestCase::setUp

File

modules/user/user.test, line 1374

Class

UserPictureTestCase

Code

function setUp() {
    parent::setUp();
    // Enable user pictures.
    variable_set('user_pictures', 1);
    $this->user = $this->drupalCreateUser();
    // Test if directories specified in settings exist in filesystem.
    $file_dir = 'public://';
    $file_check = file_prepare_directory($file_dir, FILE_CREATE_DIRECTORY);
    // TODO: Test public and private methods?
    $picture_dir = variable_get('user_picture_path', 'pictures');
    $picture_path = $file_dir . $picture_dir;
    $pic_check = file_prepare_directory($picture_path, FILE_CREATE_DIRECTORY);
    $this->_directory_test = is_writable($picture_path);
    $this->assertTrue($this->_directory_test, "The directory {$picture_path} doesn't exist or is not writable. Further tests won't be made.");
}

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