Skip to content

Commit

Permalink
qa: fix failures due to rebasing
Browse files Browse the repository at this point in the history
- Convert mock system from prophecy to PHPUnit mocks.
- Add return values where possible.
- Explicitly cast before calling a function.

Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
  • Loading branch information
weierophinney committed Oct 23, 2020
1 parent ce90bdb commit cbb1ffd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/SwooleEmitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private function emitBody(ResponseInterface $response): void
}

if (! $body->isReadable()) {
$this->swooleResponse->end($body);
$this->swooleResponse->end((string) $body);
return;
}

Expand Down
23 changes: 13 additions & 10 deletions test/SwooleEmitterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ public function testEmitWithBigContentBody(): void
$this->assertTrue($this->emitter->emit($response));
}

public function testEmitCallbackStream()
public function testEmitCallbackStream(): void
{
$content = 'content';
$callable = function () use ($content) {
$callable = function () use ($content): string {
return $content;
};

Expand All @@ -171,16 +171,19 @@ public function testEmitCallbackStream()
->withStatus(200)
->withAddedHeader('Content-Type', 'text/plain');

$this->assertTrue($this->emitter->emit($response));

$this->swooleResponse
->status(200)
->shouldHaveBeenCalled();
->expects($this->once())
->method('status')
->with(200);
$this->swooleResponse
->header('Content-Type', 'text/plain')
->shouldHaveBeenCalled();
->expects($this->once())
->method('header')
->with('Content-Type', 'text/plain');
$this->swooleResponse
->end($content)
->shouldHaveBeenCalled();
->expects($this->once())
->method('end')
->with($content);

$this->assertTrue($this->emitter->emit($response));
}
}

0 comments on commit cbb1ffd

Please sign in to comment.