Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Path/Finder/WpCliPathFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,15 @@ public function find(): string
throw new Exception();
}

if (!$firstMatch->isExecutable()) {
if (!$this->isWindows() && !$firstMatch->isExecutable()) {
throw new Exception('The matched WP-CLI binary is not executable.');
}

return $firstMatch->getPathname();
}

private function isWindows(): bool
{
return \DIRECTORY_SEPARATOR === '\\';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,14 @@ public function testWpContentDirectoryIsIgnoredWhenWpCliIsLocated(): void

public function testThrowsWhenLocatedWpCliIsNotExecutable(): void
{
if (\DIRECTORY_SEPARATOR === '\\') {
$this->markTestSkipped('Windows has no POSIX file permissions to test.');
}

$this->expectExceptionMessageMatches('/The matched WP-CLI binary is not executable/');

$this->filesystem->appendToFile($this->workspace . '/acme/vendor/bin/wp', '');
$this->filesystem->chmod($this->workspace . '/acme/vendor/bin/wp', 0644);

(new WpCliPathFinder(
$this->localDependencyPath($this->workspace . '/acme'),
Expand Down
Loading