Commit 808c52c Riley Aven
committed
1 parent 231091c commit 808c52c Copy full SHA for 808c52c
File tree 2 files changed +43
-0
lines changed
2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -79,4 +79,22 @@ public function offsetUnset($offset): void
79
79
{
80
80
unset($ this ->results [$ offset ]);
81
81
}
82
+
83
+ /**
84
+ * Determine if the process was successful.
85
+ *
86
+ * @return bool
87
+ */
88
+ public function successful () {
89
+ return collect ($ this ->results )->every (fn ($ poolResult ) => $ poolResult ->successful ());
90
+ }
91
+
92
+ /**
93
+ * Determine if the process failed.
94
+ *
95
+ * @return bool
96
+ */
97
+ public function failed () {
98
+ return !$ this ->successful ();
99
+ }
82
100
}
Original file line number Diff line number Diff line change @@ -47,6 +47,31 @@ public function testProcessPool()
47
47
48
48
$ this ->assertTrue (str_contains ($ results [0 ]->output (), 'ProcessTest.php ' ));
49
49
$ this ->assertTrue (str_contains ($ results [1 ]->output (), 'ProcessTest.php ' ));
50
+
51
+ $ this ->assertTrue ($ results ->successful ());
52
+ }
53
+
54
+ public function testProcessPoolFailed ()
55
+ {
56
+ $ factory = new Factory ;
57
+
58
+ $ factory ->fake ([
59
+ 'cat * ' => $ factory ->result (exitCode: 1 ),
60
+ ]);
61
+
62
+ $ pool = $ factory ->pool (function ($ pool ) {
63
+ return [
64
+ $ pool ->path (__DIR__ )->command ($ this ->ls ()),
65
+ $ pool ->path (__DIR__ )->command ('cat test ' ),
66
+ ];
67
+ });
68
+
69
+ $ results = $ pool ->start ()->wait ();
70
+
71
+ $ this ->assertTrue ($ results [0 ]->successful ());
72
+ $ this ->assertTrue ($ results [1 ]->failed ());
73
+
74
+ $ this ->assertTrue ($ results ->failed ());
50
75
}
51
76
52
77
public function testInvokedProcessPoolCount ()
You can’t perform that action at this time.
0 commit comments