summaryrefslogtreecommitdiffstats
path: root/tests/lib/AppFramework/Http/RequestTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/AppFramework/Http/RequestTest.php')
-rw-r--r--tests/lib/AppFramework/Http/RequestTest.php104
1 files changed, 52 insertions, 52 deletions
diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php
index be019050e1b..67fef79dcff 100644
--- a/tests/lib/AppFramework/Http/RequestTest.php
+++ b/tests/lib/AppFramework/Http/RequestTest.php
@@ -378,7 +378,7 @@ class RequestTest extends \Test\TestCase {
$this->secureRandom->expects($this->once())
->method('generate')
->with('20')
- ->will($this->returnValue('GeneratedByOwnCloudItself'));
+ ->willReturn('GeneratedByOwnCloudItself');
$request = new Request(
[],
@@ -409,7 +409,7 @@ class RequestTest extends \Test\TestCase {
->expects($this->once())
->method('getSystemValue')
->with('trusted_proxies')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$request = new Request(
[
@@ -433,12 +433,12 @@ class RequestTest extends \Test\TestCase {
->expects($this->at(0))
->method('getSystemValue')
->with('trusted_proxies')
- ->will($this->returnValue(['10.0.0.2']));
+ ->willReturn(['10.0.0.2']);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('forwarded_for_headers')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$request = new Request(
[
@@ -462,12 +462,12 @@ class RequestTest extends \Test\TestCase {
->expects($this->at(0))
->method('getSystemValue')
->with('trusted_proxies')
- ->will($this->returnValue(['10.0.0.2']));
+ ->willReturn(['10.0.0.2']);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('forwarded_for_headers')
- ->will($this->returnValue(['HTTP_X_FORWARDED']));
+ ->willReturn(['HTTP_X_FORWARDED']);
$request = new Request(
[
@@ -491,12 +491,12 @@ class RequestTest extends \Test\TestCase {
->expects($this->at(0))
->method('getSystemValue')
->with('trusted_proxies')
- ->will($this->returnValue(['2001:db8:85a3:8d3:1319:8a2e:370:7348']));
+ ->willReturn(['2001:db8:85a3:8d3:1319:8a2e:370:7348']);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('forwarded_for_headers')
- ->will($this->returnValue(['HTTP_X_FORWARDED']));
+ ->willReturn(['HTTP_X_FORWARDED']);
$request = new Request(
[
@@ -520,16 +520,16 @@ class RequestTest extends \Test\TestCase {
->expects($this->at(0))
->method('getSystemValue')
->with('trusted_proxies')
- ->will($this->returnValue(['10.0.0.2']));
+ ->willReturn(['10.0.0.2']);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('forwarded_for_headers')
- ->will($this->returnValue([
+ ->willReturn([
'HTTP_CLIENT_IP',
'HTTP_X_FORWARDED_FOR',
'HTTP_X_FORWARDED'
- ]));
+ ]);
$request = new Request(
[
@@ -553,16 +553,16 @@ class RequestTest extends \Test\TestCase {
->expects($this->at(0))
->method('getSystemValue')
->with('trusted_proxies')
- ->will($this->returnValue(['2001:db8:85a3:8d3:1319:8a2e:370:7348']));
+ ->willReturn(['2001:db8:85a3:8d3:1319:8a2e:370:7348']);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('forwarded_for_headers')
- ->will($this->returnValue([
+ ->willReturn([
'HTTP_CLIENT_IP',
'HTTP_X_FORWARDED_FOR',
'HTTP_X_FORWARDED'
- ]));
+ ]);
$request = new Request(
[
@@ -586,12 +586,12 @@ class RequestTest extends \Test\TestCase {
->expects($this->at(0))
->method('getSystemValue')
->with('trusted_proxies')
- ->will($this->returnValue(['192.168.2.0/24']));
+ ->willReturn(['192.168.2.0/24']);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('forwarded_for_headers')
- ->will($this->returnValue(['HTTP_X_FORWARDED_FOR']));
+ ->willReturn(['HTTP_X_FORWARDED_FOR']);
$request = new Request(
[
@@ -615,7 +615,7 @@ class RequestTest extends \Test\TestCase {
->expects($this->once())
->method('getSystemValue')
->with('trusted_proxies')
- ->will($this->returnValue(['192.168.2.0/24']));
+ ->willReturn(['192.168.2.0/24']);
$request = new Request(
[
@@ -690,17 +690,17 @@ class RequestTest extends \Test\TestCase {
->expects($this->at(0))
->method('getSystemValue')
->with('overwriteprotocol')
- ->will($this->returnValue('customProtocol'));
+ ->willReturn('customProtocol');
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('overwritecondaddr')
- ->will($this->returnValue(''));
+ ->willReturn('');
$this->config
->expects($this->at(2))
->method('getSystemValue')
->with('overwriteprotocol')
- ->will($this->returnValue('customProtocol'));
+ ->willReturn('customProtocol');
$request = new Request(
[],
@@ -716,13 +716,13 @@ class RequestTest extends \Test\TestCase {
public function testGetServerProtocolWithProtoValid() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
}
return $default;
- }));
+ });
$requestHttps = new Request(
[
@@ -757,9 +757,9 @@ class RequestTest extends \Test\TestCase {
public function testGetServerProtocolWithHttpsServerValueOn() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
return $default;
- }));
+ });
$request = new Request(
[
@@ -778,9 +778,9 @@ class RequestTest extends \Test\TestCase {
public function testGetServerProtocolWithHttpsServerValueOff() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
return $default;
- }));
+ });
$request = new Request(
[
@@ -799,9 +799,9 @@ class RequestTest extends \Test\TestCase {
public function testGetServerProtocolWithHttpsServerValueEmpty() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
return $default;
- }));
+ });
$request = new Request(
[
@@ -820,9 +820,9 @@ class RequestTest extends \Test\TestCase {
public function testGetServerProtocolDefault() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
return $default;
- }));
+ });
$request = new Request(
[],
@@ -837,13 +837,13 @@ class RequestTest extends \Test\TestCase {
public function testGetServerProtocolBehindLoadBalancers() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
}
return $default;
- }));
+ });
$request = new Request(
[
@@ -1059,13 +1059,13 @@ class RequestTest extends \Test\TestCase {
public function testInsecureServerHostHttpFromForwardedHeaderSingle() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
}
return $default;
- }));
+ });
$request = new Request(
[
@@ -1088,13 +1088,13 @@ class RequestTest extends \Test\TestCase {
public function testInsecureServerHostHttpFromForwardedHeaderStacked() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
}
return $default;
- }));
+ });
$request = new Request(
[
@@ -1117,7 +1117,7 @@ class RequestTest extends \Test\TestCase {
public function testGetServerHostWithOverwriteHost() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
if ($key === 'overwritecondaddr') {
return '';
} else if ($key === 'overwritehost') {
@@ -1125,7 +1125,7 @@ class RequestTest extends \Test\TestCase {
}
return $default;
- }));
+ });
$request = new Request(
[],
@@ -1141,7 +1141,7 @@ class RequestTest extends \Test\TestCase {
public function testGetServerHostWithTrustedDomain() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
} else if ($key === 'trusted_domains') {
@@ -1149,7 +1149,7 @@ class RequestTest extends \Test\TestCase {
}
return $default;
- }));
+ });
$request = new Request(
[
@@ -1170,7 +1170,7 @@ class RequestTest extends \Test\TestCase {
public function testGetServerHostWithUntrustedDomain() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
} else if ($key === 'trusted_domains') {
@@ -1178,7 +1178,7 @@ class RequestTest extends \Test\TestCase {
}
return $default;
- }));
+ });
$request = new Request(
[
@@ -1199,12 +1199,12 @@ class RequestTest extends \Test\TestCase {
public function testGetServerHostWithNoTrustedDomain() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
}
return $default;
- }));
+ });
$request = new Request(
[
@@ -1273,7 +1273,7 @@ class RequestTest extends \Test\TestCase {
->expects($this->once())
->method('getSystemValue')
->with('overwritehost')
- ->will($this->returnValue(''));
+ ->willReturn('');
$request = new Request(
[],
$this->secureRandom,
@@ -1290,17 +1290,17 @@ class RequestTest extends \Test\TestCase {
->expects($this->at(0))
->method('getSystemValue')
->with('overwritehost')
- ->will($this->returnValue('www.owncloud.org'));
+ ->willReturn('www.owncloud.org');
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('overwritecondaddr')
- ->will($this->returnValue(''));
+ ->willReturn('');
$this->config
->expects($this->at(2))
->method('getSystemValue')
->with('overwritehost')
- ->will($this->returnValue('www.owncloud.org'));
+ ->willReturn('www.owncloud.org');
$request = new Request(
[],
@@ -1485,7 +1485,7 @@ class RequestTest extends \Test\TestCase {
->expects($this->once())
->method('getSystemValue')
->with('overwritewebroot')
- ->will($this->returnValue(''));
+ ->willReturn('');
$request = new Request(
[
@@ -1517,12 +1517,12 @@ class RequestTest extends \Test\TestCase {
->expects($this->at(0))
->method('getSystemValue')
->with('overwritewebroot')
- ->will($this->returnValue($overwriteWebRoot));
+ ->willReturn($overwriteWebRoot);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('overwritecondaddr')
- ->will($this->returnValue($overwriteCondAddr));
+ ->willReturn($overwriteCondAddr);
$request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
->setMethods(['getScriptName'])
@@ -1542,7 +1542,7 @@ class RequestTest extends \Test\TestCase {
$request
->expects($this->once())
->method('getScriptName')
- ->will($this->returnValue('/scriptname.php'));
+ ->willReturn('/scriptname.php');
$this->assertSame($expectedUri, $request->getRequestUri());
}