diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-01-12 14:15:12 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-01-17 09:51:31 +0100 |
commit | 4ef302c0be2047f78b1aa3976eba003a2c280f64 (patch) | |
tree | 51b5c301126eebc6d6db91095e8cc7f2166b3324 /tests/Core | |
parent | 22b3280ac2b60e52049a07ada007768e3cef05ed (diff) | |
download | nextcloud-server-4ef302c0be2047f78b1aa3976eba003a2c280f64.tar.gz nextcloud-server-4ef302c0be2047f78b1aa3976eba003a2c280f64.zip |
Request->getHeader() should always return a string
PHPDoc (of the public API) says that this method returns string but it also returns null, which is not allowed in some method calls. This fixes that behaviour and returns an empty string and fixes all code paths that explicitly checked for null to be still compliant.
Found while enabling the strict_typing for lib/private for the PHP7+ migration.
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'tests/Core')
-rw-r--r-- | tests/Core/Controller/ClientFlowLoginControllerTest.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/Core/Controller/ClientFlowLoginControllerTest.php b/tests/Core/Controller/ClientFlowLoginControllerTest.php index 0e048538223..7fe87df026f 100644 --- a/tests/Core/Controller/ClientFlowLoginControllerTest.php +++ b/tests/Core/Controller/ClientFlowLoginControllerTest.php @@ -431,6 +431,10 @@ class ClientFlowLoginControllerTest extends TestCase { ->expects($this->once()) ->method('getServerHost') ->willReturn('example.com'); + $this->request + ->expects($this->any()) + ->method('getHeader') + ->willReturn(''); $expected = new Http\RedirectResponse('nc://login/server:http://example.com&user:MyLoginName&password:MyGeneratedToken'); $this->assertEquals($expected, $this->clientFlowLoginController->generateAppPassword('MyStateToken')); @@ -583,6 +587,10 @@ class ClientFlowLoginControllerTest extends TestCase { ->expects($this->once()) ->method('getServerHost') ->willReturn('example.com'); + $this->request + ->expects($this->any()) + ->method('getHeader') + ->willReturn(''); $expected = new Http\RedirectResponse('nc://login/server:http://example.com&user:MyLoginName&password:MyGeneratedToken'); $this->assertEquals($expected, $this->clientFlowLoginController->generateAppPassword('MyStateToken')); @@ -594,6 +602,7 @@ class ClientFlowLoginControllerTest extends TestCase { [ ['X-Forwarded-Proto', 'http'], ['X-Forwarded-Ssl', 'off'], + ['USER_AGENT', ''], ], 'http', 'http', @@ -602,6 +611,7 @@ class ClientFlowLoginControllerTest extends TestCase { [ ['X-Forwarded-Proto', 'http'], ['X-Forwarded-Ssl', 'off'], + ['USER_AGENT', ''], ], 'https', 'https', @@ -610,6 +620,7 @@ class ClientFlowLoginControllerTest extends TestCase { [ ['X-Forwarded-Proto', 'https'], ['X-Forwarded-Ssl', 'off'], + ['USER_AGENT', ''], ], 'http', 'https', @@ -618,6 +629,7 @@ class ClientFlowLoginControllerTest extends TestCase { [ ['X-Forwarded-Proto', 'https'], ['X-Forwarded-Ssl', 'on'], + ['USER_AGENT', ''], ], 'http', 'https', @@ -626,6 +638,7 @@ class ClientFlowLoginControllerTest extends TestCase { [ ['X-Forwarded-Proto', 'http'], ['X-Forwarded-Ssl', 'on'], + ['USER_AGENT', ''], ], 'http', 'https', |