Prepares test folders in the temporary directory.

@BeforeScenario
431565
public function prepareProcess()
    {
        $phpFinder = new PhpExecutableFinder();
        if (false === $php = $phpFinder->find()) {
            throw new \RuntimeException('Unable to find the PHP executable.');
        }
        $this->phpBin = $php;
        $this->process = new Process(null);
    }
1337578
private function prepareRestart()
    {
        $error = '';
        $iniFiles = self::getAllIniFiles();
        $scannedInis = count($iniFiles) > 1;
        $tmpDir = sys_get_temp_dir();

        if (!$this->cli) {
            $error = 'Unsupported SAPI: '.PHP_SAPI;
        } elseif (!defined('PHP_BINARY')) {
            $error = 'PHP version is too old: '.PHP_VERSION;
        } elseif (!$this->checkConfiguration($info)) {
            $error = $info;
        } elseif (!$this->checkScanDirConfig()) {
            $error = 'PHP version does not report scanned inis: '.PHP_VERSION;
        } elseif (!$this->checkMainScript()) {
            $error = 'Unable to access main script: '.$this->script;
        } elseif (!$this->writeTmpIni($iniFiles, $tmpDir, $error)) {
            $error = $error ?: 'Unable to create temp ini file at: '.$tmpDir;
        } elseif (!$this->setEnvironment($scannedInis, $iniFiles)) {
            $error = 'Unable to set environment variables';
        }

        if ($error) {
            $this->notify(Status::ERROR, $error);
        }

        return empty($error);
    }
664820
public function prepareScreenShots()
    {
        $screenShotsPath = $this->getTestConfig()->getScreenShotsPath();
        if ($screenShotsPath && !is_dir($screenShotsPath)) {
            mkdir($screenShotsPath, 0777, true);
        }
    }
94866
def prep_folder(self, seq):
        """"""
        itasser_dir = op.join(self.root_dir, self.id)

        if not op.exists(itasser_dir):
            os.makedirs(itasser_dir)

        tmp = {self.id: seq}

        fasta.write_fasta_file_from_dict(indict=tmp,
                                         outname='seq',
                                         outext='.fasta',
                                         outdir=itasser_dir)
        return itasser_dir
752852
private function initDirectoryStructure()
  {
    if (!file_exists(TL_ROOT . '/' . $this->getDmsBaseDirectory()))
    {
      mkdir(TL_ROOT . '/' . $this->getDmsBaseDirectory(), 0775, true);
      $objDir = \Dbafs::addResource($this->getDmsBaseDirectory());
      
      $objFolder = new \Folder($this->getDmsBaseDirectory());
			$objFolder->unprotect(); 
      
      mkdir(TL_ROOT . '/' . $this->getDmsBaseDirectory() . "/temp", 0775, true);
      $objDir = \Dbafs::addResource($this->getDmsBaseDirectory() . "/temp");
    }
  }
692850
private function set_cache_dir() {
		$path = sys_get_temp_dir() . '/wp-cli-test-cache';
		if ( ! file_exists( $path ) ) {
			mkdir( $path );
		}
		$this->variables['CACHE_DIR'] = $path;
	}
1100179
private function prepareDirectories()
	{
		if ($this->hasAdmin)
		{
			$this->_mkdir($this->getBuildFolder() . "/administrator/components/com_" . $this->getExtensionName());
		}

		if ($this->hasFront)
		{
			$this->_mkdir($this->getBuildFolder() . "/components/com_" . $this->getExtensionName());
		}
	}
1007527
public function _before(TestInterface $test)
    {
        /** @var WPDb $wpdb */
        $wpdb          = $this->getModule('WPDb');
        $this->siteUrl = $wpdb->grabSiteUrl();
        $this->loginUrl = '/wp-login.php';
        $this->setupClient($wpdb->getSiteDomain());
    }
838034
public function main(string $pathToTestsDirectory): array
    {
        if (!is_dir($pathToTestsDirectory)) {
            throw new \InvalidArgumentException(
                '$pathToTestsDirectory "' . $pathToTestsDirectory . '" does not exist"'
            );
        }
        $this->largePath  = $pathToTestsDirectory . '/Large';
        $this->mediumPath = $pathToTestsDirectory . '/Medium';
        $this->smallPath  = $pathToTestsDirectory . '/Small';
        $this->checkLarge();
        $this->checkMedium();
        $this->checkSmall();

        return $this->errors;
    }
