$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.'); } $t->is($new_file->delete(), true, 'The touch()ed file deleted by delete()'); $t->is($f->clearCache(), true, 'Cache was succesfully cleared, cacheClear() returns true.'); $t->is($dir->delete(true), true, 'Folder successfully deleted throughout delete()');