Skip to content

Commit 1ff626d

Browse files
committed
test: move resetServices before parent::setUp in HTTP test suite to preserve parent mocks
1 parent 58cb61c commit 1ff626d

5 files changed

Lines changed: 7 additions & 11 deletions

File tree

‎tests/system/HTTP/CURLRequestTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ class CURLRequestTest extends CIUnitTestCase
3939

4040
protected function setUp(): void
4141
{
42+
$this->resetServices();
4243
parent::setUp();
4344

44-
$this->resetServices();
4545
Services::injectMock('superglobals', new Superglobals());
4646
$this->request = $this->getRequest();
4747
}

‎tests/system/HTTP/NegotiateTest.php‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ final class NegotiateTest extends CIUnitTestCase
3232

3333
protected function setUp(): void
3434
{
35-
parent::setUp();
36-
3735
$this->resetServices();
36+
parent::setUp();
3837

3938
$config = new App();
4039
$this->request = new IncomingRequest($config, new SiteURI($config), null, new UserAgent());

‎tests/system/HTTP/RedirectResponseTest.php‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ final class RedirectResponseTest extends CIUnitTestCase
4848
#[WithoutErrorHandler]
4949
protected function setUp(): void
5050
{
51-
parent::setUp();
52-
5351
$this->resetServices();
52+
parent::setUp();
5453

5554
Services::injectMock('superglobals', new Superglobals());
5655
service('superglobals')->setServer('REQUEST_METHOD', 'GET');

‎tests/system/HTTP/ResponseTest.php‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,11 @@ final class ResponseTest extends CIUnitTestCase
3737

3838
protected function setUp(): void
3939
{
40-
Services::injectMock('superglobals', new Superglobals());
41-
$this->server = service('superglobals')->getServerArray();
42-
40+
$this->resetServices();
4341
parent::setUp();
4442

45-
$this->resetServices();
43+
Services::injectMock('superglobals', new Superglobals());
44+
$this->server = service('superglobals')->getServerArray();
4645
}
4746

4847
protected function tearDown(): void

‎tests/system/HTTP/UserAgentTest.php‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ final class UserAgentTest extends CIUnitTestCase
3030

3131
protected function setUp(): void
3232
{
33-
parent::setUp();
34-
3533
$this->resetServices();
34+
parent::setUp();
3635

3736
// set a baseline user agent
3837
service('superglobals')->setServer('HTTP_USER_AGENT', $this->_user_agent);

0 commit comments

Comments
 (0)