コード例 #1
0
 public static function tearDownAfterClass()
 {
     parent::tearDownAfterClass();
     NotificationConfigurationValuePeer::doDeleteAll();
     NotificationConfigurationPeer::doDeleteAll();
     NotificationTypeAttributePeer::doDeleteAll();
     NotificationTypePeer::doDeleteAll();
     sfGuardUserPeer::doDeleteAll();
 }
 * This file is part of the sfPropelActAsRatableBehavior package.
 *
 * (c) 2009 Kasper Garnæs <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
/**
 * The unit test assumes that sfGuardPlugin is installed and that the model 
 * class Item is defined. 
 */
include dirname(__FILE__) . '/../bootstrap/unit.php';
sfPropelBehavior::add('sfGuardUser', array('sfPropelActAsSlopeOneRaterBehavior'));
//Setup values
sfRatingPeer::doDeleteAll();
sfGuardUserPeer::doDeleteAll();
$users = array();
for ($i = 0; $i < 3; $i++) {
    $users[$i] = new sfGuardUser();
    $users[$i]->setUsername(rand());
    $users[$i]->save();
}
$items = ItemPeer::doSelect(new Criteria());
$items[0]->setRating(5, $users[0]->getId());
$items[1]->setRating(3, $users[0]->getId());
$items[2]->setRating(2, $users[0]->getId());
$items[0]->setRating(3, $users[1]->getId());
$items[1]->setRating(4, $users[1]->getId());
$items[1]->setRating(2, $users[2]->getId());
$items[2]->setRating(5, $users[2]->getId());
$t = new lime_test(10, new lime_output_color());