forked from PHP-CS-Fixer/cli-executor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommandExecutorTest.php
More file actions
51 lines (41 loc) · 1.36 KB
/
CommandExecutorTest.php
File metadata and controls
51 lines (41 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
declare(strict_types=1);
/*
* This file is part of CLI Executor.
*
* (c) Dariusz Rumiński <[email protected]>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Keradus\Tests;
use Keradus\CliExecutor\CommandExecutor;
use PHPUnit\Framework\TestCase;
/**
* @covers \Keradus\CliExecutor\CommandExecutor
*
* @internal
*/
final class CommandExecutorTest extends TestCase
{
public function testSimpleExecution(): void
{
$scriptExecutor = CommandExecutor::create('ls -l', __DIR__);
$cliResult = $scriptExecutor->getResult();
if (\is_callable([$this, 'assertStringContainsString'])) {
static::assertStringContainsString(basename(__FILE__), $cliResult->getOutput());
} else {
static::assertContains(basename(__FILE__), $cliResult->getOutput());
}
}
public function testSimpleExecutionWithArray(): void
{
$scriptExecutor = CommandExecutor::create(['ls', '-l'], __DIR__);
$cliResult = $scriptExecutor->getResult();
if (\is_callable([$this, 'assertStringContainsString'])) {
static::assertStringContainsString(basename(__FILE__), $cliResult->getOutput());
} else {
static::assertContains(basename(__FILE__), $cliResult->getOutput());
}
}
}