Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix getMock Share
  • Loading branch information
rullzer committed Sep 7, 2016
commit 80c519fe89857cfead7344025f2123e3b69665a8
9 changes: 6 additions & 3 deletions tests/lib/Share/MailNotificationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function setUp() {
->disableOriginalConstructor()->getMock();
$this->user = $this->getMockBuilder('\OCP\IUser')
->disableOriginalConstructor()->getMock();
$this->urlGenerator = $this->getMock('\OCP\IURLGenerator');
$this->urlGenerator = $this->createMock(IURLGenerator::class);

$this->l10n->expects($this->any())
->method('t')
Expand Down Expand Up @@ -212,14 +212,17 @@ public function testSendInternalShareMail() {
$this->setupMailerMock('TestUser shared »welcome.txt« with you', ['[email protected]' => 'Recipient'], false);

/** @var MailNotifications | \PHPUnit_Framework_MockObject_MockObject $mailNotifications */
$mailNotifications = $this->getMock('OC\Share\MailNotifications',['getItemSharedWithUser'], [
$mailNotifications = $this->getMockBuilder(MailNotifications::class)
->setMethods(['getItemSharedWithUser'])
->setConstructorArgs([
$this->user,
$this->l10n,
$this->mailer,
$this->logger,
$this->defaults,
$this->urlGenerator
]);
])
->getMock();

$mailNotifications->method('getItemSharedWithUser')
->withAnyParameters()
Expand Down
5 changes: 3 additions & 2 deletions tests/lib/Share20/ShareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
namespace Test\Share20;

use OCP\Files\IRootFolder;
use OCP\IUserManager;

/**
* Class ShareTest
Expand All @@ -35,8 +36,8 @@ class ShareTest extends \Test\TestCase {
protected $share;

public function setUp() {
$this->rootFolder = $this->getMock('\OCP\Files\IRootFolder');
$this->userManager = $this->getMock('OCP\IUserManager');
$this->rootFolder = $this->createMock(IRootFolder::class);
$this->userManager = $this->createMock(IUserManager::class);
$this->share = new \OC\Share20\Share($this->rootFolder, $this->userManager);
}

Expand Down