diff -u b/core/tests/Drupal/Tests/Component/ClassFinder/ClassFinderTest.php b/core/tests/Drupal/Tests/Component/ClassFinder/ClassFinderTest.php --- b/core/tests/Drupal/Tests/Component/ClassFinder/ClassFinderTest.php +++ b/core/tests/Drupal/Tests/Component/ClassFinder/ClassFinderTest.php @@ -20,8 +20,8 @@ // The full path is returned therefore only tests with // assertStringEndsWith() so the test is portable. - $path = str_replace('/', DIRECTORY_SEPARATOR, 'core/tests/Drupal/Tests/Component/ClassFinder/ClassFinderTest.php'); - $this->assertStringEndsWith($path, $finder->findFile(ClassFinderTest::class)); + $expected_path = str_replace('/', DIRECTORY_SEPARATOR, 'core/tests/Drupal/Tests/Component/ClassFinder/ClassFinderTest.php'); + $this->assertStringEndsWith($expected_path, $finder->findFile(ClassFinderTest::class)); $class = 'Not\\A\\Class'; $this->assertNull($finder->findFile($class)); @@ -31,7 +31,7 @@ $loader->register(); $this->assertEquals(__FILE__, $finder->findFile($class)); // This shouldn't prevent us from finding the original file. - $this->assertStringEndsWith($path, $finder->findFile(ClassFinderTest::class)); + $this->assertStringEndsWith($expected_path, $finder->findFile(ClassFinderTest::class)); // Clean up the additional autoloader after the test. $loader->unregister(); diff -u b/core/tests/Drupal/Tests/Component/Discovery/YamlDirectoryDiscoveryTest.php b/core/tests/Drupal/Tests/Component/Discovery/YamlDirectoryDiscoveryTest.php --- b/core/tests/Drupal/Tests/Component/Discovery/YamlDirectoryDiscoveryTest.php +++ b/core/tests/Drupal/Tests/Component/Discovery/YamlDirectoryDiscoveryTest.php @@ -80,6 +80,7 @@ $discovery = new YamlDirectoryDiscovery($directories, 'test'); $data = $discovery->findAll(); + // The file path is dependent on the operating system, so we adjust the directory separator. $this->assertSame(['id' => 'item1', 'name' => 'test1 item 1', YamlDirectoryDiscovery::FILE_KEY => 'vfs://modules/test_1/subdir1' . DIRECTORY_SEPARATOR . 'item_1.test.yml'], $data['test_1']['item1']); $this->assertSame(['id' => 'item2', 'name' => 'test1 item 2', YamlDirectoryDiscovery::FILE_KEY => 'vfs://modules/test_1/subdir2' . DIRECTORY_SEPARATOR . 'item_2.test.yml'], $data['test_1']['item2']); $this->assertCount(2, $data['test_1']);