当前位置: 首页>>代码示例>>PHP>>正文


PHP Actions::isAssignedTo方法代码示例

本文整理汇总了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'));
 }
开发者ID:tymiles003,项目名称:X2CRM,代码行数:42,代码来源:X2PermissionsBehaviorTest.php


注:本文中的Actions::isAssignedTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。