1
0
mirror of https://github.com/php/pie.git synced 2026-03-23 23:12:17 +01:00
Files
archived-pie/test/integration/Command/BuildCommandTest.php
2024-10-02 07:20:09 +01:00

45 lines
1.3 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 Symfony\Component\Console\Tester\CommandTester;
#[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::factory()->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('Nothing to do on Windows.', $outputString);
return;
}
self::assertStringContainsString('phpize complete.', $outputString);
self::assertStringContainsString('Configure complete.', $outputString);
self::assertStringContainsString('Build complete:', $outputString);
}
}