mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-23 16:54:08 +01:00
Added a new class ConsoleApplicationTester, which during E2E tests will create a separate isolated process for the Deployer to run in. This class exposes methods for interacting with stdin and to grab stdout, stderr and status code of finished process.
46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php declare(strict_types=1);
|
|
namespace e2e;
|
|
|
|
class MiscE2ETest extends AbstractE2ETest
|
|
{
|
|
private const RECIPE = __DIR__ . '/recipe/misc.php';
|
|
|
|
/**
|
|
* @group e2e
|
|
*/
|
|
public function testSudoWithPasswordEnteredInteractively(): void
|
|
{
|
|
// We're adding this to inputs, to have it passed with via the STDIN
|
|
$this->tester->setInputs(['deployer']);
|
|
|
|
$this->tester->run([
|
|
'-f' => self::RECIPE,
|
|
'test:misc:sudo-write-user',
|
|
'all',
|
|
]);
|
|
|
|
$display = trim($this->tester->getDisplay());
|
|
|
|
self::assertEquals(0, $this->tester->getStatusCode(), $display);
|
|
self::assertStringContainsString('Current user is: root', $display);
|
|
}
|
|
|
|
/**
|
|
* @group e2e
|
|
*/
|
|
public function testSudoWithPasswordProvidedViaArgument(): void
|
|
{
|
|
$this->tester->run([
|
|
'-f' => self::RECIPE,
|
|
'test:misc:sudo-write-user',
|
|
'-o' => 'sudo_pass=deployer',
|
|
'all',
|
|
]);
|
|
|
|
$display = trim($this->tester->getDisplay());
|
|
|
|
self::assertEquals(0, $this->tester->getStatusCode(), $display);
|
|
self::assertStringContainsString('Current user is: root', $display);
|
|
}
|
|
}
|