From 71391aa47b4ac154795b3e0640dcff992e22f56b Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Fri, 8 Apr 2022 23:35:38 +0200 Subject: [PATCH] fixes ShareByMailProviderTest.php partialy Signed-off-by: Cyrille Bollu --- apps/sharebymail/tests/ShareByMailProviderTest.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/sharebymail/tests/ShareByMailProviderTest.php b/apps/sharebymail/tests/ShareByMailProviderTest.php index af2d5bad57c03..81ed5719fb20f 100644 --- a/apps/sharebymail/tests/ShareByMailProviderTest.php +++ b/apps/sharebymail/tests/ShareByMailProviderTest.php @@ -63,6 +63,9 @@ */ class ShareByMailProviderTest extends TestCase { + /** @var IConfig */ + private $config; + /** @var IDBConnection */ private $connection; @@ -111,6 +114,7 @@ class ShareByMailProviderTest extends TestCase { protected function setUp(): void { parent::setUp(); + $this->config = $this->getMockBuilder(IConfig::class)->getMock(); $this->connection = \OC::$server->getDatabaseConnection(); $this->l = $this->getMockBuilder(IL10N::class)->getMock(); @@ -145,6 +149,7 @@ private function getInstance(array $mockedMethods = []) { $instance = $this->getMockBuilder('OCA\ShareByMail\ShareByMailProvider') ->setConstructorArgs( [ + $this->config, $this->connection, $this->secureRandom, $this->userManager, @@ -168,6 +173,7 @@ private function getInstance(array $mockedMethods = []) { } return new ShareByMailProvider( + $this->config, $this->connection, $this->secureRandom, $this->userManager, @@ -531,6 +537,7 @@ public function testAddShareToDB() { $hideDownload = true; $label = 'label'; $expiration = new \DateTime(); + $passwordExpirationTime = new \DateTime(); $instance = $this->getInstance(); @@ -546,6 +553,7 @@ public function testAddShareToDB() { $permissions, $token, $password, + $passwordExpirationTime, $sendPasswordByTalk, $hideDownload, $label, @@ -572,6 +580,7 @@ public function testAddShareToDB() { $this->assertSame($permissions, (int)$result[0]['permissions']); $this->assertSame($token, $result[0]['token']); $this->assertSame($password, $result[0]['password']); + $this->assertSame($passwordExpirationTime->getTimestamp(), \DateTime::createFromFormat('Y-m-d H:i:s', $result[0]['password_expiration_time'])->getTimestamp()); $this->assertSame($sendPasswordByTalk, (bool)$result[0]['password_by_talk']); $this->assertSame($hideDownload, (bool)$result[0]['hide_download']); $this->assertSame($label, $result[0]['label']);