Skip to content

Commit

Permalink
Fix VendorCleanup for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
asgrim committed Jan 9, 2025
1 parent 3b18514 commit 4ae2f35
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
9 changes: 4 additions & 5 deletions src/ComposerIntegration/VendorCleanup.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,16 @@ static function (string $path): bool {
array_walk(
$toRemove,
function (string $pathToRemove) use ($vendorDir): void {
$fullPathToRemove = $vendorDir . DIRECTORY_SEPARATOR . $pathToRemove;

$this->output->writeln(
sprintf(
'<comment>Removing: %s/%s</comment>',
$vendorDir,
$pathToRemove,
'<comment>Removing: %s</comment>',
$fullPathToRemove,
),
OutputInterface::VERBOSITY_VERY_VERBOSE,
);

$fullPathToRemove = $vendorDir . DIRECTORY_SEPARATOR . $pathToRemove;

if ($this->filesystem->remove($fullPathToRemove)) {
return;
}
Expand Down
5 changes: 3 additions & 2 deletions test/unit/ComposerIntegration/VendorCleanupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use function restore_error_handler;
use function set_error_handler;

use const DIRECTORY_SEPARATOR;
use const E_WARNING;

#[CoversClass(VendorCleanup::class)]
Expand Down Expand Up @@ -86,8 +87,8 @@ public function testVendorDirIsCleaned(): void
->method('remove')
->willReturnCallback(static function (string $path) use (&$vendor1Removed, &$vendor2Removed): bool {
return match ($path) {
self::VENDOR_DIR . '/vendor1' => $vendor1Removed = true,
self::VENDOR_DIR . '/vendor2' => $vendor2Removed = true,
self::VENDOR_DIR . DIRECTORY_SEPARATOR . 'vendor1' => $vendor1Removed = true,
self::VENDOR_DIR . DIRECTORY_SEPARATOR . 'vendor2' => $vendor2Removed = true,
};
});

Expand Down

0 comments on commit 4ae2f35

Please sign in to comment.