public function testSearchItemsText()
 {
     $context = clone $this->_context;
     $context->getConfig()->set('classes/catalog/manager/index/text/name', 'Default');
     $object = new MShop_Catalog_Manager_Index_Default($context);
     $textItems = self::$_products['CNC']->getRefItems('text', 'name');
     if (($textItem = reset($textItems)) === false) {
         throw new Exception('No text with type "name" available in product CNC');
     }
     $total = 0;
     $search = $this->_object->createSearch();
     $search->setSlice(0, 1);
     $conditions = array($search->compare('==', 'catalog.index.text.id', $textItem->getId()), $search->compare('==', 'product.editor', $this->_editor));
     $search->setConditions($search->combine('&&', $conditions));
     $result = $object->searchItems($search, array(), $total);
     $this->assertEquals(1, count($result));
     $this->assertEquals(1, $total);
     $expr = array($search->compare('!=', 'catalog.index.text.id', null), $search->compare('!=', 'catalog.index.catalog.id', null), $search->compare('==', 'product.editor', $this->_editor));
     $search->setConditions($search->combine('&&', $expr));
     $result = $object->searchItems($search, array(), $total);
     $this->assertEquals(1, count($result));
     $this->assertEquals(3, $total);
     $func = $search->createFunction('catalog.index.text.relevance', array('unittype13', 'de', 'Expr'));
     $conditions = array($search->compare('>', $func, 0), $search->compare('==', 'product.editor', $this->_editor));
     $search->setConditions($search->combine('&&', $conditions));
     $sortfunc = $search->createFunction('sort:catalog.index.text.relevance', array('unittype13', 'de', 'Expr'));
     $search->setSortations(array($search->sort('+', $sortfunc)));
     $result = $object->searchItems($search, array(), $total);
     $this->assertEquals(1, count($result));
     $this->assertEquals(1, $total);
     $func = $search->createFunction('catalog.index.text.value', array('unittype13', 'de', 'name', 'product'));
     $conditions = array($search->compare('~=', $func, 'Expr'), $search->compare('==', 'product.editor', $this->_editor));
     $search->setConditions($search->combine('&&', $conditions));
     $sortfunc = $search->createFunction('sort:catalog.index.text.value', array('default', 'de', 'name'));
     $search->setSortations(array($search->sort('+', $sortfunc)));
     $result = $object->searchItems($search, array(), $total);
     $this->assertEquals(1, count($result));
     $this->assertEquals(1, $total);
 }