Code Duplication    Length = 32-32 lines in 2 locations

tests/settings/controller/CheckSetupControllerTest.php 2 locations

@@ 454-485 (lines=32) @@
451
		$this->assertSame('', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated'));
452
	}
453
454
	public function testIsBuggyNss400() {
455
		$this->config->expects($this->any())
456
			->method('getSystemValue')
457
			->will($this->returnValue(true));
458
		$this->checkSetupController
459
			->expects($this->once())
460
			->method('getCurlVersion')
461
			->will($this->returnValue(['ssl_version' => 'NSS/1.0.2b']));
462
		$client = $this->getMockBuilder('\OCP\Http\Client\IClient')
463
			->disableOriginalConstructor()->getMock();
464
		$exception = $this->getMockBuilder('\GuzzleHttp\Exception\ClientException')
465
			->disableOriginalConstructor()->getMock();
466
		$response = $this->getMockBuilder('\GuzzleHttp\Message\ResponseInterface')
467
			->disableOriginalConstructor()->getMock();
468
		$response->expects($this->once())
469
			->method('getStatusCode')
470
			->will($this->returnValue(400));
471
		$exception->expects($this->once())
472
			->method('getResponse')
473
			->will($this->returnValue($response));
474
475
		$client->expects($this->at(0))
476
			->method('get')
477
			->with('https://www.owncloud.org/', [])
478
			->will($this->throwException($exception));
479
480
		$this->clientService->expects($this->once())
481
			->method('newClient')
482
			->will($this->returnValue($client));
483
484
		$this->assertSame('cURL is using an outdated NSS version (NSS/1.0.2b). Please update your operating system or features such as installing and updating apps via the app store or Federated Cloud Sharing will not work reliably.', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated'));
485
	}
486
487
488
	public function testIsBuggyNss200() {
@@ 488-519 (lines=32) @@
485
	}
486
487
488
	public function testIsBuggyNss200() {
489
		$this->config->expects($this->any())
490
			->method('getSystemValue')
491
			->will($this->returnValue(true));
492
		$this->checkSetupController
493
			->expects($this->once())
494
			->method('getCurlVersion')
495
			->will($this->returnValue(['ssl_version' => 'NSS/1.0.2b']));
496
		$client = $this->getMockBuilder('\OCP\Http\Client\IClient')
497
			->disableOriginalConstructor()->getMock();
498
		$exception = $this->getMockBuilder('\GuzzleHttp\Exception\ClientException')
499
			->disableOriginalConstructor()->getMock();
500
		$response = $this->getMockBuilder('\GuzzleHttp\Message\ResponseInterface')
501
			->disableOriginalConstructor()->getMock();
502
		$response->expects($this->once())
503
			->method('getStatusCode')
504
			->will($this->returnValue(200));
505
		$exception->expects($this->once())
506
			->method('getResponse')
507
			->will($this->returnValue($response));
508
509
		$client->expects($this->at(0))
510
			->method('get')
511
			->with('https://www.owncloud.org/', [])
512
			->will($this->throwException($exception));
513
514
		$this->clientService->expects($this->once())
515
			->method('newClient')
516
			->will($this->returnValue($client));
517
518
		$this->assertSame('', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated'));
519
	}
520
521
	public function testIsUsedTlsLibOutdatedWithInternetDisabled() {
522
		$this->config