コード例 #1
0
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
/**
 * @package sfLucenePlugin
 * @subpackage Test
 * @author Carl Vondrick
 * @version SVN: $Id: sfLuceneStorageBlackholeTest.php 7108 2008-01-20 07:44:42Z Carl.Vondrick $
 */
require dirname(__FILE__) . '/../../bootstrap/unit.php';
$t = new limeade_test(6, limeade_output::get());
$limeade = new limeade_sf($t);
$app = $limeade->bootstrap();
try {
    $bh = new sfLuceneStorageBlackhole('foo');
    $t->pass('__construct() accepts a string');
} catch (Exception $e) {
    $t->fail('__construct() accepts a string');
    $t->skip('the previous test must pass to continue');
    die;
}
$t->ok($bh instanceof sfLuceneStorage, 'sfLuceneStorageBlackhole 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()');
コード例 #2
0
 * file that was distributed with this source code.
 */
/**
 * @package sfLucenePlugin
 * @subpackage Test
 * @author Carl Vondrick
 * @version SVN: $Id: sfLuceneCategoriesTest.php 7108 2008-01-20 07:44:42Z Carl.Vondrick $
 */
require dirname(__FILE__) . '/../../bootstrap/unit.php';
$t = new limeade_test(20, limeade_output::get());
$limeade = new limeade_sf($t);
$app = $limeade->bootstrap();
$luceneade = new limeade_lucene($limeade);
$luceneade->configure()->clear_sandbox();
$lucene = sfLucene::getInstance('testLucene', 'en');
$writer = new sfLuceneStorageBlackhole('foo');
$t->diag('testing constructor and initialization');
try {
    new sfLuceneCategories('foo');
    $t->fail('__construct() must reject invalid search instances');
} catch (Exception $e) {
    $t->pass('__construct() must reject invalid search instances');
}
try {
    new sfLuceneCategories($lucene);
    $t->pass('__construct() must accept an instance of sfLucene');
} catch (Exception $e) {
    $t->fail('__construct() must accept an instance of sfLucene');
    $e->printStackTrace();
}
try {