1. drupal
    1. 8
    2. 7
7 UserPictureTestCase::setUp()

Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix. A temporary files directory is created with the same name as the database prefix.


... List of modules to enable for the duration of the test. This can be either a single array or a variable number of string arguments.


modules/user/user.test, line 864

function 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.");