Changeset 5489
- Timestamp:
- 10/12/07 20:08:37 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfPropelActAsTaggableBehaviorPlugin/lib/sfPropelActAsTaggableBehavior.class.php
r4507 r5489 213 213 * @param BaseObject $object 214 214 */ 215 public function getTags(BaseObject $object )215 public function getTags(BaseObject $object, $options = array()) 216 216 { 217 217 $tags = array_merge(self::get_tags($object), $this->getSavedTags($object)); 218 218 ksort($tags); 219 220 if (isset($options['serialized']) && (true === $options['serialized'])) 221 { 222 $tags = implode(', ', $tags); 223 } 224 219 225 return $tags; 220 226 } plugins/sfPropelActAsTaggableBehaviorPlugin/test/unit/sfPropelActAsTaggableBehaviorTest.php
r5039 r5489 4 4 5 5 // initializes testing framework 6 $app = 'frontend'; 7 include(dirname(__FILE__).'/../../../../test/bootstrap/functional.php'); 6 $sf_root_dir = realpath(dirname(__FILE__).'/../../../../'); 7 $apps_dir = glob($sf_root_dir.'/apps/*', GLOB_ONLYDIR); 8 $app = substr($apps_dir[0], 9 strrpos($apps_dir[0], DIRECTORY_SEPARATOR) + 1, 10 strlen($apps_dir[0])); 11 if (!$app) 12 { 13 throw new Exception('No app has been detected in this project'); 14 } 15 16 require_once($sf_root_dir.'/test/bootstrap/functional.php'); 17 require_once($sf_symfony_lib_dir.'/vendor/lime/lime.php'); 18 19 if (!defined('TEST_CLASS') or !class_exists(TEST_CLASS)) 20 { 21 // Don't run tests 22 return; 23 } 8 24 9 25 // initialize database manager … … 22 38 23 39 // start tests 24 $t = new lime_test(3 2, new lime_output_color());40 $t = new lime_test(33, new lime_output_color()); 25 41 26 42 … … 131 147 $object2_tags = $object2->getTags(); 132 148 $t->ok((count($object2_tags) == 2) && (count($object_tags) == 3), 'removing one tag as no effect on the other tags of the object, neither on the other objects.'); 149 150 $object2_tags = $object2->getTags(array('serialized' => true)); 151 $t->ok($object2_tags == 'clever age, symfony', 'tags can be retrieved in a serialized form.'); 133 152 134 153 unset($object, $object2, $object2_copy);