Skip to content

Commit 6550cb8

Browse files
committed
replace assertEmpty() with stricter assertions
1 parent 3590ca3 commit 6550cb8

File tree

69 files changed

+160
-155
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+160
-155
lines changed

src/Symfony/Bridge/Doctrine/Tests/Validator/DoctrineLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public function testClassNoAutoMapping()
210210
$this->assertSame(AutoMappingStrategy::DISABLED, $classMetadata->getAutoMappingStrategy());
211211

212212
$maxLengthMetadata = $classMetadata->getPropertyMetadata('maxLength');
213-
$this->assertEmpty($maxLengthMetadata);
213+
$this->assertSame([], $maxLengthMetadata);
214214

215215
/** @var PropertyMetadata[] $autoMappingExplicitlyEnabledMetadata */
216216
$autoMappingExplicitlyEnabledMetadata = $classMetadata->getPropertyMetadata('autoMappingExplicitlyEnabled');

src/Symfony/Bridge/PhpUnit/Tests/Metadata/AttributeReaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function testAttributesAreCached()
7171
$reader = new AttributeReader();
7272
$cacheRef = new \ReflectionProperty(AttributeReader::class, 'cache');
7373

74-
self::assertEmpty($cacheRef->getValue($reader));
74+
self::assertSame([], $cacheRef->getValue($reader));
7575

7676
$reader->forClass(FooBar::class, TimeSensitive::class);
7777

src/Symfony/Bridge/Twig/Tests/Extension/AbstractLayoutTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,7 +1592,7 @@ public function testDateErrorBubbling()
15921592
$form->get('date')->addError(new FormError('[trans]Error![/trans]'));
15931593
$view = $form->createView();
15941594

1595-
$this->assertEmpty($this->renderErrors($view));
1595+
$this->assertSame('', $this->renderErrors($view));
15961596
$this->assertNotEmpty($this->renderErrors($view['date']));
15971597
}
15981598

@@ -2213,7 +2213,7 @@ public function testTimeErrorBubbling()
22132213
$form->get('time')->addError(new FormError('[trans]Error![/trans]'));
22142214
$view = $form->createView();
22152215

2216-
$this->assertEmpty($this->renderErrors($view));
2216+
$this->assertSame('', $this->renderErrors($view));
22172217
$this->assertNotEmpty($this->renderErrors($view['time']));
22182218
}
22192219

src/Symfony/Bridge/Twig/Tests/Extension/DumpExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,6 @@ public function testCustomDumper()
142142
'Custom dumper should be used to dump data.'
143143
);
144144

145-
$this->assertEmpty($output, 'Dumper output should be ignored.');
145+
$this->assertSame('', $output, 'Dumper output should be ignored.');
146146
}
147147
}

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ public function testMessengerServicesRemovedWhenDisabled()
796796
\ARRAY_FILTER_USE_KEY
797797
);
798798

799-
$this->assertEmpty($messengerDefinitions);
799+
$this->assertSame([], $messengerDefinitions);
800800
$this->assertFalse($container->hasDefinition('console.command.messenger_consume_messages'));
801801
$this->assertFalse($container->hasDefinition('console.command.messenger_debug'));
802802
$this->assertFalse($container->hasDefinition('console.command.messenger_stop_workers'));
@@ -1941,7 +1941,7 @@ public function testRemovesResourceCheckerConfigCacheFactoryArgumentOnlyIfNoDebu
19411941

19421942
$container = $this->createContainer(['kernel.debug' => false]);
19431943
(new FrameworkExtension())->load([['annotations' => false, 'http_method_override' => false, 'handle_all_throwables' => true, 'php_errors' => ['log' => true]]], $container);
1944-
$this->assertEmpty($container->getDefinition('config_cache_factory')->getArguments());
1944+
$this->assertSame([], $container->getDefinition('config_cache_factory')->getArguments());
19451945
}
19461946

19471947
public function testLoggerAwareRegistration()

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ApiAttributesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function testMapQueryString(string $uri, array $query, string $expectedRe
3434
if ($expectedResponse) {
3535
self::assertJsonStringEqualsJsonString($expectedResponse, $response->getContent());
3636
} else {
37-
self::assertEmpty($response->getContent());
37+
self::assertSame('', $response->getContent());
3838
}
3939
self::assertSame($expectedStatusCode, $response->getStatusCode());
4040
}

src/Symfony/Bundle/SecurityBundle/Tests/DataCollector/SecurityDataCollectorTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function testCollectWhenSecurityIsDisabled()
5454
$this->assertFalse($collector->supportsRoleHierarchy());
5555
$this->assertCount(0, $collector->getRoles());
5656
$this->assertCount(0, $collector->getInheritedRoles());
57-
$this->assertEmpty($collector->getUser());
57+
$this->assertSame('', $collector->getUser());
5858
$this->assertNull($collector->getFirewall());
5959
}
6060

@@ -73,7 +73,7 @@ public function testCollectWhenAuthenticationTokenIsNull()
7373
$this->assertTrue($collector->supportsRoleHierarchy());
7474
$this->assertCount(0, $collector->getRoles());
7575
$this->assertCount(0, $collector->getInheritedRoles());
76-
$this->assertEmpty($collector->getUser());
76+
$this->assertSame('', $collector->getUser());
7777
$this->assertNull($collector->getFirewall());
7878
}
7979

@@ -425,7 +425,7 @@ public function testGetVotersIfAccessDecisionManagerHasNoVoters()
425425

426426
$dataCollector->collect(new Request(), new Response());
427427

428-
$this->assertEmpty($dataCollector->getVoters());
428+
$this->assertSame([], $dataCollector->getVoters());
429429
}
430430

431431
public static function provideRoles(): array

src/Symfony/Component/Asset/Tests/Context/NullContextTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function testGetBasePath()
2020
{
2121
$nullContext = new NullContext();
2222

23-
$this->assertEmpty($nullContext->getBasePath());
23+
$this->assertSame('', $nullContext->getBasePath());
2424
}
2525

2626
public function testIsSecure()

src/Symfony/Component/Asset/Tests/Context/RequestStackContextTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function testGetBasePathEmpty()
2222
{
2323
$requestStackContext = new RequestStackContext(new RequestStack());
2424

25-
$this->assertEmpty($requestStackContext->getBasePath());
25+
$this->assertSame('', $requestStackContext->getBasePath());
2626
}
2727

2828
public function testGetBasePathSet()

src/Symfony/Component/Asset/Tests/VersionStrategy/EmptyVersionStrategyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function testGetVersion()
2121
$emptyVersionStrategy = new EmptyVersionStrategy();
2222
$path = 'test-path';
2323

24-
$this->assertEmpty($emptyVersionStrategy->getVersion($path));
24+
$this->assertSame('', $emptyVersionStrategy->getVersion($path));
2525
}
2626

2727
public function testApplyVersion()

0 commit comments

Comments
 (0)