Skip to content

Commit 3f7b12b

Browse files
committed
minor #1087 use phpunit 8 (dmaicher)
This PR was merged into the master branch. Discussion ---------- use phpunit 8 PHPUnit 7 is not maintained anymore so we should update to version 8 😊 See https://phpunit.de/supported-versions.html Commits ------- 39af911 use phpunit 8
2 parents e6844af + 39af911 commit 3f7b12b

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

phpunit.xml.dist

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<server name="APP_ENV" value="test" force="true" />
1313
<server name="SHELL_VERBOSITY" value="-1" />
1414
<server name="SYMFONY_PHPUNIT_REMOVE" value="" />
15-
<server name="SYMFONY_PHPUNIT_VERSION" value="7.5" />
15+
<server name="SYMFONY_PHPUNIT_VERSION" value="8" />
1616
</php>
1717

1818
<testsuites>
@@ -29,9 +29,11 @@
2929

3030
<listeners>
3131
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
32+
</listeners>
3233

34+
<extensions>
3335
<!-- it begins a database transaction before every testcase and rolls it back after
34-
the test finished, so tests can manipulate the database without affecting other tests -->
35-
<listener class="\DAMA\DoctrineTestBundle\PHPUnit\PHPUnitListener" />
36-
</listeners>
36+
the test finished, so tests can manipulate the database without affecting other tests -->
37+
<extension class="\DAMA\DoctrineTestBundle\PHPUnit\PHPUnitExtension" />
38+
</extensions>
3739
</phpunit>

tests/Utils/ValidatorTest.php

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,89 +16,87 @@
1616

1717
class ValidatorTest extends TestCase
1818
{
19-
private $object;
19+
private $validator;
2020

21-
public function __construct()
21+
protected function setUp(): void
2222
{
23-
parent::__construct();
24-
25-
$this->object = new Validator();
23+
$this->validator = new Validator();
2624
}
2725

2826
public function testValidateUsername()
2927
{
3028
$test = 'username';
3129

32-
$this->assertSame($test, $this->object->validateUsername($test));
30+
$this->assertSame($test, $this->validator->validateUsername($test));
3331
}
3432

3533
public function testValidateUsernameEmpty()
3634
{
3735
$this->expectException('Exception');
3836
$this->expectExceptionMessage('The username can not be empty.');
39-
$this->object->validateUsername(null);
37+
$this->validator->validateUsername(null);
4038
}
4139

4240
public function testValidateUsernameInvalid()
4341
{
4442
$this->expectException('Exception');
4543
$this->expectExceptionMessage('The username must contain only lowercase latin characters and underscores.');
46-
$this->object->validateUsername('INVALID');
44+
$this->validator->validateUsername('INVALID');
4745
}
4846

4947
public function testValidatePassword()
5048
{
5149
$test = 'password';
5250

53-
$this->assertSame($test, $this->object->validatePassword($test));
51+
$this->assertSame($test, $this->validator->validatePassword($test));
5452
}
5553

5654
public function testValidatePasswordEmpty()
5755
{
5856
$this->expectException('Exception');
5957
$this->expectExceptionMessage('The password can not be empty.');
60-
$this->object->validatePassword(null);
58+
$this->validator->validatePassword(null);
6159
}
6260

6361
public function testValidatePasswordInvalid()
6462
{
6563
$this->expectException('Exception');
6664
$this->expectExceptionMessage('The password must be at least 6 characters long.');
67-
$this->object->validatePassword('12345');
65+
$this->validator->validatePassword('12345');
6866
}
6967

7068
public function testValidateEmail()
7169
{
7270
$test = '@';
7371

74-
$this->assertSame($test, $this->object->validateEmail($test));
72+
$this->assertSame($test, $this->validator->validateEmail($test));
7573
}
7674

7775
public function testValidateEmailEmpty()
7876
{
7977
$this->expectException('Exception');
8078
$this->expectExceptionMessage('The email can not be empty.');
81-
$this->object->validateEmail(null);
79+
$this->validator->validateEmail(null);
8280
}
8381

8482
public function testValidateEmailInvalid()
8583
{
8684
$this->expectException('Exception');
8785
$this->expectExceptionMessage('The email should look like a real email.');
88-
$this->object->validateEmail('invalid');
86+
$this->validator->validateEmail('invalid');
8987
}
9088

9189
public function testValidateFullName()
9290
{
9391
$test = 'Full Name';
9492

95-
$this->assertSame($test, $this->object->validateFullName($test));
93+
$this->assertSame($test, $this->validator->validateFullName($test));
9694
}
9795

9896
public function testValidateFullNameEmpty()
9997
{
10098
$this->expectException('Exception');
10199
$this->expectExceptionMessage('The full name can not be empty.');
102-
$this->object->validateFullName(null);
100+
$this->validator->validateFullName(null);
103101
}
104102
}

0 commit comments

Comments
 (0)