From e099c46a0de2dcdeb12d00513f60075afbab3279 Mon Sep 17 00:00:00 2001 From: Alex Renoki Date: Sun, 30 Aug 2020 20:00:45 +0300 Subject: [PATCH] docblocks --- tests/Mocks/Connection.php | 50 +++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/tests/Mocks/Connection.php b/tests/Mocks/Connection.php index 2e9c606..904a7a6 100644 --- a/tests/Mocks/Connection.php +++ b/tests/Mocks/Connection.php @@ -8,26 +8,63 @@ use Ratchet\ConnectionInterface; class Connection implements ConnectionInterface { - /** @var Request */ + /** + * The request instance. + * + * @var Request + */ public $httpRequest; + /** + * The sent data through the connection. + * + * @var array + */ public $sentData = []; + /** + * The raw (unencoded) sent data. + * + * @var array + */ public $sentRawData = []; + /** + * Wether the connection has been closed. + * + * @var bool + */ public $closed = false; + /** + * Send the data through the connection. + * + * @param mixed $data + * @return void + */ public function send($data) { $this->sentData[] = json_decode($data, true); $this->sentRawData[] = $data; } + /** + * Mark the connection as closed. + * + * @return void + */ public function close() { $this->closed = true; } + /** + * Assert that an event got sent. + * + * @param string $name + * @param array $additionalParameters + * @return void + */ public function assertSentEvent(string $name, array $additionalParameters = []) { $event = collect($this->sentData)->firstWhere('event', '=', $name); @@ -41,6 +78,12 @@ class Connection implements ConnectionInterface } } + /** + * Assert that an event got not sent. + * + * @param string $name + * @return void + */ public function assertNotSentEvent(string $name) { $event = collect($this->sentData)->firstWhere('event', '=', $name); @@ -50,6 +93,11 @@ class Connection implements ConnectionInterface ); } + /** + * Assert the connection is closed. + * + * @return void + */ public function assertClosed() { PHPUnit::assertTrue($this->closed);