Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Use PHPUnit 9.6 to run Symfony's test suite #49380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions phpunit
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ if (!file_exists(__DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {
exit(1);
}
if (!getenv('SYMFONY_PHPUNIT_VERSION')) {
if (\PHP_VERSION_ID < 70200) {
putenv('SYMFONY_PHPUNIT_VERSION=7.5');
} elseif (\PHP_VERSION_ID < 70300) {
if (\PHP_VERSION_ID < 70300) {
putenv('SYMFONY_PHPUNIT_VERSION=8.5.26');
} else {
putenv('SYMFONY_PHPUNIT_VERSION=9.5');
putenv('SYMFONY_PHPUNIT_VERSION=9.6');
}
}
if (!getenv('SYMFONY_PATCH_TYPE_DECLARATIONS') && \PHP_VERSION_ID >= 70300) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,10 +482,24 @@ public function testBaselineFileWriteError()
{
$filename = $this->createFile();
chmod($filename, 0444);
$this->expectError();
$this->expectErrorMessageMatches('/[Ff]ailed to open stream: Permission denied/');
$configuration = Configuration::fromUrlEncodedString('generateBaseline=true&baselineFile='.urlencode($filename));
$configuration->writeBaseline();

$this->expectException(\ErrorException::class);
$this->expectExceptionMessageMatches('/[Ff]ailed to open stream: Permission denied/');

set_error_handler(static function(int $errno, string $errstr, string $errfile = null, int $errline = null) {
if ($errno & (E_WARNING | E_WARNING)) {
throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
}

return false;
});

try {
$configuration->writeBaseline();
} finally {
restore_error_handler();
}
}

public function testExistingIgnoreFile()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,25 @@ public function testNullSafeEvaluateFails($expression, $foo, $message)
/**
* @dataProvider provideInvalidNullSafe
*/
public function testNullSafeCompileFails($expression, $foo)
public function testNullSafeCompileFails($expression)
{
$expressionLanguage = new ExpressionLanguage();

$this->expectWarning();
eval(sprintf('return %s;', $expressionLanguage->compile($expression, ['foo' => 'foo'])));
$this->expectException(\ErrorException::class);

set_error_handler(static function (int $errno, string $errstr, string $errfile = null, int $errline = null): bool {
if ($errno & (\E_WARNING | \E_USER_WARNING)) {
throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
}

return false;
});

try {
eval(sprintf('return %s;', $expressionLanguage->compile($expression, ['foo' => 'foo'])));
} finally {
restore_error_handler();
}
}

public static function provideInvalidNullSafe()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function testFormAttrOnChild()
public function testFormAttrAsBoolWithNoId()
{
$this->expectException(LogicException::class);
$this->expectErrorMessage('form_attr');
$this->expectExceptionMessage('form_attr');
$this->factory
->createNamedBuilder('', FormType::class, null, [
'form_attr' => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ public function testFormAttrOnChild()
public function testFormAttrAsBoolWithNoId()
{
$this->expectException(LogicException::class);
$this->expectErrorMessage('form_attr');
$this->expectExceptionMessage('form_attr');
$this->factory
->createNamedBuilder('', self::TESTED_TYPE, null, [
'form_attr' => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public function testInfobipResponseShouldNotBeEmpty()
$email = $this->basicValidEmail();

$this->expectException(HttpTransportException::class);
$this->expectDeprecationMessage('Unable to send an email: ""');
$this->expectExceptionMessage('Unable to send an email: ""');

$this->transport->send($email);
}
Expand All @@ -384,7 +384,7 @@ public function testInfobipResponseShouldBeStatusCode200()
$email = $this->basicValidEmail();

$this->expectException(HttpTransportException::class);
$this->expectDeprecationMessage('Unable to send an email: "{"requestError": {"serviceException": {"messageId": "string","text": "string"}}}" (code 400)');
$this->expectExceptionMessage('Unable to send an email: "{"requestError": {"serviceException": {"messageId": "string","text": "string"}}}" (code 400)');

$this->transport->send($email);
}
Expand All @@ -395,7 +395,7 @@ public function testInfobipHttpConnectionFailed()
$email = $this->basicValidEmail();

$this->expectException(HttpTransportException::class);
$this->expectDeprecationMessage('Could not reach the remote Infobip server.');
$this->expectExceptionMessage('Could not reach the remote Infobip server.');
$this->transport->send($email);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ public function testTagAndMetadataHeaders()

$this->assertCount(4, $email->getHeaders()->toArray());
$this->assertSame('foo: bar', $email->getHeaders()->get('foo')->toString());
$this->assertCount(2, $email->getHeaders()->all('X-Mailgun-Tag'));
$tagHeaders = iterator_to_array($email->getHeaders()->all('X-Mailgun-Tag'));
$this->assertCount(2, $tagHeaders);
$this->assertSame('X-Mailgun-Tag: password-reset', $tagHeaders[0]->toString());
$this->assertSame('X-Mailgun-Tag: product-name', $tagHeaders[1]->toString());
$this->assertSame('X-Mailgun-Variables: '.json_encode(['Color' => 'blue', 'Client-ID' => '12345']), $email->getHeaders()->get('X-Mailgun-Variables')->toString());
Expand Down