public static function prepareForHighlighting(self $a, self $b)
 {
     if ($a->getStart() < $b->getStart()) {
         return 1;
     } elseif ($a->getStart() > $b->getStart()) {
         return -1;
     } else {
         return 0;
     }
 }
 * (c) 2007 - 2008 Carl Vondrick <*****@*****.**>
 *
 * 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$
 */
require dirname(__FILE__) . '/../../../bootstrap/unit.php';
$t = new limeade_test(8, limeade_output::get());
$kw = new sfLuceneHighlighterKeywordNamed(new sfLuceneHighlighterMarkerDry(), 'foo');
try {
    $token = new sfLuceneHighlighterToken($kw, 'foo', 10, 15);
    $t->pass('__construct() accepts a valid text and positions');
} catch (Exception $e) {
    $t->fail('__construct() accepts a valid text and positions');
}
try {
    new sfLuceneHighlighterToken($kw, 'foo', 20, 10);
    $t->fail('__construct() rejects end positions that are less than the start position');
} catch (Exception $e) {
    $t->pass('__construct() rejects end positions that are less than the start position');
}
$t->is($token->getKeyword(), $kw, '->getKeyword() returns the keyword');
$t->is($token->getText(), 'foo', '->getText() returns the token text');
$t->is($token->getStart(), 10, '->getStart() returns the start position');
$t->is($token->getEnd(), 15, '->getEnd() returns the end position');
$t->is($token->getLength(), 5, '->getLength() returns the length');