Skip to content

Commit 598304f

Browse files
committed
fix order-dependent test state leaks in tests/
Claude-Session: https://claude.ai/code/session_01X2RJNwg9ij4Z8b725WTVB6
1 parent 9b8d04c commit 598304f

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎tests/Config/RectorConfigTest.php‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ protected function setUp(): void
2727
// the registered-rule lists so the assertions hold whether this class
2828
// runs alone or batched into one warm process by a parallel runner
2929
RectorConfig::resetRecreated();
30+
31+
// the container is shared across tests, so its per-rule dedupe maps persist and would
32+
// swallow a re-registration; reset them so REGISTERED_RECTOR_RULES fills regardless of order
33+
self::getContainer()->resetRuleConfigurations();
34+
3035
SimpleParameterProvider::setParameter(Option::REGISTERED_RECTOR_RULES, []);
3136
SimpleParameterProvider::setParameter(Option::ROOT_STANDALONE_REGISTERED_RULES, []);
3237
}

‎tests/Configuration/ConfigurationFactoryTest.php‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515

1616
final class ConfigurationFactoryTest extends AbstractLazyTestCase
1717
{
18+
protected function tearDown(): void
19+
{
20+
SimpleParameterProvider::setParameter(Option::IS_RUN_NARROWED, false);
21+
SimpleParameterProvider::setParameter(Option::SOURCE, []);
22+
SimpleParameterProvider::setParameter(Option::PATHS, []);
23+
}
24+
1825
public function test(): void
1926
{
2027
$configurationFactory = $this->make(ConfigurationFactory::class);

0 commit comments

Comments
 (0)