Skip to content

Commit 0744e2f

Browse files
committed
test(HTTP): resolve PHPStan unmatched ignore warnings without altering baseline
1 parent 98372f9 commit 0744e2f

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

tests/system/HTTP/IncomingRequestTest.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,39 @@ public function testIsAJAX(): void
750750
$this->assertTrue($this->request->isAJAX());
751751
}
752752

753+
public function testIsSecureWithHttps(): void
754+
{
755+
service('superglobals')->setServer('HTTPS', 'on');
756+
757+
$this->assertTrue($this->request->isSecure());
758+
$this->request->isSecure();
759+
$this->request->isSecure();
760+
}
761+
762+
public function testIsSecureWithFrontEndHttps(): void
763+
{
764+
service('superglobals')->setServer('REMOTE_ADDR', '10.0.1.200');
765+
$config = new App();
766+
$config->proxyIPs = ['10.0.1.200' => 'Front-End-Https'];
767+
$this->request = $this->createRequest($config);
768+
769+
$this->request->appendHeader('Front-End-Https', 'on');
770+
771+
$this->assertTrue($this->request->isSecure());
772+
}
773+
774+
public function testIsSecureWithXForwardedProto(): void
775+
{
776+
service('superglobals')->setServer('REMOTE_ADDR', '10.0.1.200');
777+
$config = new App();
778+
$config->proxyIPs = ['10.0.1.200' => 'X-Forwarded-Proto'];
779+
$this->request = $this->createRequest($config);
780+
781+
$this->request->appendHeader('X-Forwarded-Proto', 'https');
782+
783+
$this->assertTrue($this->request->isSecure());
784+
}
785+
753786
/**
754787
* @param array<string, string> $server
755788
* @param array<string, string> $proxyIPs

0 commit comments

Comments
 (0)