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


PHP Actions::runAddUser方法代码示例

本文整理汇总了PHP中Actions::runAddUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Actions::runAddUser方法的具体用法?PHP Actions::runAddUser怎么用?PHP Actions::runAddUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Actions的用法示例。


在下文中一共展示了Actions::runAddUser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testRunAddUser

 /**
  * Makes sure adding a user happens without errors
  * 
  * @link http://issues.thebuggenie.com/thebuggenie/issues/2494
  *
  * @covers thebuggenie\core\modules\configuration\Actions::runAddUser
  * @dataProvider addUserRequestProvider
  */
 public function testRunAddUser($username, $buddyname, $email, $password, $group_id)
 {
     \b2db\Core::resetMocks();
     $scope = $this->getMockBuilder('thebuggenie\\core\\entities\\Scope')->setMethods(array('hasUsersAvailable'))->getMock();
     $scope->method('hasUsersAvailable')->willReturn(true);
     \thebuggenie\core\framework\Context::setScope($scope);
     $request = new \thebuggenie\core\framework\Request();
     $request->setParameter('username', $username);
     $request->setParameter('buddyname', $buddyname);
     $request->setParameter('email', $email);
     $request->setParameter('password', $password);
     $request->setParameter('password_repeat', $password);
     $request->setParameter('group_id', $group_id);
     $usertablestub = $this->getMockBuilder('b2db\\Table')->setMethods(array('isUsernameAvailable'))->getMock();
     $userscopestablestub = $this->getMockBuilder('b2db\\Table')->getMock();
     \b2db\Core::setTableMock('thebuggenie\\core\\entities\\tables\\UserScopes', $userscopestablestub);
     \b2db\Core::setTableMock('thebuggenie\\core\\entities\\User', $usertablestub);
     \b2db\Core::setTableMock('thebuggenie\\core\\entities\\tables\\Users', $usertablestub);
     $usertablestub->method('isUsernameAvailable')->will($this->returnValue(true));
     // Expect action to verify that username is available
     $usertablestub->expects($this->once())->method('isUsernameAvailable')->with($username);
     $userscopestablestub->expects($this->once())->method('countUsers');
     $this->object->runAddUser($request);
     $userobject = \b2db\Core::getTable('thebuggenie\\core\\entities\\tables\\Users')->getLastMockObject();
     // Expect action to set correct user properties
     $this->assertEquals($userobject->getUsername(), $username);
     $this->assertEquals($userobject->getBuddyname(), $buddyname);
     $this->assertEquals($userobject->getRealname(), $username);
     $this->assertEquals($userobject->getEmail(), $email);
 }
开发者ID:RTechSoft,项目名称:thebuggenie,代码行数:38,代码来源:ActionsTest.php


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