$result[] = $tag->getName(); } $t->ok($result === array('ns:key=value', 'ns:key=tutu', 'ns:key=titi', 'ns:key=toto'), 'it is possible to search for triple tags by key.'); $tags_triple = TagPeer::getAll(null, array('triple' => true, 'value' => 'tutu')); $result = array(); foreach ($tags_triple as $tag) { $result[] = $tag->getName(); } $t->ok($result === array('ns:key=tutu'), 'it is possible to search for triple tags by value.'); $objects_triple = TagPeer::getTaggedWith(array(), array('namespace' => 'ns', 'model' => 'Post')); $t->ok(count($objects_triple) == 1, 'it is possible to retrieve objects tagged with certain triple tags.'); // these tests check for the behavior of the triple tags when the plugin is set // up so that namespace:key is a unique key // clean the database TagPeer::doDeleteAll(); TaggingPeer::doDeleteAll(); call_user_func(array(_create_object()->getPeer(), 'doDeleteAll')); sfConfig::set('app_deppPropelActAsTaggableBehaviorPlugin_triple_distinct', true); $t->diag('querying triple tagging'); $object = _create_object(); $object->addTag('tutu'); $object->save(); $object = _create_object(); $object->addTag('ns:key=value'); $object->addTag('ns:key=tutu'); $object->addTag('ns:key=titi'); $object->addTag('ns:second_key=toto'); $object->save(); $tags_triple = TagPeer::getAll(null, array('triple' => true, 'namespace' => 'ns')); $t->ok(count($tags_triple) == 2, 'it is possible to set up the plugin so that namespace:key is a unique key.'); $object2 = _create_object();