本文整理汇总了PHP中Actions::isAssignedTo方法的典型用法代码示例。如果您正苦于以下问题:PHP Actions::isAssignedTo方法的具体用法?PHP Actions::isAssignedTo怎么用?PHP Actions::isAssignedTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Actions
的用法示例。
在下文中一共展示了Actions::isAssignedTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetAssignedTo
public function testGetAssignedTo()
{
// Flush the cache; we're doing group membership tests, which will use
// the cache, and we've loaded fixtures that affect that:
$cacheVal = Yii::app()->cache->get('user_groups');
$this->assertTrue(Yii::app()->cache->flush());
$this->assertTrue($cacheVal === false || $cacheVal !== Yii::app()->cache->get('user_groups'));
// Direct single-user assignment:
$action = new Actions();
$action->assignedTo = 'testUser1';
$this->assertTrue($action->isAssignedTo('testUser1'));
// Assignment via single-group association:
$action = new Actions();
$action->assignedTo = '2';
//$assignees = explode(', ','2');
//$groupIds = array_filter($assignees,'ctype_digit');
//$userGroupsAssigned = array_intersect($groupIds,Groups::getUserGroups(1));
$this->assertTrue($action->isAssignedTo('testUser1'));
// Assigned via "Anyone" or null assignment:
$action = new Actions();
$action->assignedTo = 'Anyone';
$this->assertTrue($action->isAssignedTo('testUser1'));
$action = new Actions();
$action->assignedTo = '';
$this->assertTrue($action->isAssignedTo('testUser1'));
// Assigned via multiple assignment (username):
$action = new Actions();
$action->assignedTo = 'testUser1, testUser2';
$this->assertTrue($action->isAssignedTo('testUser1'));
// Assigned via multiple assignment (group):
$action = new Actions();
$action->assignedTo = '2, testUser2';
$this->assertTrue($action->isAssignedTo('testUser1'));
// Not assigned (single):
$action = new Actions();
$action->assignedTo = 'testUser2';
$this->assertFalse($action->isAssignedTo('testUser1'));
// Not assigned (multiple)
$action = new Actions();
$action->assignedTo = 'testUser2, testUser3';
$this->assertFalse($action->isAssignedTo('testUser1'));
}