Skip to content

Commit 00ea4d2

Browse files
committed
Fix tests on Windows
1 parent 9fc483d commit 00ea4d2

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

tests/PHPStan/PhpDoc/DefaultStubFilesProviderTest.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ public function testGetStubFiles(): void
2525
$thirdPartyStubFile = sprintf('%s/vendor/thirdpartyStub.stub', $this->currentWorkingDirectory);
2626
$defaultStubFilesProvider = $this->createDefaultStubFilesProvider(['/projectStub.stub', $thirdPartyStubFile]);
2727
$stubFiles = $defaultStubFilesProvider->getStubFiles();
28-
$this->assertContains('/projectStub.stub', $stubFiles);
29-
$this->assertContains($thirdPartyStubFile, $stubFiles);
28+
29+
$fileHelper = new FileHelper(__DIR__);
30+
$this->assertContains($fileHelper->normalizePath('/projectStub.stub'), $stubFiles);
31+
$this->assertContains($fileHelper->normalizePath($thirdPartyStubFile), $stubFiles);
3032
}
3133

3234
public function testGetProjectStubFiles(): void
@@ -35,11 +37,12 @@ public function testGetProjectStubFiles(): void
3537
$firstPartyStubFile = dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'spl.stub';
3638
$defaultStubFilesProvider = $this->createDefaultStubFilesProvider(['/projectStub.stub', $thirdPartyStubFile, $firstPartyStubFile]);
3739
$projectStubFiles = $defaultStubFilesProvider->getProjectStubFiles();
38-
$this->assertContains('/projectStub.stub', $projectStubFiles);
39-
$this->assertNotContains($thirdPartyStubFile, $projectStubFiles);
40-
$this->assertNotContains($firstPartyStubFile, $projectStubFiles);
4140

4241
$fileHelper = new FileHelper(__DIR__);
42+
$this->assertContains($fileHelper->normalizePath('/projectStub.stub'), $projectStubFiles);
43+
$this->assertNotContains($thirdPartyStubFile, $projectStubFiles);
44+
$this->assertNotContains($fileHelper->normalizePath($thirdPartyStubFile), $projectStubFiles);
45+
$this->assertNotContains($firstPartyStubFile, $projectStubFiles);
4346
$this->assertNotContains($fileHelper->normalizePath($firstPartyStubFile), $projectStubFiles);
4447
}
4548

@@ -48,10 +51,10 @@ public function testGetProjectStubFilesWhenPathContainsWindowsSeparator(): void
4851
$thirdPartyStubFile = sprintf('%s\\vendor\\thirdpartyStub.stub', $this->currentWorkingDirectory);
4952
$defaultStubFilesProvider = $this->createDefaultStubFilesProvider(['/projectStub.stub', $thirdPartyStubFile]);
5053
$projectStubFiles = $defaultStubFilesProvider->getProjectStubFiles();
51-
$this->assertContains('/projectStub.stub', $projectStubFiles);
52-
$this->assertNotContains($thirdPartyStubFile, $projectStubFiles);
5354

5455
$fileHelper = new FileHelper(__DIR__);
56+
$this->assertContains($fileHelper->normalizePath('/projectStub.stub'), $projectStubFiles);
57+
$this->assertNotContains($thirdPartyStubFile, $projectStubFiles);
5558
$this->assertNotContains($fileHelper->normalizePath($thirdPartyStubFile), $projectStubFiles);
5659
}
5760

0 commit comments

Comments
 (0)