Skip to content

Commit 84a1771

Browse files
authored
Merge pull request #44 from clue-labs/revert-24-remove-progress-from-buffered-sink
Revert "BufferedSink: Remove progress notifications"
2 parents 061984d + c993092 commit 84a1771

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/BufferedSink.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public function handleErrorEvent($e)
3131
public function write($data)
3232
{
3333
$this->buffer .= $data;
34+
$this->deferred->progress($data);
3435
}
3536

3637
public function close()

tests/BufferedSinkTest.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,30 @@ public function errorsShouldRejectPromise()
107107
}
108108

109109
/** @test */
110-
public function writeShouldNotTriggerProgressOnPromise()
110+
public function writeShouldTriggerProgressOnPromise()
111111
{
112112
$callback = $this->createCallableMock();
113113
$callback
114-
->expects($this->never())
115-
->method('__invoke');
114+
->expects($this->at(0))
115+
->method('__invoke')
116+
->with('foo');
117+
$callback
118+
->expects($this->at(1))
119+
->method('__invoke')
120+
->with('bar');
121+
$callback
122+
->expects($this->at(2))
123+
->method('__invoke')
124+
->with('baz');
116125

117126
$sink = new BufferedSink();
118127
$sink
119128
->promise()
120129
->then(null, null, $callback);
121130

122131
$sink->write('foo');
132+
$sink->write('bar');
133+
$sink->end('baz');
123134
}
124135

125136
/** @test */

0 commit comments

Comments
 (0)