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

orchestral / testbench-core / 13814623289

12 Mar 2025 03:02PM UTC coverage: 92.341%. Remained the same
13814623289

push

github

crynobone
Merge branch '9.x' into 10.x

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>

0 of 1 new or added line in 1 file covered. (0.0%)

1507 of 1632 relevant lines covered (92.34%)

73.86 hits per line

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

60.0
/src/Foundation/Process/ProcessResult.php
1
<?php
2

3
namespace Orchestra\Testbench\Foundation\Process;
4

5
use Closure;
6
use Illuminate\Support\Traits\ForwardsCalls;
7
use Symfony\Component\Process\Process;
8

9
/**
10
 * @internal
11
 */
12
final class ProcessResult extends \Illuminate\Process\ProcessResult
13
{
14
    use ForwardsCalls;
15

16
    /**
17
     * The methods that should be returned from process instance.
18
     *
19
     * @var array<int, string>
20
     */
21
    protected array $passthru = [
22
        'getCommandLine',
23
        'getErrorOutput',
24
        'getExitCode',
25
        'getOutput',
26
        'isSuccessful',
27
    ];
28

29
    /**
30
     * Create a new process result instance.
31
     *
32
     * @param  \Symfony\Component\Process\Process  $process
33
     * @param  (\Closure():(mixed))|array<int, string>|string  $command
34
     */
35
    public function __construct(
36
        Process $process,
37
        protected Closure|array|string $command,
38
    ) {
39
        parent::__construct($process);
12✔
40
    }
41

42
    /** {@inheritDoc} */
43
    #[\Override]
44
    public function output()
45
    {
46
        $output = $this->process->getOutput();
1✔
47

48
        if (! $this->command instanceof Closure) {
1✔
49
            return $output;
1✔
50
        }
51

52
        /** @var array{successful: bool, result: string, exception: \Throwable, parameters: array, message: string} $result */
53
        $result = json_decode($output, true);
1✔
54

55
        if (! $result['successful']) {
1✔
56
            throw new $result['exception'](
×
57
                ...(! empty(array_filter($result['parameters']))
×
58
                    ? $result['parameters']
×
59
                    : [$result['message']])
×
60
            );
×
61
        }
62

63
        return unserialize($result['result']);
1✔
64
    }
65

66
    /**
67
     * Handle dynamic calls to the process instance.
68
     *
69
     * @param  string  $method
70
     * @param  array<int, mixed>  $parameters
71
     * @return mixed
72
     *
73
     * @throws \BadMethodCallException
74
     */
75
    public function __call($method, $parameters)
76
    {
77
        if (! \in_array($method, $this->passthru)) {
1✔
NEW
78
            self::throwBadMethodCallException($method);
×
79
        }
80

81
        return $this->forwardDecoratedCallTo($this->process, $method, $parameters);
1✔
82
    }
83
}
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