$t->pass($msg);
    } catch (Exception $e) {
        $t->fail($constructorMsg);
        $t->skip($msg);
    }
}
foreach ($invalidTypes as $type) {
    $msg = '->__construct() rejects the invalid type ' . $type;
    try {
        $field = new xfField('foobar', $type);
        $t->fail($msg);
    } catch (Exception $e) {
        $t->pass($msg);
    }
}
$t->diag('->getName(), ->getType()');
$field = new xfField('foobar', xfField::KEYWORD);
$t->is($field->getName(), 'foobar', '->getName() returns the name');
$t->is($field->getType(), xfField::KEYWORD, '->getType() returns the type');
$t->diag('->registerCallback(), ->getCallbacks(), ->transformValue()');
$field = new xfField('foobar', xfField::KEYWORD);
$field->registerCallback('strtoupper');
$field->registerCallback('md5');
$t->is($field->transformValue('foobar'), md5(strtoupper('foobar')), '->transformValue() calls callbacks in registered order');
$t->diag('->setBoost(), ->getBoost()');
$field = new xfField('foobar', xfField::KEYWORD);
$t->is($field->getBoost(), 1.0, '->getBoost() is 1.0 initially');
$field->setBoost(M_PI);
$t->is($field->getBoost(), M_PI, '->setBoost() changes the boost');
$field->setBoost('42foobar');
$t->is($field->getBoost(), 42, '->setBoost() casts the input to a float');
<?php

/**
 * This file is part of the sfSearch package.
 * (c) Carl Vondrick <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require dirname(__FILE__) . '/../../bootstrap/unit.php';
require 'document/xfFieldValue.class.php';
require 'document/xfField.class.php';
$t = new lime_test(3, new lime_output_color());
$field = new xfField('name', xfField::KEYWORD);
$field->registerCallback('md5');
$value = new xfFieldValue($field, 'value', 'utf8');
$t->is($value->getField(), $field, '->getField() returns the field');
$t->is($value->getValue(), md5('value'), '->getValue() returns the transformed value');
$t->is($value->getEncoding(), 'utf8', '->getEncoding() returns the encoding');