Browse Source

Fix getMock Share

tags/v11.0RC2
Roeland Jago Douma 7 years ago
parent
commit
80c519fe89
No account linked to committer's email address
2 changed files with 9 additions and 5 deletions
  1. 6
    3
      tests/lib/Share/MailNotificationsTest.php
  2. 3
    2
      tests/lib/Share20/ShareTest.php

+ 6
- 3
tests/lib/Share/MailNotificationsTest.php View File

@@ -60,7 +60,7 @@ class MailNotificationsTest extends \Test\TestCase {
->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')
@@ -212,14 +212,17 @@ class MailNotificationsTest extends \Test\TestCase {
$this->setupMailerMock('TestUser shared »welcome.txt« with you', ['recipient@owncloud.com' => '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()

+ 3
- 2
tests/lib/Share20/ShareTest.php View File

@@ -21,6 +21,7 @@
namespace Test\Share20;

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

/**
* Class ShareTest
@@ -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);
}


Loading…
Cancel
Save