Code Duplication    Length = 26-26 lines in 3 locations

tests/lib/appframework/http/RequestTest.php 3 locations

@@ 551-576 (lines=26) @@
548
		$this->assertSame($expected, $request->getHttpProtocol());
549
	}
550
551
	public function testGetServerProtocolWithOverride() {
552
		$this->config
553
			->expects($this->at(0))
554
			->method('getSystemValue')
555
			->with('overwriteprotocol')
556
			->will($this->returnValue('customProtocol'));
557
		$this->config
558
			->expects($this->at(1))
559
			->method('getSystemValue')
560
			->with('overwritecondaddr')
561
			->will($this->returnValue(''));
562
		$this->config
563
			->expects($this->at(2))
564
			->method('getSystemValue')
565
			->with('overwriteprotocol')
566
			->will($this->returnValue('customProtocol'));
567
568
		$request = new Request(
569
			[],
570
			$this->secureRandom,
571
			$this->config,
572
			$this->stream
573
		);
574
575
		$this->assertSame('customProtocol', $request->getServerProtocol());
576
	}
577
578
	public function testGetServerProtocolWithProtoValid() {
579
		$this->config
@@ 864-889 (lines=26) @@
861
		$this->assertSame('from.forwarded.host2:8080',  $request->getInsecureServerHost());
862
	}
863
864
	public function testGetServerHostWithOverwriteHost() {
865
		$this->config
866
			->expects($this->at(0))
867
			->method('getSystemValue')
868
			->with('overwritehost')
869
			->will($this->returnValue('my.overwritten.host'));
870
		$this->config
871
			->expects($this->at(1))
872
			->method('getSystemValue')
873
			->with('overwritecondaddr')
874
			->will($this->returnValue(''));
875
		$this->config
876
			->expects($this->at(2))
877
			->method('getSystemValue')
878
			->with('overwritehost')
879
			->will($this->returnValue('my.overwritten.host'));
880
881
		$request = new Request(
882
			[],
883
			$this->secureRandom,
884
			$this->config,
885
			$this->stream
886
		);
887
888
		$this->assertSame('my.overwritten.host',  $request->getServerHost());
889
	}
890
891
	public function testGetServerHostWithTrustedDomain() {
892
		$this->config
@@ 980-1005 (lines=26) @@
977
		$this->assertNull(self::invokePrivate($request, 'getOverwriteHost'));
978
	}
979
980
	public function testGetOverwriteHostWithOverwrite() {
981
		$this->config
982
			->expects($this->at(0))
983
			->method('getSystemValue')
984
			->with('overwritehost')
985
			->will($this->returnValue('www.owncloud.org'));
986
		$this->config
987
			->expects($this->at(1))
988
			->method('getSystemValue')
989
			->with('overwritecondaddr')
990
			->will($this->returnValue(''));
991
		$this->config
992
			->expects($this->at(2))
993
			->method('getSystemValue')
994
			->with('overwritehost')
995
			->will($this->returnValue('www.owncloud.org'));
996
997
		$request = new Request(
998
			[],
999
			$this->secureRandom,
1000
			$this->config,
1001
			$this->stream
1002
		);
1003
1004
		$this->assertSame('www.owncloud.org', self::invokePrivate($request, 'getOverwriteHost'));
1005
	}
1006
1007
	public function testGetPathInfoWithSetEnv() {
1008
		$request = new Request(