Fix tests
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
01f4c75505
commit
5ba13dd0e4
|
@ -24,12 +24,16 @@ namespace OCA\UpdateNotification\Tests\Notification;
|
||||||
|
|
||||||
|
|
||||||
use OCA\UpdateNotification\Notification\Notifier;
|
use OCA\UpdateNotification\Notification\Notifier;
|
||||||
|
use OCP\IURLGenerator;
|
||||||
use OCP\L10N\IFactory;
|
use OCP\L10N\IFactory;
|
||||||
use OCP\Notification\IManager;
|
use OCP\Notification\IManager;
|
||||||
|
use OCP\Notification\INotification;
|
||||||
use Test\TestCase;
|
use Test\TestCase;
|
||||||
|
|
||||||
class NotifierTest extends TestCase {
|
class NotifierTest extends TestCase {
|
||||||
|
|
||||||
|
/** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
|
||||||
|
protected $urlGenerator;
|
||||||
/** @var IManager|\PHPUnit_Framework_MockObject_MockObject */
|
/** @var IManager|\PHPUnit_Framework_MockObject_MockObject */
|
||||||
protected $notificationManager;
|
protected $notificationManager;
|
||||||
/** @var IFactory|\PHPUnit_Framework_MockObject_MockObject */
|
/** @var IFactory|\PHPUnit_Framework_MockObject_MockObject */
|
||||||
|
@ -38,8 +42,9 @@ class NotifierTest extends TestCase {
|
||||||
public function setUp() {
|
public function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->notificationManager = $this->getMockBuilder('OCP\Notification\IManager')->getMock();
|
$this->urlGenerator = $this->createMock(IURLGenerator::class);
|
||||||
$this->l10nFactory = $this->getMockBuilder('OCP\L10n\IFactory')->getMock();
|
$this->notificationManager = $this->createMock(IManager::class);
|
||||||
|
$this->l10nFactory = $this->createMock(IFactory::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,12 +54,14 @@ class NotifierTest extends TestCase {
|
||||||
protected function getNotifier(array $methods = []) {
|
protected function getNotifier(array $methods = []) {
|
||||||
if (empty($methods)) {
|
if (empty($methods)) {
|
||||||
return new Notifier(
|
return new Notifier(
|
||||||
|
$this->urlGenerator,
|
||||||
$this->notificationManager,
|
$this->notificationManager,
|
||||||
$this->l10nFactory
|
$this->l10nFactory
|
||||||
);
|
);
|
||||||
} {
|
} {
|
||||||
return $this->getMockBuilder('OCA\UpdateNotification\Notification\Notifier')
|
return $this->getMockBuilder(Notifier::class)
|
||||||
->setConstructorArgs([
|
->setConstructorArgs([
|
||||||
|
$this->urlGenerator,
|
||||||
$this->notificationManager,
|
$this->notificationManager,
|
||||||
$this->l10nFactory,
|
$this->l10nFactory,
|
||||||
])
|
])
|
||||||
|
@ -81,7 +88,7 @@ class NotifierTest extends TestCase {
|
||||||
public function testUpdateAlreadyInstalledCheck($versionNotification, $versionInstalled, $exception) {
|
public function testUpdateAlreadyInstalledCheck($versionNotification, $versionInstalled, $exception) {
|
||||||
$notifier = $this->getNotifier();
|
$notifier = $this->getNotifier();
|
||||||
|
|
||||||
$notification = $this->getMockBuilder('OCP\Notification\INotification')->getMock();
|
$notification = $this->createMock(INotification::class);
|
||||||
$notification->expects($this->once())
|
$notification->expects($this->once())
|
||||||
->method('getObjectId')
|
->method('getObjectId')
|
||||||
->willReturn($versionNotification);
|
->willReturn($versionNotification);
|
||||||
|
|
Loading…
Reference in New Issue