diff --git a/src/StreamWrapper/LocalStream.php b/src/StreamWrapper/LocalStream.php
index 6e45222..ae338a8 100644
--- a/src/StreamWrapper/LocalStream.php
+++ b/src/StreamWrapper/LocalStream.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\system_stream_wrapper\StreamWrapper;
 
+use Drupal\Component\Utility\DeprecationHelper;
 use Drupal\Core\StreamWrapper\StreamWrapperInterface;
 
 // Ignore coding standards due to stream_open() and similar.
@@ -76,7 +77,7 @@ abstract class LocalStream extends StreamWrapperBase {
     $realpath = realpath($path);
     if (!$realpath) {
       // This file does not yet exist.
-      $basename = \Drupal::service('file_system')->basename($path);
+      $basename = DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => basename($path), fn() => \Drupal::service('file_system')->basename($path));
       $realpath = realpath(dirname($path)) . '/' . $basename;
     }
     $directory = realpath($this->getDirectoryPath());
diff --git a/tests/src/Kernel/File/ExtensionStreamTest.php b/tests/src/Kernel/File/ExtensionStreamTest.php
index 0e94c8f..007f412 100644
--- a/tests/src/Kernel/File/ExtensionStreamTest.php
+++ b/tests/src/Kernel/File/ExtensionStreamTest.php
@@ -2,6 +2,9 @@
 
 namespace Drupal\Tests\system_stream_wrapper\Kernel\File;
 
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
+use PHPUnit\Framework\Attributes\DataProvider;
 use Drupal\KernelTests\KernelTestBase;
 
 /**
@@ -9,6 +12,8 @@ use Drupal\KernelTests\KernelTestBase;
  *
  * @group system_stream_wrapper
  */
+#[Group('system_stream_wrapper')]
+#[RunTestsInSeparateProcesses]
 class ExtensionStreamTest extends KernelTestBase {
 
   /**
@@ -60,6 +65,7 @@ class ExtensionStreamTest extends KernelTestBase {
    *
    * @dataProvider providerInvalidUris
    */
+  #[DataProvider('providerInvalidUris')]
   public function testInvalidStreamUri($uri) {
     // Set 'minimal' as installed profile for the purposes of this test.
     $this->setInstallProfile('minimal');
@@ -81,7 +87,7 @@ class ExtensionStreamTest extends KernelTestBase {
    * @return array[]
    *   A list of urls to test.
    */
-  public function providerInvalidUris() {
+  public static function providerInvalidUris() {
     return [
       ['invalid/uri'],
       ['invalid_uri'],
@@ -110,6 +116,7 @@ class ExtensionStreamTest extends KernelTestBase {
    *
    * @dataProvider providerStreamWrapperMethods
    */
+  #[DataProvider('providerStreamWrapperMethods')]
   public function testStreamWrapperMethods($uri, $dirname, $realpath, $getExternalUrl) {
     // Set 'minimal' as installed profile for the purposes of this test.
     $this->setInstallProfile('minimal');
@@ -167,7 +174,7 @@ class ExtensionStreamTest extends KernelTestBase {
    *   - The result or the exception when running getExternalUrl() method. The
    *     value is prefixed later, in the test method, with the base url.
    */
-  public function providerStreamWrapperMethods() {
+  public static function providerStreamWrapperMethods() {
     return [
       // Cases for module:// stream wrapper.
       [
diff --git a/tests/src/Kernel/LibraryDiscoveryTest.php b/tests/src/Kernel/LibraryDiscoveryTest.php
index 026cabb..e048f64 100644
--- a/tests/src/Kernel/LibraryDiscoveryTest.php
+++ b/tests/src/Kernel/LibraryDiscoveryTest.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\Tests\system_stream_wrapper\Kernel;
 
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
 use Drupal\KernelTests\KernelTestBase;
 
 /**
@@ -9,6 +11,8 @@ use Drupal\KernelTests\KernelTestBase;
  *
  * @group system_stream_wrapper
  */
+#[Group('system_stream_wrapper')]
+#[RunTestsInSeparateProcesses]
 class LibraryDiscoveryTest extends KernelTestBase {
 
   /**
