mirror of
https://github.com/php/pie.git
synced 2026-03-24 07:22:17 +01:00
53 lines
1.5 KiB
PHP
53 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Php\PieIntegrationTest\Command;
|
|
|
|
use Composer\Util\Platform;
|
|
use Php\Pie\Command\BuildCommand;
|
|
use Php\Pie\Container;
|
|
use PHPUnit\Framework\Attributes\CoversClass;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
use function str_contains;
|
|
|
|
#[CoversClass(BuildCommand::class)]
|
|
class BuildCommandTest extends TestCase
|
|
{
|
|
private const TEST_PACKAGE = 'asgrim/example-pie-extension';
|
|
|
|
private CommandTester $commandTester;
|
|
|
|
public function setUp(): void
|
|
{
|
|
$this->commandTester = new CommandTester(Container::testFactory()->get(BuildCommand::class));
|
|
}
|
|
|
|
public function testBuildCommandWillBuildTheExtension(): void
|
|
{
|
|
$this->commandTester->execute(['requested-package-and-version' => self::TEST_PACKAGE]);
|
|
|
|
$this->commandTester->assertCommandIsSuccessful();
|
|
|
|
$outputString = $this->commandTester->getDisplay();
|
|
|
|
if (Platform::isWindows()) {
|
|
self::assertStringContainsString('Found prebuilt archive', $outputString);
|
|
|
|
return;
|
|
}
|
|
|
|
if (str_contains($outputString, 'Found prebuilt archive')) {
|
|
self::assertStringContainsString('Found prebuilt archive', $outputString);
|
|
self::assertStringContainsString('Pre-packaged binary found', $outputString);
|
|
|
|
return;
|
|
}
|
|
|
|
self::assertStringContainsString('phpize complete.', $outputString);
|
|
self::assertStringContainsString('Configure complete', $outputString);
|
|
self::assertStringContainsString('Build complete:', $outputString);
|
|
}
|
|
}
|