Ensure test mocks don't pollute other tests

This commit is contained in:
Corey McKrill 2023-06-12 14:49:22 -07:00
parent d2a9feda2a
commit 7cbebac61c
No known key found for this signature in database
GPG Key ID: 84BBFE669C4D97B8
1 changed files with 5 additions and 1 deletions

View File

@ -132,7 +132,7 @@ class WC_Tracker_Test extends \WC_Unit_Test_Case {
};
$container = wc_get_container();
$container->get( PluginUtil::class );
$container->get( PluginUtil::class ); // Ensure that the class is loaded.
$container->reset_all_resolved();
$container->replace( PluginUtil::class, $pluginutil_mock );
$container->replace( FeaturesController::class, $featurescontroller_mock );
@ -158,6 +158,10 @@ class WC_Tracker_Test extends \WC_Unit_Test_Case {
),
$tracking_data['inactive_plugins']['plugin3']['feature_compatibility']
);
// Reset the mocked classes so they don't affect other tests.
$container->replace( PluginUtil::class, PluginUtil::class );
$container->replace( FeaturesController::class, FeaturesController::class );
}
/**