PHP Class PhpBrew\Testing\TemporaryFileFixture

Datei anzeigen Open project: phpbrew/phpbrew Class Usage Examples

Public Methods

Method Description
__construct ( object $caller, string $sourcePath ) $caller must be a subclass of PHPUnit_Framework_TestCase.
getTemporaryDirectory ( ) Returns the path of the temporary directory.
setTemporaryDirectory ( $dir ) Sets the temprary directory where this object puts temprary files into.
withFile ( string $destFileName, callable $callback ) Calls the callback function after creating a temporary file, which is a copy of the source file. The copy is automatically removed, so you don't have to delete it.

Method Details

__construct() public method

$caller must be a subclass of PHPUnit_Framework_TestCase.
public __construct ( object $caller, string $sourcePath )
$caller object the object which creates this object.
$sourcePath string the path of a source file.

getTemporaryDirectory() public method

Returns the path of the temporary directory.

setTemporaryDirectory() public method

Sets the temprary directory where this object puts temprary files into.
public setTemporaryDirectory ( $dir )

withFile() public method

The 1st argument of the callback function is an object which creates this object. The 2nd argument of the callback function is a destination file path.
public withFile ( string $destFileName, callable $callback )
$destFileName string the filename of a copy of the source file.
$callback callable the function called after creating a destination file.