$t = new limeade_test(12, limeade_output::get());
$limeade = new limeade_sf($t);
$app = $limeade->bootstrap();
$luceneade = new limeade_lucene($limeade);
$luceneade->configure()->clear_sandbox();
$file = $luceneade->sandbox_dir . '/storage/long/folder/tree';
$t->ok(!file_exists($file), 'target file does not exist initially');
try {
    $bh = new sfLuceneStorageFilesystem($file);
    $t->pass('__construct() accepts a file');
} catch (Exception $e) {
    $t->fail('__construct() accepts a file');
    $t->skip('the previous test must pass to continue');
    die;
}
$t->instanceof_ok($bh, 'sfLuceneStorage', 'sfLuceneStorageFilesystem implements sfLuceneStorage interface');
$t->is($bh->read(), null, '->read() is null initially');
try {
    $bh->write('foobar');
    $t->pass('->write() can write data');
    $t->is($bh->read(), 'foobar', '->read() reads the data written by ->write()');
} catch (Exception $e) {
    $t->fail('->write() can write data');
    $t->skip('->read() reads the data written by ->write()');
}
$t->ok(file_exists($file), '->write() creates the file');
$t->is(file_get_contents($file), 'foobar', '->write() writes the data to the file');
try {
    $ex = $t->no_exception('__construct() functions if the directory tree already exists');
    $bh2 = new sfLuceneStorageFileSystem($luceneade->sandbox_dir . '/storage/long/folder/flower');
    $ex->no();