Home » Testing » PHPUnit2 » Bug #7098
Simplified mocking of files and directories using Stream_Var
Details
| Request #7098 | Simplified mocking of files and directories using Stream_Var |
|---|---|
| Submitted | 2006-03-12 12:01 UTC |
| From | maxx dot gass at gmail dot com |
| Status | Suspended |
| Package | PHPUnit2 |
| PHP Version | Irrelevant |
| Roadmaps | (Not assigned) |
Comments
[2006-03-12 12:01 UTC] maxx dot gass at gmail dot com
Description:
------------
I recently ran over AcidTest (http://wiki.jonnay.net/bunny/acidtest) which supports mocking of files.
In PEAR there is already Stream_Var that allows using variables as files. It's not complicated but integrating it into PHPUnit2 would be nice.
Test script:
---------------
PHPUnit2_Extensions_FileMock::createDirectory('templates');
PHPUnit2_Extensions_FileMock::createFile('templates/simple.tpl', 'A simple test only');
$template = new Template('phpunit2mock://templates/simple.tpl');
$this->assertEquals($template->render(), 'A simple test only'));
PHPUnit2_Extensions_FileMock::deleteFile('templates/simple.tpl');
PHPUnit2_Extensions_FileMock::deleteDirectory('templates');
[2006-07-05 15:33 UTC] sebastian at php dot net
Moved to http://www.phpunit.de/ticket/4.