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