You are here

public function TestSubContext::configurePrivateFiles in Drupal Commons 7.3

Configure a private files path if one isn't already configured.

@BeforeScenario @api&&@drupal_private_files

File

tests/steps/commons_test.behat.inc, line 99
Provide Behat step-definitions for generic Commons tests.

Class

TestSubContext

Code

public function configurePrivateFiles($event) {
  $file_private_path = variable_get('file_private_path', '');
  if (empty($file_private_path)) {
    $file_public_path = variable_get('file_public_path', conf_path() . '/files');
    if (empty($file_public_path)) {
      throw new \Exception('Files must be configured for @drupal_private_files tests to work!');
    }

    // Set flag for later cleanup.
    $this->private_path_overridden = TRUE;

    // Create and setup the private path.
    $file_private_path = $file_public_path . '/' . 'private';
    variable_set('file_private_path', $file_private_path);
  }
}