File tree Expand file tree Collapse file tree 3 files changed +33
-1
lines changed Expand file tree Collapse file tree 3 files changed +33
-1
lines changed Original file line number Diff line number Diff line change 32
32
"autoload" : {
33
33
"psr-4" : {
34
34
"MichaelRubel\\ EnhancedPipeline\\ " : " src"
35
- }
35
+ },
36
+ "files" : [
37
+ " src/Helpers/helpers.php"
38
+ ]
36
39
},
37
40
"autoload-dev" : {
38
41
"psr-4" : {
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ use MichaelRubel \EnhancedPipeline \Pipeline ;
6
+
7
+ if (! function_exists ('pipeline ' )) {
8
+ /**
9
+ * @param mixed $passable
10
+ * @param array|mixed $pipes
11
+ *
12
+ * @return Pipeline
13
+ */
14
+ function pipeline ($ passable , $ pipes ): Pipeline
15
+ {
16
+ return app (Pipeline::class)
17
+ ->send ($ passable )
18
+ ->through ($ pipes );
19
+ }
20
+ }
Original file line number Diff line number Diff line change @@ -145,6 +145,15 @@ public function rollsTheDatabaseTransactionBackOnFailureWhenOnFailureMethodUsed(
145
145
$ database ->shouldHaveReceived ('beginTransaction ' )->once ();
146
146
$ database ->shouldHaveReceived ('rollBack ' )->once ();
147
147
}
148
+
149
+ /** @test */
150
+ public function testPipelineHelper ()
151
+ {
152
+ $ test = pipeline ('test ' , fn ($ data , $ next ) => $ next ($ data ))
153
+ ->thenReturn ();
154
+
155
+ $ this ->assertSame ('test ' , $ test );
156
+ }
148
157
}
149
158
150
159
class PipelineWithException
You can’t perform that action at this time.
0 commit comments