support username and password change
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@699 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
parent
78bac4580c
commit
ccabc1cdfa
1 changed files with 14 additions and 3 deletions
|
@ -75,15 +75,26 @@ class TestBase extends PHPUnit_Framework_TestCase
|
||||||
/**
|
/**
|
||||||
* Creates a new user in the database.
|
* Creates a new user in the database.
|
||||||
*
|
*
|
||||||
|
* @param string $username Username
|
||||||
|
* @param string $password Password
|
||||||
|
*
|
||||||
* @return integer ID of user
|
* @return integer ID of user
|
||||||
*/
|
*/
|
||||||
protected function addUser()
|
protected function addUser($username = null, $password = null)
|
||||||
{
|
{
|
||||||
$us = SemanticScuttle_Service_Factory::get('User');
|
$us = SemanticScuttle_Service_Factory::get('User');
|
||||||
$rand = rand();
|
$rand = rand();
|
||||||
|
|
||||||
|
if ($username === null) {
|
||||||
|
$username = 'unittestuser-' . $rand;
|
||||||
|
}
|
||||||
|
if ($password === null) {
|
||||||
|
$password = $rand;
|
||||||
|
}
|
||||||
|
|
||||||
$uid = $us->addUser(
|
$uid = $us->addUser(
|
||||||
'unittestuser-' . $rand,
|
$username,
|
||||||
$rand,
|
$password,
|
||||||
'unittest-' . $rand . '@example.org'
|
'unittest-' . $rand . '@example.org'
|
||||||
);
|
);
|
||||||
return $uid;
|
return $uid;
|
||||||
|
|
Loading…
Reference in a new issue