diff --git a/phpunit.xml.dist b/phpunit.xml.dist index d955a6513..d37aaf463 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -12,7 +12,7 @@ - + @@ -29,9 +29,11 @@ + + - - + the test finished, so tests can manipulate the database without affecting other tests --> + + diff --git a/tests/Utils/ValidatorTest.php b/tests/Utils/ValidatorTest.php index 99ee1aa05..c82988a55 100644 --- a/tests/Utils/ValidatorTest.php +++ b/tests/Utils/ValidatorTest.php @@ -16,89 +16,87 @@ class ValidatorTest extends TestCase { - private $object; + private $validator; - public function __construct() + protected function setUp(): void { - parent::__construct(); - - $this->object = new Validator(); + $this->validator = new Validator(); } public function testValidateUsername() { $test = 'username'; - $this->assertSame($test, $this->object->validateUsername($test)); + $this->assertSame($test, $this->validator->validateUsername($test)); } public function testValidateUsernameEmpty() { $this->expectException('Exception'); $this->expectExceptionMessage('The username can not be empty.'); - $this->object->validateUsername(null); + $this->validator->validateUsername(null); } public function testValidateUsernameInvalid() { $this->expectException('Exception'); $this->expectExceptionMessage('The username must contain only lowercase latin characters and underscores.'); - $this->object->validateUsername('INVALID'); + $this->validator->validateUsername('INVALID'); } public function testValidatePassword() { $test = 'password'; - $this->assertSame($test, $this->object->validatePassword($test)); + $this->assertSame($test, $this->validator->validatePassword($test)); } public function testValidatePasswordEmpty() { $this->expectException('Exception'); $this->expectExceptionMessage('The password can not be empty.'); - $this->object->validatePassword(null); + $this->validator->validatePassword(null); } public function testValidatePasswordInvalid() { $this->expectException('Exception'); $this->expectExceptionMessage('The password must be at least 6 characters long.'); - $this->object->validatePassword('12345'); + $this->validator->validatePassword('12345'); } public function testValidateEmail() { $test = '@'; - $this->assertSame($test, $this->object->validateEmail($test)); + $this->assertSame($test, $this->validator->validateEmail($test)); } public function testValidateEmailEmpty() { $this->expectException('Exception'); $this->expectExceptionMessage('The email can not be empty.'); - $this->object->validateEmail(null); + $this->validator->validateEmail(null); } public function testValidateEmailInvalid() { $this->expectException('Exception'); $this->expectExceptionMessage('The email should look like a real email.'); - $this->object->validateEmail('invalid'); + $this->validator->validateEmail('invalid'); } public function testValidateFullName() { $test = 'Full Name'; - $this->assertSame($test, $this->object->validateFullName($test)); + $this->assertSame($test, $this->validator->validateFullName($test)); } public function testValidateFullNameEmpty() { $this->expectException('Exception'); $this->expectExceptionMessage('The full name can not be empty.'); - $this->object->validateFullName(null); + $this->validator->validateFullName(null); } }