File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,29 @@ function ($piped) {
124
124
$ this ->assertEquals (2 , $ object ->value );
125
125
}
126
126
127
+ public function testPipelineThroughMethodOverwritesPreviouslySetAndAppendedPipes ()
128
+ {
129
+ $ object = new stdClass ();
130
+
131
+ $ object ->value = 0 ;
132
+
133
+ $ function = function ($ object , $ next ) {
134
+ $ object ->value ++;
135
+
136
+ return $ next ($ object );
137
+ };
138
+
139
+ $ result = (new Pipeline (new Container ))
140
+ ->send ($ object )
141
+ ->through ([$ function ])
142
+ ->pipe ([$ function ])
143
+ ->through ([$ function ])
144
+ ->then (fn ($ piped ) => $ piped );
145
+
146
+ $ this ->assertSame ($ object , $ result );
147
+ $ this ->assertEquals (1 , $ object ->value );
148
+ }
149
+
127
150
public function testPipelineUsageWithInvokableClass ()
128
151
{
129
152
$ result = (new Pipeline (new Container ))
You can’t perform that action at this time.
0 commit comments