$t->isa_ok($fp->write("This fourth line is written by tester."), 'integer', 'Successfully written by write()'); $t->isa_ok($fp->fileGetContents(), 'string', 'Read file successfully by fileGetContents(), value is ' . $fp->fileGetContents()); $t->isa_ok($fp->getRelativePathFromFilebaseDirectory(), 'string', 'Delegation test for getRelativePathFromFilebaseDirectory()'); $t->diag('Testing iteration over file contents'); $t->diag('Begin loop'); foreach ($fp as $i => $line) { $t->pass($i . '> ' . $line); } $t->diag('End loop'); $t->diag('Creating some files'); $new_fs = array(); for ($i = 0; $i < 10; $i++) { $t->isa_ok($new_f = $f->touch(uniqid()), 'sfFilebasePluginFile', 'touch() created File ' . $new_f); $new_fs[] = $new_f; } $t->isa_ok($iter = $f->getIterator(), 'sfFilebasePluginRecursiveDirectoryIterator', 'getIterator() returns valid sfFilebasePluginRecursiveDirectoryIterator'); $t->diag('Testing iteration...'); foreach ($f as $file) { $t->ok($file instanceof sfFilebasePluginFile, 'File' . $file . ' is instanceof sfFilebasePluginFile, espacially ' . get_class($file)); } $t->diag('Picking some file by ArrayAccess-Methods:'); $t->isa_ok($f[$new_fs[3]], 'sfFilebasePluginFile', 'File with index 3 is a sfFilebasePluginFile named ' . $f[$new_fs[3]]); $t->diag('Checking recursive movement'); $t->isa_ok($otherdir = $f->mkDir('otherdir'), 'sfFilebasePluginDirectory', 'Otherdir created'); $t->isa_ok($otherfile1 = $f->touch($otherdir . '/test.txt'), 'sfFilebasePluginFile', 'Touched file 1 in otherdir.'); $t->isa_ok($otherfile2 = $f->touch($otherdir . '/test2.txt'), 'sfFilebasePluginFile', 'Touched file 2 in otherdir.'); $t->isa_ok($otherdir = $otherdir->move($dir), 'sfFilebasePluginDirectory', 'Otherdirs contents successfully moved into dir'); $t->diag('Cleanup...'); foreach ($new_fs as $file) { $t->is($file->delete(), true, 'Test file ' . $file . ' successfully delete()ed.'); }