Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix various warnings across components test suite #54824

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

Merged
merged 1 commit into from
May 4, 2024
Merged
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
Fix various warnings across components test suite
  • Loading branch information
alexandre-daubois committed May 2, 2024
commit a6fe93c707f2c7fa2fe0139e2ba8abbc00d3cac4
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static function tearDownAfterClass(): void
static::deleteTmpDir();
}

public function provideSecuritySystems()
public static function provideSecuritySystems()
{
yield [['enable_authenticator_manager' => true]];
yield [['enable_authenticator_manager' => false]];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function testSupports()
*/
public function testIsFresh(callable $mockContainer, $expected)
{
$mockContainer($this->container);
$mockContainer($this->container, $this);

$this->assertSame($expected, $this->resourceChecker->isFresh($this->resource, time()));
}
Expand All @@ -61,9 +61,9 @@ public static function isFreshProvider()
$container->method('getParameter')->with('locales')->willReturn(['nl', 'es']);
}, false];

yield 'fresh on every identical parameters' => [function (MockObject $container) {
$container->expects(self::exactly(2))->method('hasParameter')->willReturn(true);
$container->expects(self::exactly(2))->method('getParameter')
yield 'fresh on every identical parameters' => [function (MockObject $container, TestCase $testCase) {
$container->expects($testCase->exactly(2))->method('hasParameter')->willReturn(true);
$container->expects($testCase->exactly(2))->method('getParameter')
->willReturnCallback(function (...$args) {
static $series = [
[['locales'], ['fr', 'en']],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ public function testNestedBundleConfigNotAllowed()
*/
public function testWhenEnv()
{
$this->expectNotToPerformAssertions();

$fixtures = realpath(__DIR__.'/../Fixtures');
$container = new ContainerBuilder();
$loader = new PhpFileLoader($container, new FileLocator(), 'dev', new ConfigBuilderGenerator(sys_get_temp_dir()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ protected function tearDown(): void
parent::tearDown();

@unlink($this->testTmpFilepath);
@unlink($this->largeTestTmpFilepath);

$this->routeCollection = null;
$this->generatorDumper = null;
$this->testTmpFilepath = null;
$this->largeTestTmpFilepath = null;
}

public function testDumpWithRoutes()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@ public function testUncallableCallbacks($callbacks)
$normalizer->normalize($obj, null, ['callbacks' => $callbacks]);
}

public function provideNormalizeCallbacks()
public static function provideNormalizeCallbacks()
{
return [
'Change a string' => [
[
'bar' => function ($bar) {
$this->assertEquals('baz', $bar);
static::assertEquals('baz', $bar);

return 'baz';
},
Expand All @@ -143,11 +143,11 @@ public function provideNormalizeCallbacks()
'Null an item' => [
[
'bar' => function ($value, $object, $attributeName, $format, $context) {
$this->assertSame('baz', $value);
$this->assertInstanceOf(CallbacksObject::class, $object);
$this->assertSame('bar', $attributeName);
$this->assertSame('any', $format);
$this->assertArrayHasKey('circular_reference_limit_counters', $context);
static::assertSame('baz', $value);
static::assertInstanceOf(CallbacksObject::class, $object);
static::assertSame('bar', $attributeName);
static::assertSame('any', $format);
static::assertArrayHasKey('circular_reference_limit_counters', $context);
},
],
'baz',
Expand All @@ -156,7 +156,7 @@ public function provideNormalizeCallbacks()
'Format a date' => [
[
'bar' => function ($bar) {
$this->assertInstanceOf(\DateTime::class, $bar);
static::assertInstanceOf(\DateTime::class, $bar);

return $bar->format('d-m-Y H:i:s');
},
Expand Down Expand Up @@ -190,13 +190,13 @@ public function provideNormalizeCallbacks()
];
}

public function provideDenormalizeCallbacks(): array
public static function provideDenormalizeCallbacks(): array
{
return [
'Change a string' => [
[
'bar' => function ($bar) {
$this->assertEquals('bar', $bar);
static::assertEquals('bar', $bar);

return $bar;
},
Expand All @@ -207,11 +207,11 @@ public function provideDenormalizeCallbacks(): array
'Null an item' => [
[
'bar' => function ($value, $object, $attributeName, $format, $context) {
$this->assertSame('baz', $value);
$this->assertTrue(is_a($object, CallbacksObject::class, true));
$this->assertSame('bar', $attributeName);
$this->assertSame('any', $format);
$this->assertIsArray($context);
static::assertSame('baz', $value);
static::assertTrue(is_a($object, CallbacksObject::class, true));
static::assertSame('bar', $attributeName);
static::assertSame('any', $format);
static::assertIsArray($context);
},
],
'baz',
Expand All @@ -220,7 +220,7 @@ public function provideDenormalizeCallbacks(): array
'Format a date' => [
[
'bar' => function ($bar) {
$this->assertIsString($bar);
static::assertIsString($bar);

return \DateTime::createFromFormat('d-m-Y H:i:s', $bar);
},
Expand Down Expand Up @@ -254,13 +254,13 @@ public function provideDenormalizeCallbacks(): array
];
}

public function providerDenormalizeCallbacksWithTypedProperty(): array
public static function providerDenormalizeCallbacksWithTypedProperty(): array
{
return [
'Change a typed string' => [
[
'foo' => function ($foo) {
$this->assertEquals('foo', $foo);
static::assertEquals('foo', $foo);

return $foo;
},
Expand All @@ -271,11 +271,11 @@ public function providerDenormalizeCallbacksWithTypedProperty(): array
'Null an typed item' => [
[
'foo' => function ($value, $object, $attributeName, $format, $context) {
$this->assertSame('fool', $value);
$this->assertTrue(is_a($object, CallbacksObject::class, true));
$this->assertSame('foo', $attributeName);
$this->assertSame('any', $format);
$this->assertIsArray($context);
static::assertSame('fool', $value);
static::assertTrue(is_a($object, CallbacksObject::class, true));
static::assertSame('foo', $attributeName);
static::assertSame('any', $format);
static::assertIsArray($context);
},
],
'fool',
Expand All @@ -284,7 +284,7 @@ public function providerDenormalizeCallbacksWithTypedProperty(): array
];
}

public function provideInvalidCallbacks()
public static function provideInvalidCallbacks()
{
return [
[['bar' => null]],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ abstract protected function getNormalizerForCircularReference(array $defaultCont

abstract protected function getSelfReferencingModel();

public function provideUnableToNormalizeCircularReference(): array
public static function provideUnableToNormalizeCircularReference(): array
{
return [
[[], [], 1],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function testSkipUninitializedValues(array $context)
$this->assertSame('value', $objectToPopulate->getUninitialized());
}

public function skipUninitializedValuesFlagProvider(): iterable
public static function skipUninitializedValuesFlagProvider(): iterable
{
yield 'passed manually' => [['skip_uninitialized_values' => true, 'groups' => ['foo']]];
yield 'using default context value' => [['groups' => ['foo']]];
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.