Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Stream/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Stream implements StreamInterface, Stringable
*/
public function __construct(protected string $stream = 'php://memory', protected string $mode = 'w+b')
{
$this->resource = fopen($stream, $this->mode);
$this->resource = @fopen($stream, $this->mode);

if (!$this->resource) {
throw new RuntimeException("Unable to open stream: $stream with mode: $mode");
Expand Down
3 changes: 3 additions & 0 deletions tests/request/SwooleServerRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use FastD\Http\Request\SwooleServerRequest;
use FastD\Http\Request\ServerRequest;
use FastD\Http\Stream\Stream;
use PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations;
use PHPUnit\Framework\TestCase;

/**
Expand Down Expand Up @@ -55,6 +56,7 @@ public function testCanInstantiate()
/**
* 验证SwooleServerRequest扩展了ServerRequest
*/
#[AllowMockObjectsWithoutExpectations]
public function testExtendsServerRequest()
{
// 由于SwooleServerRequest继承自ServerRequest,我们验证继承关系
Expand Down Expand Up @@ -149,6 +151,7 @@ public function testInheritedMethods()
/**
* 测试类的不可变性 - with方法应该返回新实例
*/
#[AllowMockObjectsWithoutExpectations]
public function testImmutableWithMethods()
{
// 创建一个模拟的SwooleServerRequest实例(通过反射绕过Swoole依赖)
Expand Down
2 changes: 2 additions & 0 deletions tests/request/UploadedFileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types=1);

use FastD\Http\Request\UploadedFile;
use PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\StreamInterface;

Expand Down Expand Up @@ -781,6 +782,7 @@ public function testVariousMediaTypes(): void

// ===== 构造函数带Stream测试 =====

#[AllowMockObjectsWithoutExpectations]
public function testConstructorWithProvidedStream(): void
{
$mockStream = $this->createMock(StreamInterface::class);
Expand Down
Loading