426562
public function prepare()
    {
        $this->taskFileSystemStack()
             ->mkdir($this->getDistDir())
             ->mkdir($this->getTargetDir())
             ->mkdir($this->getReportsDir())
             ->run();
    }
385388
protected function setup()
    {
        if (!$this->dir) {
            // Greate a temporary directory.
            $tempfile = tempnam(sys_get_temp_dir(), '');
            mkdir($tempfile.'.git');
            if (file_exists($tempfile)) {
                unlink($tempfile);
            }
            $this->dir = $tempfile.'.git';
            $this->git = $this->wrapper->init($this->dir);
        }
        if ($this->git) {
            $this->git->config('user.name', 'GitMerge');
            $this->git->config('user.email', 'gitmerge@php-merge.example.com');
            $this->git->config('merge.conflictStyle', 'diff3');
        }
    }
205514
public function prepare()
    {

        $options = $this->options->prepareOptions;

        if( $options & Options::BACKUP or true ) {

            $root = $this->options->pathRoot;
            $pathsToBackup = $this->options->getPathsToBackup();

            // make a fully qualified path relative to $root
            $anchorToRoot = function( $path ) use ($root) {
                return escapeshellarg( "." . substr( $path, strlen($root) ) );
            };

            $pathsToBackup = array_map( $anchorToRoot, $pathsToBackup );
            $pathsToBackup = implode( ' ', $pathsToBackup );

            $backupDir = $this->options->getPath('backup');
            $filename = "{$backupDir}/" . self::fileSystemFriendly(
                date( DateTime::POSTGRES_TIMESTAMP_WITHOUT_TIME_ZONE_NO_MICROSECONDS )
            ) . '.tar.gz';

            $command = sprintf(
                'cd %s; tar cszf %s --exclude=%s -C %s %s; cd -',
                escapeshellarg( $root ),
                escapeshellarg( $filename ),
                $anchorToRoot( $backupDir ),
                escapeshellarg( $root ),
                $pathsToBackup
            );

            exec( $command );

        }

        // trash _all_ previously generated entitys
        /* BROKEN - Too agressive. Doesn't consider $options['match']
        $rebuild = in_array( $option, array( self::REBUILD_AND_BACKUP, self::REBUILD_NO_BACKUP ) );
        if( $rebuild ) {
            foreach( new \DirectoryIterator( $this->paths['entity'] ) as $item ) {
                if( $item->isFile() ) {
                    // unlink( $item->getPathname() );
                }
            }
        }
         */

    }
196297
private function initializeTempDirectory()
    {
        $this->dir = __DIR__.'/.wallpaperNotifier';

        if (!file_exists($this->dir)) {
            try {
                mkdir($this->dir);
            } catch (Exception $e) {
                throw new \RuntimeException(sprintf(
                    "Wallpaper notifier requires a directory to hold its contents\n"
                    ."'%s' directory couldn't be created",
                    $this->dir
                ));
            }
        }

        // Hack: two different images are needed to reload the desktop background
        // One holds the current wallpaper, the other one is the new background
        // If you have just one image and modify it, the OS doesn't reload it
        $this->evenBackgroundImagePath = realpath($this->dir).'/even-background.png';
        $this->oddBackgroundImagePath  = realpath($this->dir).'/odd-background.png';
    }
770786
public function insertDemoData()
    {
        $testConfig = new TestConfig();
        $testDirectory = $testConfig->getEditionTestsPath($testConfig->getShopEdition());
        $this->getDbHandler()->import($testDirectory . "/Fixtures/testdemodata.sql");
    }
411005
public function _before(TestInterface $test)
    {
        $this->createTmpProjectDir();
        $this->copyProjectRootToTmpProjectDir();

        $this->amInTmpProjectDir();

        $this->configComposerRepositoryPaths($this->_getConfig('repositoryPaths'));
        $this->runComposerInstall();
    }
948153
function(callback) {
        grunt.log.writeln('Prepare tmp path...');
        if (!grunt.file.isDir(tmpPath)) {
          if (grunt.file.exists(tmpPath)) {
            callback(new Error(util.format('"%s" is not a directory', tmpPath)));
          }
          else {
            grunt.file.mkdir(tmpPath);
            callback(null);
          }
        }
        else {
          callback(null);
        }
      }
916207
protected function createDirectories()
    {
        if (! is_dir($directory = $this->getViewPath('layouts'))) {
            mkdir($directory, 0755, true);
        }

        if (! is_dir($directory = $this->getViewPath('auth/passwords'))) {
            mkdir($directory, 0755, true);
        }
    }