• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

orchestral / testbench-core / 13764189331

10 Mar 2025 12:05PM UTC coverage: 93.162% (+0.08%) from 93.085%
13764189331

Pull #326

github

web-flow
Merge 72c756a12 into d68076bb3
Pull Request #326: Add `Orchestra\Testbench\Foundation\Actions\RemoteCommand`.

15 of 17 new or added lines in 2 files covered. (88.24%)

4 existing lines in 1 file now uncovered.

1376 of 1477 relevant lines covered (93.16%)

62.92 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.67
/src/Foundation/Actions/RemoteCommand.php
1
<?php
2

3
namespace Orchestra\Testbench\Foundation\Actions;
4

5
use Illuminate\Support\Arr;
6
use Illuminate\Support\ProcessUtils;
7
use Symfony\Component\Process\Process;
8

9
use function Orchestra\Testbench\defined_environment_variables;
10
use function Orchestra\Testbench\package_path;
11
use function Orchestra\Testbench\php_binary;
12

13
class RemoteCommand
14
{
15
    /**
16
     * Construct a new action.
17
     *
18
     * @param  array<int, string>|string  $command
19
     * @param  array<string, mixed>|string  $env
20
     * @param  bool|null  $tty
21
     */
22
    public function __construct(
23
        public array|string $command,
24
        public array|string $env = [],
25
        public ?bool $tty = null
26
    ) {}
10✔
27

28
    /**
29
     * Execute the command.
30
     *
31
     * @return \Symfony\Component\Process\Process
32
     */
33
    public function __invoke(): Process
34
    {
35
        $binary = \defined('TESTBENCH_DUSK') ? 'testbench-dusk' : 'testbench';
10✔
36

37
        $commander = is_file($vendorBin = package_path('vendor', 'bin', $binary))
10✔
NEW
38
            ? ProcessUtils::escapeArgument((string) $vendorBin)
×
39
            : $binary;
10✔
40

41
        $env = \is_string($this->env) ? ['APP_ENV' => $this->env] : $this->env;
10✔
42

43
        Arr::add($env, 'TESTBENCH_PACKAGE_REMOTE', '(true)');
10✔
44

45
        $process = Process::fromShellCommandline(
10✔
46
            command: Arr::join([php_binary(true), $commander, ...Arr::wrap($this->command)], ' '),
10✔
47
            cwd: package_path(),
10✔
48
            env: array_merge(defined_environment_variables(), $env)
10✔
49
        );
10✔
50

51
        if (\is_bool($this->tty)) {
10✔
NEW
52
            $process->setTty($this->tty);
×
53
        }
54

55
        return $process;
10✔
56
    }
57
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc