From 4076d2f4e49731223c57f0d944421a4a716f398d Mon Sep 17 00:00:00 2001 From: tianfenghan Date: Tue, 26 May 2026 12:54:49 +0800 Subject: [PATCH] =?UTF-8?q?test(stream):=20=E6=B7=BB=E5=8A=A0=E6=B5=81?= =?UTF-8?q?=E6=89=A9=E5=B1=95=E6=96=B9=E6=B3=95=E6=94=AF=E6=8C=81=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 stream_read_chunk 扩展方法测试用例 - 新增 stream_count_lines 扩展方法测试用例 - 验证 readChunk() 方法功能正确性 - 验证 countLines() 方法功能正确性 - 包含临时文件创建和清理测试流程 --- tests/aot/stream_method/extension.phpt | 51 ++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 tests/aot/stream_method/extension.phpt diff --git a/tests/aot/stream_method/extension.phpt b/tests/aot/stream_method/extension.phpt new file mode 100644 index 00000000..7a89ab7a --- /dev/null +++ b/tests/aot/stream_method/extension.phpt @@ -0,0 +1,51 @@ +--TEST-- +stream extension method support +--FILE-- +write("hello world"); + $fp->seek(0); + Assert::eq($fp->readChunk(5), "hello"); + $fp->close(); + + // Test 2: stream_count_lines extension → countLines() + $fp2 = fopen($tmpfile, 'w+'); + $fp2->write("line1\nline2\nline3"); + $fp2->seek(0); + Assert::eq($fp2->countLines(), 3); + $fp2->close(); + + unlink($tmpfile); + echo "OK\n"; +} +?> +--EXPECT-- +OK