Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
  • Loading branch information
schiessle committed Apr 19, 2017
1 parent 0e2b86a commit 0ac94b1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
6 changes: 0 additions & 6 deletions apps/sharebymail/lib/ShareByMailProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,6 @@ protected function sendMailNotification($filename,
$initiatorUser = $this->userManager->get($initiator);
$ownerDisplayName = ($ownerUser instanceof IUser) ? $ownerUser->getDisplayName() : $owner;
$initiatorDisplayName = ($initiatorUser instanceof IUser) ? $initiatorUser->getDisplayName() : $initiator;
$initiatorEmailAddress = ($initiatorUser instanceof IUser) ? $initiatorUser->getEMailAddress() : null;
if ($owner === $initiator) {
$subject = (string)$this->l->t('%s shared »%s« with you', array($ownerDisplayName, $filename));
} else {
Expand All @@ -408,11 +407,6 @@ protected function sendMailNotification($filename,
$link
);

$emailTemplate->addFooter();
if ($initiatorEmailAddress !== null) {
$message->setFrom([$initiatorEmailAddress => $initiatorDisplayName]);
}

$message->setTo([$shareWith]);

// The "From" contains the sharers name
Expand Down
8 changes: 4 additions & 4 deletions apps/sharebymail/tests/ShareByMailProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,11 @@ public function testCreate() {
$node = $this->getMockBuilder(File::class)->getMock();
$node->expects($this->any())->method('getName')->willReturn('filename');

$instance = $this->getInstance(['getSharedWith', 'createMailShare', 'getRawShare', 'createShareObject', 'createActivity', 'sendPassword']);
$instance = $this->getInstance(['getSharedWith', 'createMailShare', 'getRawShare', 'createShareObject', 'createShareActivity', 'sendPassword']);

$instance->expects($this->once())->method('getSharedWith')->willReturn([]);
$instance->expects($this->once())->method('createMailShare')->with($share)->willReturn(42);
$instance->expects($this->once())->method('createActivity')->with($share);
$instance->expects($this->once())->method('createShareActivity')->with($share);
$instance->expects($this->once())->method('getRawShare')->with(42)->willReturn('rawShare');
$instance->expects($this->once())->method('createShareObject')->with('rawShare')->willReturn('shareObject');
$instance->expects($this->any())->method('sendPassword')->willReturn(true);
Expand Down Expand Up @@ -661,7 +661,7 @@ public function testGetSharesInFolder() {
$userManager = \OC::$server->getUserManager();
$rootFolder = \OC::$server->getRootFolder();

$provider = $this->getInstance(['sendMailNotification', 'createActivity']);
$provider = $this->getInstance(['sendMailNotification', 'createShareActivity']);

$u1 = $userManager->createUser('testFed', md5(time()));
$u2 = $userManager->createUser('testFed2', md5(time()));
Expand Down Expand Up @@ -703,7 +703,7 @@ public function testGetAccessList() {
$userManager = \OC::$server->getUserManager();
$rootFolder = \OC::$server->getRootFolder();

$provider = $this->getInstance(['sendMailNotification', 'createActivity']);
$provider = $this->getInstance(['sendMailNotification', 'createShareActivity']);

$u1 = $userManager->createUser('testFed', md5(time()));
$u2 = $userManager->createUser('testFed2', md5(time()));
Expand Down

0 comments on commit 0ac94b1

Please sign in to comment.