mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-24 09:12:51 +01:00
As well rename test dir to tests, as Pest does not support dir without s on the end. Also, remove PHP requirement from composer.json as we already have check-in bin/dep and it's better to have the check only in one place (now they already out of sync).
50 lines
1.4 KiB
PHP
50 lines
1.4 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
|
|
{
|
|
$this->init(self::RECIPE);
|
|
|
|
// We're adding this to inputs, to have it passed with via the STDIN
|
|
$this->tester->setInputs(['deployer']);
|
|
|
|
$this->tester->run([
|
|
'test:misc:sudo-write-user',
|
|
'-f' => self::RECIPE,
|
|
'selector' => 'all',
|
|
], [ 'decorated' => false ]);
|
|
|
|
$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->init(self::RECIPE);
|
|
|
|
$this->tester->run([
|
|
'test:misc:sudo-write-user',
|
|
'-f' => self::RECIPE,
|
|
'-o' => [ 'sudo_pass=deployer' ],
|
|
'selector' => 'all',
|
|
], [ 'decorated' => false ]);
|
|
|
|
$display = trim($this->tester->getDisplay());
|
|
|
|
self::assertEquals(0, $this->tester->getStatusCode(), $display);
|
|
self::assertStringContainsString('Current user is: root', $display);
|
|
}
|
|
}
|