/** * Gets the service * * @returns string */ public function getServiceName() { return $this->document->getField('_service')->getValue(); }
*/ require dirname(__FILE__) . '/../../bootstrap/unit.php'; require 'util/xfException.class.php'; require 'document/xfDocument.class.php'; require 'document/xfFieldValue.class.php'; require 'document/xfField.class.php'; require 'document/xfDocumentException.class.php'; $t = new lime_test(15, new lime_output_color()); $t->diag('->__construct()'); $doc = new xfDocument('guid'); $t->is($doc->getGuid(), 'guid', '->getGuid() returns the document GUID'); $t->is($doc->getFields(), array(), '->getFields() returns an empty array initially'); $t->diag('->addField()'); $value = new xfFieldValue(new xfField('field1', xfField::KEYWORD), 'value'); $doc->addField($value); $t->is($doc->getField('field1'), $value, '->getField() returns the registered field'); $t->is($doc->getFields(), array('field1' => $value), '->getFields() returns all the fields'); try { $msg = '->getField() fails if field name does not exist'; $doc->getField('foobar'); $t->fail($msg); } catch (Exception $e) { $t->pass($msg); } $t->diag('->hasField()'); $t->ok($doc->hasField('field1'), '->hasField() returns true if the field exists'); $t->ok(!$doc->hasField('field99'), '->hasField() returns false if the field does not exist'); $t->diag('->setBoost(), ->getBoost()'); $doc = new xfDocument('guid'); $t->is($doc->getBoost(), 1.0, '->getBoost() is 1.0 initially'); $doc->setBoost(M_PI);