From bc5f5bd99e370c2b8160aaf1ba2fc7810cf20dd9 Mon Sep 17 00:00:00 2001 From: james Date: Thu, 12 Jun 2025 11:15:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=A0=E7=9A=84=E6=8F=90=E4=BA=A4=E8=AF=B4?= =?UTF-8?q?=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/Test.php | 53 +------------------------------------------------- tests/fff.php | 1 + 2 files changed, 2 insertions(+), 52 deletions(-) create mode 100644 tests/fff.php diff --git a/tests/Test.php b/tests/Test.php index 59e4037..8f483ff 100644 --- a/tests/Test.php +++ b/tests/Test.php @@ -1,53 +1,2 @@ -handler = new MyWebSocketHandler(); - } - - public function testOnConnect() - { - $connection = $this->createMock(TcpConnection::class); - $worker = $this->createMock(Worker::class); - - // 使用 ob_start + ob_get_clean 捕获输出 - ob_start(); - $this->handler->onConnect($connection); - $output = ob_get_clean(); - - $this->assertStringContainsString('New connection', $output); - } - - public function testOnMessage() - { - $connection = $this->createMock(TcpConnection::class); - $connection->expects($this->once()) - ->method('send') - ->with($this->equalTo('Hello world')); - - $this->handler->onMessage($connection, 'world'); - } - - public function testOnClose() - { - $connection = $this->createMock(TcpConnection::class); - - ob_start(); - $this->handler->onClose($connection); - $output = ob_get_clean(); - - $this->assertStringContainsString('Connection closed', $output); - } -} \ No newline at end of file diff --git a/tests/fff.php b/tests/fff.php new file mode 100644 index 0000000..48cb23c --- /dev/null +++ b/tests/fff.php @@ -0,0 +1 @@ +fffffffff