havramar/phpunit-tmp-dir

Wrapper around VFS for easier creation temporary directory


Keywords
filesystem, phpunit, helper
License
MIT

Documentation

phpunit-tmp-dir

Wrapper around vfsStream for easier creation temporary directories in PhpUnit tests.

Build Status SensioLabsInsight

Why

Needed extremely simple way of creating temporary folder, whose content is deleted when tests are finished.

How to run

  1. Get composer.
  2. composer require havramar/phpunit-tmp-dir:dev-master
  3. Create example file:

    <?php
    
    require_once 'vendor/autoload.php';
    
    $path = \PhpunitTempDir\Helper::createTempDir();
    
    // do whatever you want inside $path (mkdir, touch etc),
    // when script exits, everything is gone as all is happening in memory