Development

Changeset 8023

You must first sign up to be able to contribute.

Changeset 8023

Show
Ignore:
Timestamp:
03/21/08 13:15:15 (7 months ago)
Author:
xavier
Message:

sfPropelActAsTaggableBehaviorPlugin: enabled easy tag insertion in fixtures - refs #3174

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfPropelActAsTaggableBehaviorPlugin/trunk/config/config.php

    r4083 r8023  
    22/* 
    33 * This file is part of the sfPropelActAsTaggableBehavior package. 
    4  *  
     4 * 
    55 * (c) 2007 Xavier Lacot <xavier@lacot.org> 
    6  *  
     6 * 
    77 * For the full copyright and license information, please view the LICENSE 
    88 * file that was distributed with this source code. 
     
    3939    'replaceTag' 
    4040  ), 
     41  array ( 
     42    'sfPropelActAsTaggableBehavior', 
     43    'setTags' 
     44  ), 
    4145)); 
  • plugins/sfPropelActAsTaggableBehaviorPlugin/trunk/lib/sfPropelActAsTaggableBehavior.class.php

    r8022 r8023  
    485485    } 
    486486  } 
     487 
     488  /** 
     489   * Sets the tags of an object. As usual, the second parameter might be an 
     490   * array of tags or a comma-separated string. 
     491   * 
     492   * @param      BaseObject  $object 
     493   * @param      mixed       $tagname 
     494   */ 
     495  public function setTags(BaseObject $object, $tagname) 
     496  { 
     497    $this->removeAllTags($object); 
     498    $this->addTag($object, $tagname); 
     499  } 
    487500} 
  • plugins/sfPropelActAsTaggableBehaviorPlugin/trunk/test/unit/sfPropelActAsTaggableBehaviorTest.php

    r7390 r8023  
    4040 
    4141// start tests 
    42 $t = new lime_test(53, new lime_output_color()); 
     42$t = new lime_test(54, new lime_output_color()); 
    4343 
    4444 
     
    190190$object_tags = $object->getTags(); 
    191191$t->ok((count($object_tags) == 2) && $object->hasTag('tutu') && $object->hasTag('titi'), 'tags can be added with an array.'); 
     192 
     193$object->setTags('wallace, gromit'); 
     194$object_tags = $object->getTags(); 
     195$t->ok((count($object_tags) == 2) && $object->hasTag('wallace') && $object->hasTag('gromit'), 'tags can be set directly using setTags().'); 
    192196 
    193197unset($object);