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

orchestral / testbench-core / 13800997462

12 Mar 2025 12:32AM UTC coverage: 92.242% (-0.3%) from 92.492%
13800997462

push

github

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

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

2 of 3 new or added lines in 1 file covered. (66.67%)

5 existing lines in 1 file now uncovered.

1510 of 1637 relevant lines covered (92.24%)

73.75 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
class ProcessResult extends \Illuminate\Process\ProcessResult
10
{
11
    use ForwardsCalls;
12

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

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

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

45
        if (! $this->command instanceof Closure) {
1✔
46
            return $output;
1✔
47
        }
48

49
        $result = json_decode($output, true);
1✔
50

51
        if (! $result['successful']) {
1✔
UNCOV
52
            throw new $result['exception'](
×
UNCOV
53
                ...(! empty(array_filter($result['parameters']))
×
UNCOV
54
                    ? $result['parameters']
×
UNCOV
55
                    : [$result['message']])
×
UNCOV
56
            );
×
57
        }
58

59
        return unserialize($result['result']);
1✔
60
    }
61

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

77
        return $this->forwardDecoratedCallTo($this->process, $method, $parameters);
1✔
78
    }
79
}
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