|
|
@ -18,6 +18,7 @@ use OCP\ICacheFactory; |
|
|
|
use OCP\IUserManager; |
|
|
|
use OCP\IUserManager; |
|
|
|
use OCP\Notification\IManager; |
|
|
|
use OCP\Notification\IManager; |
|
|
|
use OCP\Notification\INotification; |
|
|
|
use OCP\Notification\INotification; |
|
|
|
|
|
|
|
use OCP\RichObjectStrings\IRichTextFormatter; |
|
|
|
use OCP\RichObjectStrings\IValidator; |
|
|
|
use OCP\RichObjectStrings\IValidator; |
|
|
|
use OCP\Support\Subscription\IRegistry; |
|
|
|
use OCP\Support\Subscription\IRegistry; |
|
|
|
use PHPUnit\Framework\MockObject\MockObject; |
|
|
|
use PHPUnit\Framework\MockObject\MockObject; |
|
|
@ -28,8 +29,8 @@ class ManagerTest extends TestCase { |
|
|
|
/** @var IManager */ |
|
|
|
/** @var IManager */ |
|
|
|
protected $manager; |
|
|
|
protected $manager; |
|
|
|
|
|
|
|
|
|
|
|
/** @var IValidator|MockObject */ |
|
|
|
protected IValidator&MockObject $validator; |
|
|
|
protected $validator; |
|
|
|
protected IRichTextFormatter&MockObject $richTextFormatter; |
|
|
|
/** @var IUserManager|MockObject */ |
|
|
|
/** @var IUserManager|MockObject */ |
|
|
|
protected $userManager; |
|
|
|
protected $userManager; |
|
|
|
/** @var ICacheFactory|MockObject */ |
|
|
|
/** @var ICacheFactory|MockObject */ |
|
|
@ -49,6 +50,7 @@ class ManagerTest extends TestCase { |
|
|
|
parent::setUp(); |
|
|
|
parent::setUp(); |
|
|
|
|
|
|
|
|
|
|
|
$this->validator = $this->createMock(IValidator::class); |
|
|
|
$this->validator = $this->createMock(IValidator::class); |
|
|
|
|
|
|
|
$this->richTextFormatter = $this->createMock(IRichTextFormatter::class); |
|
|
|
$this->userManager = $this->createMock(IUserManager::class); |
|
|
|
$this->userManager = $this->createMock(IUserManager::class); |
|
|
|
$this->cache = $this->createMock(ICache::class); |
|
|
|
$this->cache = $this->createMock(ICache::class); |
|
|
|
$this->subscriptionRegistry = $this->createMock(IRegistry::class); |
|
|
|
$this->subscriptionRegistry = $this->createMock(IRegistry::class); |
|
|
@ -64,7 +66,15 @@ class ManagerTest extends TestCase { |
|
|
|
$this->coordinator->method('getRegistrationContext') |
|
|
|
$this->coordinator->method('getRegistrationContext') |
|
|
|
->willReturn($this->registrationContext); |
|
|
|
->willReturn($this->registrationContext); |
|
|
|
|
|
|
|
|
|
|
|
$this->manager = new Manager($this->validator, $this->userManager, $this->cacheFactory, $this->subscriptionRegistry, $this->logger, $this->coordinator); |
|
|
|
$this->manager = new Manager( |
|
|
|
|
|
|
|
$this->validator, |
|
|
|
|
|
|
|
$this->userManager, |
|
|
|
|
|
|
|
$this->cacheFactory, |
|
|
|
|
|
|
|
$this->subscriptionRegistry, |
|
|
|
|
|
|
|
$this->logger, |
|
|
|
|
|
|
|
$this->coordinator, |
|
|
|
|
|
|
|
$this->richTextFormatter, |
|
|
|
|
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function testRegisterApp(): void { |
|
|
|
public function testRegisterApp(): void { |
|
|
@ -141,6 +151,7 @@ class ManagerTest extends TestCase { |
|
|
|
$this->subscriptionRegistry, |
|
|
|
$this->subscriptionRegistry, |
|
|
|
$this->logger, |
|
|
|
$this->logger, |
|
|
|
$this->coordinator, |
|
|
|
$this->coordinator, |
|
|
|
|
|
|
|
$this->richTextFormatter, |
|
|
|
]) |
|
|
|
]) |
|
|
|
->setMethods(['getApps']) |
|
|
|
->setMethods(['getApps']) |
|
|
|
->getMock(); |
|
|
|
->getMock(); |
|
|
@ -172,6 +183,7 @@ class ManagerTest extends TestCase { |
|
|
|
$this->subscriptionRegistry, |
|
|
|
$this->subscriptionRegistry, |
|
|
|
$this->logger, |
|
|
|
$this->logger, |
|
|
|
$this->coordinator, |
|
|
|
$this->coordinator, |
|
|
|
|
|
|
|
$this->richTextFormatter, |
|
|
|
]) |
|
|
|
]) |
|
|
|
->setMethods(['getApps']) |
|
|
|
->setMethods(['getApps']) |
|
|
|
->getMock(); |
|
|
|
->getMock(); |
|
|
@ -196,6 +208,7 @@ class ManagerTest extends TestCase { |
|
|
|
$this->subscriptionRegistry, |
|
|
|
$this->subscriptionRegistry, |
|
|
|
$this->logger, |
|
|
|
$this->logger, |
|
|
|
$this->coordinator, |
|
|
|
$this->coordinator, |
|
|
|
|
|
|
|
$this->richTextFormatter, |
|
|
|
]) |
|
|
|
]) |
|
|
|
->setMethods(['getApps']) |
|
|
|
->setMethods(['getApps']) |
|
|
|
->getMock(); |
|
|
|
->getMock(); |
|
|
@ -221,6 +234,7 @@ class ManagerTest extends TestCase { |
|
|
|
$this->subscriptionRegistry, |
|
|
|
$this->subscriptionRegistry, |
|
|
|
$this->logger, |
|
|
|
$this->logger, |
|
|
|
$this->coordinator, |
|
|
|
$this->coordinator, |
|
|
|
|
|
|
|
$this->richTextFormatter, |
|
|
|
]) |
|
|
|
]) |
|
|
|
->setMethods(['getApps']) |
|
|
|
->setMethods(['getApps']) |
|
|
|
->getMock(); |
|
|
|
->getMock(); |
|
|
|