forked from tienvx/composer-downloads-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace LastCall\DownloadsPlugin\Helper; | ||
|
||
class MuslDetector | ||
{ | ||
public function __invoke(): bool | ||
{ | ||
exec('ldd /bin/sh 2>&1', $output, $returnCode); | ||
if (0 !== $returnCode) { | ||
return false; | ||
} | ||
$ldd = trim(implode("\n", $output)); | ||
|
||
return str_contains($ldd, 'musl'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace LastCall\DownloadsPlugin\Tests\Unit\Parser; | ||
|
||
use LastCall\DownloadsPlugin\Helper\MuslDetector; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class MuslDetectorTest extends TestCase | ||
{ | ||
public function testInvoke(): void | ||
{ | ||
$detector = new MuslDetector(); | ||
// @todo Test when the result is true | ||
$this->assertFalse($detector()); | ||
} | ||
} |