Skip to content

Commit b40dc6a

Browse files
author
Greg Bowler
committed
Test creating response class with default accept header
1 parent 43267d1 commit b40dc6a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/unit/ResponseFactoryTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,21 @@ public function testCreateAfterRegisteringResponseClass() {
4444
ResponseFactory::create($request)
4545
);
4646
}
47+
48+
public function testRegisterResponseClassDefault() {
49+
$mockResponseClass = self::getMockClass(Response::class);
50+
/** @var MockObject|Request $request */
51+
$request = self::createMock(Request::class);
52+
$request->method("getHeaderLine")
53+
->with("accept")
54+
->willReturn(ResponseFactory::DEFAULT_ACCEPT);
55+
ResponseFactory::registerResponseClass(
56+
$mockResponseClass
57+
);
58+
59+
self::assertInstanceOf(
60+
$mockResponseClass,
61+
ResponseFactory::create($request)
62+
);
63+
}
4764
}

0 commit comments

Comments
 (0)