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

orchestral / testbench-core / 13801054382

12 Mar 2025 12:37AM UTC coverage: 92.776% (-0.4%) from 93.18%
13801054382

push

github

crynobone
wip

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

9 of 16 new or added lines in 3 files covered. (56.25%)

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
class ProcessResult
9
{
10
    use ForwardsCalls;
11

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

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

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

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

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

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

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

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

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

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

122
        return $this->forwardDecoratedCallTo($this->process, $method, $parameters);
1✔
123
    }
124
}
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