/**
  * Tests whether tokenized text is handled correctly.
  */
 public function testProcessFieldsTokenized()
 {
     $override = function (&$value, &$type) {
         if ($type != 'tokenized_text') {
             $value = TestFieldsProcessorPlugin::createTokenizedText($value, NULL);
             $type = 'tokenized_text';
         } elseif ($value == 'bar') {
             $value = array(array('value' => '*bar'));
         } elseif ($value != 'baz') {
             $value = "*{$value}";
         } else {
             $value = '';
         }
     };
     $this->processor->setMethodOverride('processFieldValue', $override);
     $fields = array('field1' => array('type' => 'tokenized_text', 'values' => array(TestFieldsProcessorPlugin::createTokenizedText('foo bar baz', 3), TestFieldsProcessorPlugin::createTokenizedText('foobar'))), 'field2' => array('type' => 'text', 'values' => array('foo bar baz', 'foobar')));
     $items = $this->createItems($this->index, 1, $fields);
     $this->processor->preprocessIndexItems($items);
     $item_fields = $items[$this->itemIds[0]]->getFields();
     $expected = array(TestFieldsProcessorPlugin::createTokenizedText('*foo *bar', 3), TestFieldsProcessorPlugin::createTokenizedText('*foobar'));
     $this->assertEquals($expected, $item_fields['field1']->getValues(), 'tokenized_text field correctly processed.');
     $expected = array(TestFieldsProcessorPlugin::createTokenizedText('foo bar baz'), TestFieldsProcessorPlugin::createTokenizedText('foobar'));
     $this->assertEquals($expected, $item_fields['field2']->getValues(), 'text field correctly processed and tokenized.');
 }