Skip to content

Commit

Permalink
Merge 5.x into 6.x
Browse files Browse the repository at this point in the history
  • Loading branch information
SonataCI authored Sep 29, 2023
2 parents 66ef703 + f97f681 commit e33ecf0
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 19 deletions.
2 changes: 2 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
]],
'php_unit_strict' => true,
'php_unit_test_case_static_method_calls' => true,
'php_unit_data_provider_name' => true,
'php_unit_data_provider_return_type' => true,
'phpdoc_to_comment' => ['ignored_tags' => ['psalm-suppress', 'phpstan-var']],
'single_line_throw' => false,
'static_lambda' => true,
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"phpunit/phpunit": "^9.5",
"psalm/plugin-phpunit": "^0.18",
"psalm/plugin-symfony": "^5.0",
"rector/rector": "^0.17",
"rector/rector": "^0.18",
"sonata-project/admin-bundle": "^4.20",
"sonata-project/block-bundle": "^4.11 || ^5.0",
"sonata-project/doctrine-orm-admin-bundle": "^4.0",
Expand Down
8 changes: 8 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
use Rector\Config\RectorConfig;
use Rector\Php70\Rector\FunctionLike\ExceptionHandlerTypehintRector;
use Rector\Php71\Rector\FuncCall\CountOnNullRector;
use Rector\PHPUnit\CodeQuality\Rector\Class_\AddSeeTestAnnotationRector;
use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector;
use Rector\PHPUnit\Set\PHPUnitLevelSetList;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList;

return static function (RectorConfig $rectorConfig): void {
Expand All @@ -30,12 +34,16 @@

$rectorConfig->sets([
LevelSetList::UP_TO_PHP_80,
PHPUnitLevelSetList::UP_TO_PHPUNIT_90,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
]);

$rectorConfig->importNames();
$rectorConfig->importShortClasses(false);
$rectorConfig->skip([
CountOnNullRector::class,
ExceptionHandlerTypehintRector::class,
AddSeeTestAnnotationRector::class,
PreferPHPUnitThisCallRector::class,
]);
};
11 changes: 4 additions & 7 deletions tests/Action/LoginActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function testAlreadyAuthenticated(): void
}

/**
* @dataProvider unauthenticatedProvider
* @dataProvider provideUnauthenticatedCases
*/
public function testUnauthenticated(string $lastUsername, ?AuthenticationException $errorMessage = null): void
{
Expand Down Expand Up @@ -208,14 +208,11 @@ public function testUnauthenticated(string $lastUsername, ?AuthenticationExcepti
*
* @phpstan-return iterable<array{string, AuthenticationException|null}>
*/
public function unauthenticatedProvider(): iterable
public function provideUnauthenticatedCases(): iterable
{
$error = new AuthenticationException('An error');

return [
['', null],
['FooUser', $error],
];
yield ['', null];
yield ['FooUser', $error];
}

private function getAction(): LoginAction
Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/Admin/UserAdminTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static function provideCrudUrlsCases(): iterable
}

/**
* @dataProvider provideFormUrlsCases
* @dataProvider provideFormsUrlsCases
*
* @param array<string, mixed> $parameters
* @param array<string, mixed> $fieldValues
Expand All @@ -77,7 +77,7 @@ public function testFormsUrls(string $url, array $parameters, string $button, ar
*
* @phpstan-return iterable<array{0: string, 1: array<string, mixed>, 2: string, 3?: array<string, mixed>}>
*/
public static function provideFormUrlsCases(): iterable
public static function provideFormsUrlsCases(): iterable
{
yield 'Create User' => ['/admin/tests/app/user/create', [
'uniqid' => 'user',
Expand Down
16 changes: 7 additions & 9 deletions tests/Mailer/MailerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function testSendConfirmationEmailMessage(): void
}

/**
* @dataProvider emailTemplateData
* @dataProvider provideSendResettingEmailMessageCases
*/
public function testSendResettingEmailMessage(string $template, string $subject, string $body): void
{
Expand Down Expand Up @@ -111,15 +111,13 @@ public function testSendResettingEmailMessage(string $template, string $subject,
*
* @phpstan-return iterable<array{string, string, string}>
*/
public function emailTemplateData(): iterable
public function provideSendResettingEmailMessageCases(): iterable
{
return [
'CR' => ["Subject\rFirst line\rSecond line", 'Subject', "First line\rSecond line"],
'LF' => ["Subject\nFirst line\nSecond line", 'Subject', "First line\nSecond line"],
'CRLF' => ["Subject\r\nFirst line\r\nSecond line", 'Subject', "First line\r\nSecond line"],
'LFLF' => ["Subject\n\nFirst line\n\nSecond line", 'Subject', "\nFirst line\n\nSecond line"],
'CRCR' => ["Subject\r\rFirst line\r\rSecond line", 'Subject', "\rFirst line\r\rSecond line"],
];
yield 'CR' => ["Subject\rFirst line\rSecond line", 'Subject', "First line\rSecond line"];
yield 'LF' => ["Subject\nFirst line\nSecond line", 'Subject', "First line\nSecond line"];
yield 'CRLF' => ["Subject\r\nFirst line\r\nSecond line", 'Subject', "First line\r\nSecond line"];
yield 'LFLF' => ["Subject\n\nFirst line\n\nSecond line", 'Subject', "\nFirst line\n\nSecond line"];
yield 'CRCR' => ["Subject\r\rFirst line\r\rSecond line", 'Subject', "\rFirst line\r\rSecond line"];
}

private function getMailer(): Mailer
Expand Down

0 comments on commit e33ecf0

Please sign in to comment.