Code Duplication    Length = 10-12 lines in 7 locations

tests/settings/controller/CheckSetupControllerTest.php 7 locations

@@ 375-384 (lines=10) @@
372
		$this->assertArrayHasKey('ssl_version', $this->invokePrivate($checkSetupController, 'getCurlVersion'));
373
	}
374
375
	public function testIsUsedTlsLibOutdatedWithAnotherLibrary() {
376
		$this->config->expects($this->any())
377
			->method('getSystemValue')
378
			->will($this->returnValue(true));
379
		$this->checkSetupController
380
			->expects($this->once())
381
			->method('getCurlVersion')
382
			->will($this->returnValue(['ssl_version' => 'SSLlib']));
383
		$this->assertSame('', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated'));
384
	}
385
386
	public function testIsUsedTlsLibOutdatedWithMisbehavingCurl() {
387
		$this->config->expects($this->any())
@@ 386-395 (lines=10) @@
383
		$this->assertSame('', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated'));
384
	}
385
386
	public function testIsUsedTlsLibOutdatedWithMisbehavingCurl() {
387
		$this->config->expects($this->any())
388
			->method('getSystemValue')
389
			->will($this->returnValue(true));
390
		$this->checkSetupController
391
			->expects($this->once())
392
			->method('getCurlVersion')
393
			->will($this->returnValue([]));
394
		$this->assertSame('', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated'));
395
	}
396
397
	public function testIsUsedTlsLibOutdatedWithOlderOpenSsl() {
398
		$this->config->expects($this->any())
@@ 397-406 (lines=10) @@
394
		$this->assertSame('', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated'));
395
	}
396
397
	public function testIsUsedTlsLibOutdatedWithOlderOpenSsl() {
398
		$this->config->expects($this->any())
399
			->method('getSystemValue')
400
			->will($this->returnValue(true));
401
		$this->checkSetupController
402
			->expects($this->once())
403
			->method('getCurlVersion')
404
			->will($this->returnValue(['ssl_version' => 'OpenSSL/1.0.1c']));
405
		$this->assertSame('cURL is using an outdated OpenSSL version (OpenSSL/1.0.1c). 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'));
406
	}
407
408
	public function testIsUsedTlsLibOutdatedWithOlderOpenSslAndWithoutAppstore() {
409
		$this->config
@@ 408-419 (lines=12) @@
405
		$this->assertSame('cURL is using an outdated OpenSSL version (OpenSSL/1.0.1c). 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'));
406
	}
407
408
	public function testIsUsedTlsLibOutdatedWithOlderOpenSslAndWithoutAppstore() {
409
		$this->config
410
			->expects($this->at(0))
411
			->method('getSystemValue')
412
			->with('has_internet_connection', true)
413
			->will($this->returnValue(true));
414
		$this->checkSetupController
415
			->expects($this->once())
416
			->method('getCurlVersion')
417
			->will($this->returnValue(['ssl_version' => 'OpenSSL/1.0.1c']));
418
		$this->assertSame('cURL is using an outdated OpenSSL version (OpenSSL/1.0.1c). Please update your operating system or features such as Federated Cloud Sharing will not work reliably.', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated'));
419
	}
420
421
	public function testIsUsedTlsLibOutdatedWithOlderOpenSsl1() {
422
		$this->config->expects($this->any())
@@ 421-430 (lines=10) @@
418
		$this->assertSame('cURL is using an outdated OpenSSL version (OpenSSL/1.0.1c). Please update your operating system or features such as Federated Cloud Sharing will not work reliably.', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated'));
419
	}
420
421
	public function testIsUsedTlsLibOutdatedWithOlderOpenSsl1() {
422
		$this->config->expects($this->any())
423
			->method('getSystemValue')
424
			->will($this->returnValue(true));
425
		$this->checkSetupController
426
			->expects($this->once())
427
			->method('getCurlVersion')
428
			->will($this->returnValue(['ssl_version' => 'OpenSSL/1.0.2a']));
429
		$this->assertSame('cURL is using an outdated OpenSSL version (OpenSSL/1.0.2a). 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'));
430
	}
431
432
	public function testIsUsedTlsLibOutdatedWithMatchingOpenSslVersion() {
433
		$this->config->expects($this->any())
@@ 432-441 (lines=10) @@
429
		$this->assertSame('cURL is using an outdated OpenSSL version (OpenSSL/1.0.2a). 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'));
430
	}
431
432
	public function testIsUsedTlsLibOutdatedWithMatchingOpenSslVersion() {
433
		$this->config->expects($this->any())
434
			->method('getSystemValue')
435
			->will($this->returnValue(true));
436
		$this->checkSetupController
437
			->expects($this->once())
438
			->method('getCurlVersion')
439
			->will($this->returnValue(['ssl_version' => 'OpenSSL/1.0.1d']));
440
			$this->assertSame('', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated'));
441
	}
442
443
	public function testIsUsedTlsLibOutdatedWithMatchingOpenSslVersion1() {
444
		$this->config->expects($this->any())
@@ 443-452 (lines=10) @@
440
			$this->assertSame('', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated'));
441
	}
442
443
	public function testIsUsedTlsLibOutdatedWithMatchingOpenSslVersion1() {
444
		$this->config->expects($this->any())
445
			->method('getSystemValue')
446
			->will($this->returnValue(true));
447
		$this->checkSetupController
448
			->expects($this->once())
449
			->method('getCurlVersion')
450
			->will($this->returnValue(['ssl_version' => 'OpenSSL/1.0.2b']));
451
		$this->assertSame('', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated'));
452
	}
453
454
	public function testIsBuggyNss400() {
455
		$this->config->expects($this->any())