Skip to content

Commit

Permalink
Merge branch '5.4' into 6.3
Browse files Browse the repository at this point in the history
* 5.4:
  [Tests] Streamline
  [Validator] updated Romanian translation
  • Loading branch information
nicolas-grekas committed Oct 31, 2023
2 parents e6743d1 + 7b8ea10 commit 4da3bac
Show file tree
Hide file tree
Showing 19 changed files with 28 additions and 32 deletions.
4 changes: 2 additions & 2 deletions Tests/AbstractRequestHandlerTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function getNormalizedIniPostMaxSize(): string
$this->request = null;
}

public static function methodExceptGetProvider()
public static function methodExceptGetProvider(): array
{
return [
['POST'],
Expand All @@ -78,7 +78,7 @@ public static function methodExceptGetProvider()
];
}

public static function methodProvider()
public static function methodProvider(): array
{
return array_merge([
['GET'],
Expand Down
2 changes: 1 addition & 1 deletion Tests/CompoundFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ public function testSubmitMapsSubmittedChildrenOntoEmptyData()
$this->assertSame('Bernhard', $object['name']);
}

public static function requestMethodProvider()
public static function requestMethodProvider(): array
{
return [
['POST'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected function tearDown(): void
$this->transformerWithNull = null;
}

public static function transformProvider()
public static function transformProvider(): array
{
return [
// more extensive test set can be found in FormUtilTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,21 @@
*/
class DateIntervalToStringTransformerTest extends DateIntervalTestCase
{
public static function dataProviderISO()
public static function dataProviderISO(): array
{
$data = [
return [
['P%YY%MM%DDT%HH%IM%SS', 'P00Y00M00DT00H00M00S', 'PT0S'],
['P%yY%mM%dDT%hH%iM%sS', 'P0Y0M0DT0H0M0S', 'PT0S'],
['P%yY%mM%dDT%hH%iM%sS', 'P10Y2M3DT16H5M6S', 'P10Y2M3DT16H5M6S'],
['P%yY%mM%dDT%hH%iM', 'P10Y2M3DT16H5M', 'P10Y2M3DT16H5M'],
['P%yY%mM%dDT%hH', 'P10Y2M3DT16H', 'P10Y2M3DT16H'],
['P%yY%mM%dD', 'P10Y2M3D', 'P10Y2M3DT0H'],
];

return $data;
}

public static function dataProviderDate()
public static function dataProviderDate(): array
{
$data = [
return [
[
'%y years %m months %d days %h hours %i minutes %s seconds',
'10 years 2 months 3 days 16 hours 5 minutes 6 seconds',
Expand All @@ -52,8 +50,6 @@ public static function dataProviderDate()
['%y years %m months', '10 years 2 months', 'P10Y2M'],
['%y year', '1 year', 'P1Y'],
];

return $data;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function testTransform(\DateTime $expectedOutput, \DateTimeImmutable $inp
$this->assertEquals($expectedOutput->getTimezone(), $actualOutput->getTimezone());
}

public static function provider()
public static function provider(): array
{
return [
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DateTimeToHtml5LocalDateTimeTransformerTest extends BaseDateTimeTransforme
{
use DateTimeEqualsTrait;

public static function transformProvider()
public static function transformProvider(): array
{
return [
['UTC', 'UTC', '2010-02-03 04:05:06 UTC', '2010-02-03T04:05:06', true],
Expand All @@ -36,7 +36,7 @@ public static function transformProvider()
];
}

public static function reverseTransformProvider()
public static function reverseTransformProvider(): array
{
return [
// format without seconds, as appears in some browsers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected function tearDown(): void
$this->dateTimeWithoutSeconds = null;
}

public static function allProvider()
public static function allProvider(): array
{
return [
['UTC', 'UTC', '2010-02-03 04:05:06 UTC', '2010-02-03T04:05:06Z'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function testReverseTransform()
$this->assertEquals(2, $transformer->reverseTransform('200'));
}

public static function reverseTransformWithRoundingProvider()
public static function reverseTransformWithRoundingProvider(): array
{
return [
// towards positive infinity (1.6 -> 2, -1.6 -> -1)
Expand Down
4 changes: 2 additions & 2 deletions Tests/Extension/Core/Type/CheckboxTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public function testCustomModelTransformer($data, $checked)
$this->assertEquals($checked, $view->vars['checked']);
}

public static function provideCustomModelTransformerData()
public static function provideCustomModelTransformerData(): array
{
return [
['checked', true],
Expand All @@ -182,7 +182,7 @@ public function testCustomFalseValues($falseValue)
$this->assertFalse($form->getData());
}

public static function provideCustomFalseValues()
public static function provideCustomFalseValues(): array
{
return [
[''],
Expand Down
4 changes: 2 additions & 2 deletions Tests/Extension/Core/Type/ColorTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function testValidationShouldPass(bool $html5, ?string $submittedValue)
$this->assertEmpty($form->getErrors());
}

public static function validationShouldPassProvider()
public static function validationShouldPassProvider(): array
{
return [
[false, 'foo'],
Expand Down Expand Up @@ -71,7 +71,7 @@ public function testValidationShouldFail(string $expectedValueParameterValue, ?s
$this->assertEquals([$expectedFormError], iterator_to_array($form->getErrors()));
}

public static function validationShouldFailProvider()
public static function validationShouldFailProvider(): array
{
return [
['foo', 'foo'],
Expand Down
2 changes: 1 addition & 1 deletion Tests/Extension/Core/Type/DateIntervalTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ public function testSubmitNullUsesDateEmptyData($widget, $emptyData, $expectedDa
$this->assertEquals($expectedData, $form->getData());
}

public static function provideEmptyData()
public static function provideEmptyData(): array
{
$expectedData = new \DateInterval('P6Y4M');

Expand Down
2 changes: 1 addition & 1 deletion Tests/Extension/Core/Type/ExtendedChoiceTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function testChoiceLoaderIsOverridden($type)
$this->assertSame('lazy_b', $choices[1]->value);
}

public static function provideTestedTypes()
public static function provideTestedTypes(): iterable
{
yield [CountryTypeTest::TESTED_TYPE];
yield [CurrencyTypeTest::TESTED_TYPE];
Expand Down
2 changes: 1 addition & 1 deletion Tests/Extension/Core/Type/FileTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public function testSubmitNonArrayValueWhenMultiple(RequestHandlerInterface $req
$this->assertSame([], $form->getViewData());
}

public static function requestHandlerProvider()
public static function requestHandlerProvider(): array
{
return [
[new HttpFoundationRequestHandler()],
Expand Down
2 changes: 1 addition & 1 deletion Tests/Extension/Core/Type/TextTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function testSubmitNullReturnsNullWithEmptyDataAsString()
$this->assertSame('', $form->getViewData());
}

public static function provideZeros()
public static function provideZeros(): array
{
return [
[0, '0'],
Expand Down
2 changes: 1 addition & 1 deletion Tests/Extension/Core/Type/WeekTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public function testSubmitNullUsesDateEmptyDataString($widget, $emptyData, $expe
$this->assertSame($expectedData, $form->getData());
}

public static function provideEmptyData()
public static function provideEmptyData(): array
{
return [
'Compound text field' => ['text', ['year' => '2019', 'week' => '1'], ['year' => 2019, 'week' => 1]],
Expand Down
2 changes: 1 addition & 1 deletion Tests/FormErrorIteratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function testFindByCodes($code, $violationsCount)
$this->assertCount($violationsCount, $specificFormErrors);
}

public static function findByCodesProvider()
public static function findByCodesProvider(): array
{
return [
['code1', 2],
Expand Down
2 changes: 1 addition & 1 deletion Tests/ResolvedFormTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public function testBlockPrefixDefaultsToFQCNIfNoName($typeClass, $blockPrefix)
$this->assertSame($blockPrefix, $resolvedType->getBlockPrefix());
}

public static function provideTypeClassBlockPrefixTuples()
public static function provideTypeClassBlockPrefixTuples(): array
{
return [
[Fixtures\FooType::class, 'foo'],
Expand Down
2 changes: 1 addition & 1 deletion Tests/SimpleFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function testGetPropertyPath($name, $propertyPath)
$this->assertEquals($propertyPath, $form->getPropertyPath());
}

public static function provideFormNames()
public static function provideFormNames(): iterable
{
yield [null, null];
yield ['', null];
Expand Down
6 changes: 3 additions & 3 deletions Tests/Util/StringUtilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

class StringUtilTest extends TestCase
{
public static function trimProvider()
public static function trimProvider(): array
{
return [
[' Foo! ', 'Foo!'],
Expand Down Expand Up @@ -49,7 +49,7 @@ public function testTrimUtf8Separators($hex)
$this->assertSame("ab\ncd", StringUtil::trim($symbol));
}

public static function spaceProvider()
public static function spaceProvider(): array
{
return [
// separators
Expand Down Expand Up @@ -97,7 +97,7 @@ public function testFqcnToBlockPrefix($fqcn, $expectedBlockPrefix)
$this->assertSame($expectedBlockPrefix, $blockPrefix);
}

public static function fqcnToBlockPrefixProvider()
public static function fqcnToBlockPrefixProvider(): array
{
return [
['TYPE', 'type'],
Expand Down

0 comments on commit 4da3bac

Please sign in to comment.