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

orchestral / testbench-core / 13802615868

12 Mar 2025 02:50AM UTC coverage: 92.776%. Remained the same
13802615868

push

github

crynobone
wip

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

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

1387 of 1495 relevant lines covered (92.78%)

62.62 hits per line

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

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

3
namespace Orchestra\Testbench\Foundation\Process;
4

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

8
/**
9
 * @internal
10
 */
11
final class ProcessResult
12
{
13
    use ForwardsCalls;
14

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

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

39
    /**
40
     * Get the original command executed by the process.
41
     *
42
     * @return string
43
     */
44
    public function command()
45
    {
46
        return $this->process->getCommandLine();
×
47
    }
48

49
    /**
50
     * Determine if the process was successful.
51
     *
52
     * @return bool
53
     */
54
    public function successful()
55
    {
56
        return $this->process->isSuccessful();
×
57
    }
58

59
    /**
60
     * Determine if the process failed.
61
     *
62
     * @return bool
63
     */
64
    public function failed()
65
    {
66
        return ! $this->successful();
×
67
    }
68

69
    /**
70
     * Get the exit code of the process.
71
     *
72
     * @return int|null
73
     */
74
    public function exitCode()
75
    {
76
        return $this->process->getExitCode();
×
77
    }
78

79
    /**
80
     * Get the standard output of the process.
81
     *
82
     * @return string
83
     */
84
    public function output()
85
    {
86
        return $this->process->getOutput();
1✔
87
    }
88

89
    /**
90
     * Determine if the output contains the given string.
91
     *
92
     * @param  string  $output
93
     * @return bool
94
     */
95
    public function seeInOutput(string $output)
96
    {
97
        return str_contains($this->output(), $output);
×
98
    }
99

100
    /**
101
     * Get the error output of the process.
102
     *
103
     * @return string
104
     */
105
    public function errorOutput()
106
    {
107
        return $this->process->getErrorOutput();
×
108
    }
109

110
    /**
111
     * Handle dynamic calls to the process instance.
112
     *
113
     * @param  string  $method
114
     * @param  array<int, mixed>  $parameters
115
     * @return mixed
116
     *
117
     * @throws \BadMethodCallException
118
     */
119
    public function __call($method, $parameters)
120
    {
121
        if (! \in_array($method, $this->passthru)) {
1✔
NEW
122
            self::throwBadMethodCallException($method);
×
123
        }
124

125
        return $this->forwardDecoratedCallTo($this->process, $method, $parameters);
1✔
126
    }
127
}
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