本文整理汇总了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);
}