Skip to content

Commit ccb2cc7

Browse files
committed
minor #707 Allow PHP 7.2 & 7.3 and PHPUnit 6 (VolCh)
This PR was squashed before being merged into the master branch (closes #707). Discussion ---------- Allow PHP 7.2 & 7.3 and PHPUnit 6 Switch to PHPUnit 6 `TestCase::expectException()` & `TestCase::expectExceptionMessage()` from PHPUnit 4 `TestCase::setExpectedException()` Add PHP 7.2 & 7.3 (nightly) to Travis matrix with temporary workarounds for disable `xdebug` & `./vendor/bin/php-cs-fixer` until 7.3 full support Commits ------- 35f5008 Allow PHP 7.2 & 7.3 and PHPUnit 6
2 parents 341cea2 + 35f5008 commit ccb2cc7

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

.travis.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@ matrix:
1414
fast_finish: true
1515
include:
1616
- php: 7.1
17+
- php: 7.2
18+
- php: nightly
19+
allow_failures:
20+
- php: nightly
1721

1822
before_install:
19-
- phpenv config-rm xdebug.ini
23+
- '[[ "$TRAVIS_PHP_VERSION" == "nightly" ]] || phpenv config-rm xdebug.ini'
2024
- composer self-update
2125

2226
install:
@@ -26,7 +30,7 @@ install:
2630
script:
2731
- ./vendor/bin/simple-phpunit
2832
# this checks that the source code follows the Symfony Code Syntax rules
29-
- ./vendor/bin/php-cs-fixer fix --diff --dry-run -v
33+
- '[[ "$TRAVIS_PHP_VERSION" == "nightly" ]] || ./vendor/bin/php-cs-fixer fix --diff --dry-run -v'
3034
# this checks that the YAML config files contain no syntax errors
3135
- ./bin/console lint:yaml config
3236
# this checks that the Twig template files contain no syntax errors

tests/Utils/ValidatorTest.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@ public function testValidateUsername()
3434

3535
public function testValidateUsernameEmpty()
3636
{
37-
$this->setExpectedException('Exception', 'The username can not be empty.');
37+
$this->expectException('Exception');
38+
$this->expectExceptionMessage('The username can not be empty.');
3839
$this->object->validateUsername(null);
3940
}
4041

4142
public function testValidateUsernameInvalid()
4243
{
43-
$this->setExpectedException('Exception', 'The username must contain only lowercase latin characters and underscores.');
44+
$this->expectException('Exception');
45+
$this->expectExceptionMessage('The username must contain only lowercase latin characters and underscores.');
4446
$this->object->validateUsername('INVALID');
4547
}
4648

@@ -53,13 +55,15 @@ public function testValidatePassword()
5355

5456
public function testValidatePasswordEmpty()
5557
{
56-
$this->setExpectedException('Exception', 'The password can not be empty.');
58+
$this->expectException('Exception');
59+
$this->expectExceptionMessage('The password can not be empty.');
5760
$this->object->validatePassword(null);
5861
}
5962

6063
public function testValidatePasswordInvalid()
6164
{
62-
$this->setExpectedException('Exception', 'The password must be at least 6 characters long.');
65+
$this->expectException('Exception');
66+
$this->expectExceptionMessage('The password must be at least 6 characters long.');
6367
$this->object->validatePassword('12345');
6468
}
6569

@@ -72,13 +76,15 @@ public function testValidateEmail()
7276

7377
public function testValidateEmailEmpty()
7478
{
75-
$this->setExpectedException('Exception', 'The email can not be empty.');
79+
$this->expectException('Exception');
80+
$this->expectExceptionMessage('The email can not be empty.');
7681
$this->object->validateEmail(null);
7782
}
7883

7984
public function testValidateEmailInvalid()
8085
{
81-
$this->setExpectedException('Exception', 'The email should look like a real email.');
86+
$this->expectException('Exception');
87+
$this->expectExceptionMessage('The email should look like a real email.');
8288
$this->object->validateEmail('invalid');
8389
}
8490

@@ -91,7 +97,8 @@ public function testValidateFullName()
9197

9298
public function testValidateEmailFullName()
9399
{
94-
$this->setExpectedException('Exception', 'The full name can not be empty.');
100+
$this->expectException('Exception');
101+
$this->expectExceptionMessage('The full name can not be empty.');
95102
$this->object->validateFullName(null);
96103
}
97104
}

0 commit comments

Comments
 (0)