$t->is($copy->fileExists(), true, 'fileExists() returns true'); $t->diag('Let\'s create a thumbnail...'); $t->isa_ok($tn = $copy->getThumbnail(array('width' => 20)), 'sfFilebasePluginThumbnail', 'Thumbnail created as instanceof sfFilebasePluginThumbnail'); $t->diag('This is nonsense: Open thumbnail and print its content to stdout:'); $t->diag($tn->openFile()->fileGetContents() . ".."); $t->is($tn->fileExists(), true, 'sfFilebasePluginThumbnail::fileExists() returns true.'); $t->isa_ok($copy = $copy->rename('renamed_image.jpg'), 'sfFilebasePluginImage', 'Performing a rename(), returns instanceof sfFilebasePluginImage.'); $t->is($copy->fileExists(), true, 'fileExists() returns true, so renamed image exists in file system.'); $t->diag('Lets resize the original image'); $t->isa_ok($copy->resize(array('1000')), 'sfFilebasePluginImage', 'Resize ok, resize() returns instance of sfFilebasePluginImage'); $t->is($copy->getWidth(), 1000, 'Image now has 1000 pixels width.'); $t->is($copy->getMimeType(), 'image/jpeg', 'getMimeType() says: Image has mime-type image/jpeg'); $t->is($copy->getHumanReadableFileType(), 'jpeg image', 'getHumanReadableFileType() says "jpeg image"'); ### Writing stuff into a new file $t->diag('I want to write some line into my new file...'); $t->isa_ok($new_file = $f->touch('new_file.txt', 0777), 'sfFilebasePluginFile', 'touch() returns a new instanceof sfFilebasePluginFile'); $t->isa_ok($fp = $new_file->openFile('a+'), 'sfFilebasePluginFileObject', 'touch()ed file was opened. Return value is a pointer of type sfFilebasePluginFileObject.'); $t->isa_ok($fp->fwrite("This line is written by tester.\n"), 'integer', 'Successfully written by fwrite()'); $t->isa_ok($fp->fwrite("This second line is written by tester.\n"), 'integer', 'Successfully written by fwrite()'); $t->isa_ok($fp->writeLn("This third line is written by tester."), 'integer', 'Successfully written by writeln()'); $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();