mirror of
https://github.com/php/pie.git
synced 2026-03-23 23:12:17 +01:00
436: bit of test and more useful exception message
This commit is contained in:
@@ -36,7 +36,8 @@ final class UnixBuild implements Build
|
||||
IOInterface $io,
|
||||
PhpizePath|null $phpizePath,
|
||||
): BinaryFile {
|
||||
switch (DownloadUrlMethod::fromDownloadedPackage($downloadedPackage)) {
|
||||
$selectedDownloadMethod = DownloadUrlMethod::fromDownloadedPackage($downloadedPackage);
|
||||
switch ($selectedDownloadMethod) {
|
||||
case DownloadUrlMethod::PrePackagedBinary:
|
||||
return $this->prePackagedBinary($downloadedPackage, $io);
|
||||
|
||||
@@ -45,7 +46,7 @@ final class UnixBuild implements Build
|
||||
return $this->buildFromSource($downloadedPackage, $targetPlatform, $configureOptions, $io, $phpizePath);
|
||||
|
||||
default:
|
||||
throw new LogicException('Unknown download method');
|
||||
throw new LogicException('Unsupported download method: ' . $selectedDownloadMethod->value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
29
test/unit/Building/ExtensionBinaryNotFoundTest.php
Normal file
29
test/unit/Building/ExtensionBinaryNotFoundTest.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Php\PieUnitTest\Building;
|
||||
|
||||
use Php\Pie\Building\ExtensionBinaryNotFound;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
#[CoversClass(ExtensionBinaryNotFound::class)]
|
||||
final class ExtensionBinaryNotFoundTest extends TestCase
|
||||
{
|
||||
public function testFromPrePackagedBinary(): void
|
||||
{
|
||||
self::assertSame(
|
||||
'Expected pre-packaged binary does not exist: /foo/bar',
|
||||
ExtensionBinaryNotFound::fromPrePackagedBinary('/foo/bar')->getMessage(),
|
||||
);
|
||||
}
|
||||
|
||||
public function testFromExpectedBinary(): void
|
||||
{
|
||||
self::assertSame(
|
||||
'Build complete, but expected /foo/bar does not exist.',
|
||||
ExtensionBinaryNotFound::fromExpectedBinary('/foo/bar')->getMessage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user