added hourly and money budgets to activity, project and customer (#843)
This commit is contained in:
@@ -12,11 +12,12 @@ namespace App\Tests\Entity;
|
||||
use App\Entity\User;
|
||||
use App\Entity\UserPreference;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Entity\User
|
||||
*/
|
||||
class UserTest extends AbstractEntityTest
|
||||
class UserTest extends TestCase
|
||||
{
|
||||
public function testDefaultValues()
|
||||
{
|
||||
@@ -40,60 +41,6 @@ class UserTest extends AbstractEntityTest
|
||||
$this->assertEquals('Mr. Code Blaster', $user->getTitle());
|
||||
}
|
||||
|
||||
public function getInvalidTestData()
|
||||
{
|
||||
return [
|
||||
['', ''],
|
||||
[null, null],
|
||||
['xx', 'test@'], // too short username
|
||||
[str_pad('#', 61, '-'), 'test@x.'], // too long username
|
||||
[str_pad('#', 61, '-'), 'test@x.', ['xxxxx']], // too short password and invalid role
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getInvalidTestData
|
||||
*/
|
||||
public function testInvalidValues($username, $email, $roles = [])
|
||||
{
|
||||
$defaultFields = [
|
||||
'username', 'email'
|
||||
];
|
||||
|
||||
$user = new User();
|
||||
$user->setUsername($username);
|
||||
$user->setEmail($email);
|
||||
if (!empty($roles)) {
|
||||
$user->setRoles($roles);
|
||||
$defaultFields[] = 'roles';
|
||||
}
|
||||
|
||||
$this->assertHasViolationForField($user, $defaultFields);
|
||||
}
|
||||
|
||||
public function getValidTestData()
|
||||
{
|
||||
return [
|
||||
[str_pad('#', 3, '-'), 'test@x.x'], // shortest possible username
|
||||
[str_pad('#', 60, '-'), 'test@x.x', ['ROLE_TEAMLEAD']], // longest possible password and valid role
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getValidTestData
|
||||
*/
|
||||
public function testValidValues($username, $email, $roles = [])
|
||||
{
|
||||
$user = new User();
|
||||
$user->setUsername($username);
|
||||
$user->setEmail($email);
|
||||
if (!empty($roles)) {
|
||||
$user->setRoles($roles);
|
||||
}
|
||||
|
||||
$this->assertHasNoViolations($user);
|
||||
}
|
||||
|
||||
public function testDatetime()
|
||||
{
|
||||
$date = new \DateTime('+1 day');
|
||||
|
||||
Reference in New Issue
Block a user