You are here

function UploadPictureTests::testDirectories in SimpleTest 6

Same name and namespace in other branches
  1. 5 tests/upload_tests.test \UploadPictureTests::testDirectories()

File

tests/upload_tests.test, line 12

Class

UploadPictureTests

Code

function testDirectories() {

  // test if filepath is proper
  $file_dir = file_directory_path();
  $picture_dir = variable_get('user_picture_path', 'pictures');
  $file_check = file_check_directory($file_dir, FILE_CREATE_DIRECTORY, 'file_directory_path');
  $picture_path = $file_dir . '/' . $picture_dir;
  $pic_check = file_check_directory($picture_path, FILE_CREATE_DIRECTORY, 'user_picture_path');

  // check directories

  //$this->assertTrue($file_check,"The directory $file_dir doesn't exist or cannot be created.");

  //$this->assertTrue($pic_check,"The directory $picture_path doesn't exist or cannot be created.");
  $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.");
}