Skip to content

Commit

Permalink
fixes ShareByMailProviderTest.php partialy
Browse files Browse the repository at this point in the history
Signed-off-by: Cyrille Bollu <cyrpub@bollu.be>
  • Loading branch information
StCyr committed Apr 8, 2022
1 parent 231f79b commit 71391aa
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions apps/sharebymail/tests/ShareByMailProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@
*/
class ShareByMailProviderTest extends TestCase {

/** @var IConfig */
private $config;

/** @var IDBConnection */
private $connection;

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -145,6 +149,7 @@ private function getInstance(array $mockedMethods = []) {
$instance = $this->getMockBuilder('OCA\ShareByMail\ShareByMailProvider')
->setConstructorArgs(
[
$this->config,
$this->connection,
$this->secureRandom,
$this->userManager,
Expand All @@ -168,6 +173,7 @@ private function getInstance(array $mockedMethods = []) {
}

return new ShareByMailProvider(
$this->config,
$this->connection,
$this->secureRandom,
$this->userManager,
Expand Down Expand Up @@ -531,6 +537,7 @@ public function testAddShareToDB() {
$hideDownload = true;
$label = 'label';
$expiration = new \DateTime();
$passwordExpirationTime = new \DateTime();


$instance = $this->getInstance();
Expand All @@ -546,6 +553,7 @@ public function testAddShareToDB() {
$permissions,
$token,
$password,
$passwordExpirationTime,
$sendPasswordByTalk,
$hideDownload,
$label,
Expand All @@ -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']);
Expand Down

0 comments on commit 71391aa

Please sign in to comment.