Fix getMock Share

This commit is contained in:
Roeland Jago Douma 2016-09-07 20:24:06 +02:00
parent 65409f5327
commit 80c519fe89
No known key found for this signature in database
GPG Key ID: 1E152838F164D13B
2 changed files with 9 additions and 5 deletions

View File

@ -60,7 +60,7 @@ class MailNotificationsTest extends \Test\TestCase {
->disableOriginalConstructor()->getMock(); ->disableOriginalConstructor()->getMock();
$this->user = $this->getMockBuilder('\OCP\IUser') $this->user = $this->getMockBuilder('\OCP\IUser')
->disableOriginalConstructor()->getMock(); ->disableOriginalConstructor()->getMock();
$this->urlGenerator = $this->getMock('\OCP\IURLGenerator'); $this->urlGenerator = $this->createMock(IURLGenerator::class);
$this->l10n->expects($this->any()) $this->l10n->expects($this->any())
->method('t') ->method('t')
@ -212,14 +212,17 @@ class MailNotificationsTest extends \Test\TestCase {
$this->setupMailerMock('TestUser shared »welcome.txt« with you', ['recipient@owncloud.com' => 'Recipient'], false); $this->setupMailerMock('TestUser shared »welcome.txt« with you', ['recipient@owncloud.com' => 'Recipient'], false);
/** @var MailNotifications | \PHPUnit_Framework_MockObject_MockObject $mailNotifications */ /** @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->user,
$this->l10n, $this->l10n,
$this->mailer, $this->mailer,
$this->logger, $this->logger,
$this->defaults, $this->defaults,
$this->urlGenerator $this->urlGenerator
]); ])
->getMock();
$mailNotifications->method('getItemSharedWithUser') $mailNotifications->method('getItemSharedWithUser')
->withAnyParameters() ->withAnyParameters()

View File

@ -21,6 +21,7 @@
namespace Test\Share20; namespace Test\Share20;
use OCP\Files\IRootFolder; use OCP\Files\IRootFolder;
use OCP\IUserManager;
/** /**
* Class ShareTest * Class ShareTest
@ -35,8 +36,8 @@ class ShareTest extends \Test\TestCase {
protected $share; protected $share;
public function setUp() { public function setUp() {
$this->rootFolder = $this->getMock('\OCP\Files\IRootFolder'); $this->rootFolder = $this->createMock(IRootFolder::class);
$this->userManager = $this->getMock('OCP\IUserManager'); $this->userManager = $this->createMock(IUserManager::class);
$this->share = new \OC\Share20\Share($this->rootFolder, $this->userManager); $this->share = new \OC\Share20\Share($this->rootFolder, $this->userManager);
} }