From 078f4efb20f269394e5f60fe327ba36c0279d77e Mon Sep 17 00:00:00 2001
From: Roeland Jago Douma <roeland@famdouma.nl>
Date: Wed, 27 Nov 2019 14:51:14 +0100
Subject: [PATCH] Fix tests

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
---
 .../tests/Settings/Admin/SharingTest.php      | 40 ++++++++++++++++++-
 tests/lib/Share20/ManagerTest.php             |  3 +-
 2 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/apps/settings/tests/Settings/Admin/SharingTest.php b/apps/settings/tests/Settings/Admin/SharingTest.php
index 91b2edf14b1..817d7eae54f 100644
--- a/apps/settings/tests/Settings/Admin/SharingTest.php
+++ b/apps/settings/tests/Settings/Admin/SharingTest.php
@@ -131,6 +131,21 @@ class SharingTest extends TestCase {
 			->method('getAppValue')
 			->with('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL)
 			->willReturn(Constants::PERMISSION_ALL);
+		$this->config
+			->expects($this->at(14))
+			->method('getAppValue')
+			->with('core', 'shareapi_default_internal_expire_date', 'no')
+			->willReturn('no');
+		$this->config
+			->expects($this->at(15))
+			->method('getAppValue')
+			->with('core', 'shareapi_internal_expire_after_n_days', '7')
+			->willReturn('7');
+		$this->config
+			->expects($this->at(16))
+			->method('getAppValue')
+			->with('core', 'shareapi_enforce_internal_expire_date', 'no')
+			->willReturn('no');
 
 		$expected = new TemplateResponse(
 			'settings',
@@ -152,7 +167,10 @@ class SharingTest extends TestCase {
 				'publicShareDisclaimerText'       => 'Lorem ipsum',
 				'enableLinkPasswordByDefault'     => 'yes',
 				'shareApiDefaultPermissions'      => Constants::PERMISSION_ALL,
-				'shareApiDefaultPermissionsCheckboxes' => $this->invokePrivate($this->admin, 'getSharePermissionList', [])
+				'shareApiDefaultPermissionsCheckboxes' => $this->invokePrivate($this->admin, 'getSharePermissionList', []),
+				'shareDefaultInternalExpireDateSet' => 'no',
+				'shareInternalExpireAfterNDays' => '7',
+				'shareInternalEnforceExpireDate' => 'no',
 			],
 			''
 		);
@@ -231,6 +249,21 @@ class SharingTest extends TestCase {
 			->method('getAppValue')
 			->with('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL)
 			->willReturn(Constants::PERMISSION_ALL);
+		$this->config
+			->expects($this->at(14))
+			->method('getAppValue')
+			->with('core', 'shareapi_default_internal_expire_date', 'no')
+			->willReturn('no');
+		$this->config
+			->expects($this->at(15))
+			->method('getAppValue')
+			->with('core', 'shareapi_internal_expire_after_n_days', '7')
+			->willReturn('7');
+		$this->config
+			->expects($this->at(16))
+			->method('getAppValue')
+			->with('core', 'shareapi_enforce_internal_expire_date', 'no')
+			->willReturn('no');
 
 
 		$expected = new TemplateResponse(
@@ -253,7 +286,10 @@ class SharingTest extends TestCase {
 				'publicShareDisclaimerText'       => 'Lorem ipsum',
 				'enableLinkPasswordByDefault'     => 'yes',
 				'shareApiDefaultPermissions'      => Constants::PERMISSION_ALL,
-				'shareApiDefaultPermissionsCheckboxes' => $this->invokePrivate($this->admin, 'getSharePermissionList', [])
+				'shareApiDefaultPermissionsCheckboxes' => $this->invokePrivate($this->admin, 'getSharePermissionList', []),
+				'shareDefaultInternalExpireDateSet' => 'no',
+				'shareInternalExpireAfterNDays' => '7',
+				'shareInternalEnforceExpireDate' => 'no',
 			],
 			''
 		);
diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php
index 3e34a64acf3..9b8798b2a56 100644
--- a/tests/lib/Share20/ManagerTest.php
+++ b/tests/lib/Share20/ManagerTest.php
@@ -1743,7 +1743,8 @@ class ManagerTest extends \Test\TestCase {
 			->with($path);
 		$manager->expects($this->once())
 			->method('validateExpirationDate')
-			->with($share);
+			->with($share)
+			->willReturn($share);
 		$manager->expects($this->once())
 			->method('verifyPassword')
 			->with('password');
-- 
GitLab