From 8ba7d2731b9fbeee81e0a456998271f0a3fe1be8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= <5175937+theofidry@users.noreply.github.com> Date: Sun, 13 Nov 2022 22:49:08 +0100 Subject: [PATCH] Simplify a few tests using named parameters (#769) --- tests/PhpScoperAssertions.php | 1 - .../Composer/InstalledPackagesScoperTest.php | 6 +----- tests/Symbol/EnrichedReflectorFactoryTest.php | 15 +++------------ 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/tests/PhpScoperAssertions.php b/tests/PhpScoperAssertions.php index 977651a77..439c88bda 100644 --- a/tests/PhpScoperAssertions.php +++ b/tests/PhpScoperAssertions.php @@ -30,7 +30,6 @@ public static function assertListEqualsCanonicalizing( ): void { Assert::assertIsArray($actual); - // TODO: contribute this to PHPUnit // TODO: use assertArrayIsList() assertion once available // https://github.com/sebastianbergmann/phpunit/commit/71f507496aa1a483b32d9257d6f3477e6e5c091d Assert::assertTrue( diff --git a/tests/Scoper/Composer/InstalledPackagesScoperTest.php b/tests/Scoper/Composer/InstalledPackagesScoperTest.php index be96112f9..762edff4c 100644 --- a/tests/Scoper/Composer/InstalledPackagesScoperTest.php +++ b/tests/Scoper/Composer/InstalledPackagesScoperTest.php @@ -381,12 +381,8 @@ public static function provideInstalledPackagesFiles(): iterable yield 'fideloper/proxy excerpt with excluded provider' => [ new EnrichedReflector( Reflector::createEmpty(), - // TODO: named params SymbolsConfiguration::create( - false, - false, - false, - NamespaceRegistry::create(['Fideloper']), + excludedNamespaces: NamespaceRegistry::create(['Fideloper']), ), ), <<<'JSON' diff --git a/tests/Symbol/EnrichedReflectorFactoryTest.php b/tests/Symbol/EnrichedReflectorFactoryTest.php index cb5ac5b6d..e376abd1e 100644 --- a/tests/Symbol/EnrichedReflectorFactoryTest.php +++ b/tests/Symbol/EnrichedReflectorFactoryTest.php @@ -26,19 +26,10 @@ final class EnrichedReflectorFactoryTest extends TestCase { public function test_it_can_create_an_enriched_reflector(): void { - // TODO: named param could help here $symbolsConfiguration = SymbolsConfiguration::create( - false, - false, - false, - null, - null, - null, - null, - null, - SymbolRegistry::create(['Acme\Foo']), - SymbolRegistry::create(['Acme\main']), - SymbolRegistry::createForConstants(['Acme\BAR']), + excludedClasses: SymbolRegistry::create(['Acme\Foo']), + excludedFunctions: SymbolRegistry::create(['Acme\main']), + excludedConstants: SymbolRegistry::createForConstants(['Acme\BAR']), ); $factory = new EnrichedReflectorFactory(Reflector::createEmpty());