fix: generate fixed link for activity emails

Signed-off-by: Luka Trovic <luka@nextcloud.com>

fix: generate fixed link for activity emails

Signed-off-by: Luka Trovic <luka@nextcloud.com>

Fix tests

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Luka Trovic
2022-02-28 10:39:04 +01:00
committed by backportbot[bot]
parent 18babccfe1
commit 2d8bb1e654
9 changed files with 104 additions and 10 deletions

View File

@@ -38,6 +38,7 @@ use OCP\L10N\IFactory;
use OCP\RichObjectStrings\IValidator;
use PHPUnit\Framework\TestCase;
use PHPUnit_Framework_MockObject_MockObject as MockObject;
use OCA\Deck\Service\CardService;
class DeckProviderTest extends TestCase {
@@ -56,6 +57,9 @@ class DeckProviderTest extends TestCase {
/** @var ICommentsManager|MockObject */
private $commentsManager;
/** @var CardService|MockObject */
private $cardService;
/** @var string */
private $userId = 'admin';
@@ -67,7 +71,9 @@ class DeckProviderTest extends TestCase {
$this->commentsManager = $this->createMock(ICommentsManager::class);
$this->l10nFactory = $this->createMock(IFactory::class);
$this->config = $this->createMock(IConfig::class);
$this->provider = new DeckProvider($this->urlGenerator, $this->activityManager, $this->userManager, $this->commentsManager, $this->l10nFactory, $this->config, $this->userId);
$this->config = $this->createMock(IConfig::class);
$this->cardService = $this->createMock(CardService::class);
$this->provider = new DeckProvider($this->urlGenerator, $this->activityManager, $this->userManager, $this->commentsManager, $this->l10nFactory, $this->config, $this->userId, $this->cardService);
}
private function mockEvent($objectType, $objectId, $objectName, $subject, $subjectParameters = []) {

View File

@@ -42,6 +42,7 @@ use OCP\IUser;
use OCP\IUserManager;
use OCP\IGroupManager;
use \Test\TestCase;
use OCP\IURLGenerator;
class BoardServiceTest extends TestCase {
@@ -74,6 +75,8 @@ class BoardServiceTest extends TestCase {
/** @var IEventDispatcher */
private $eventDispatcher;
private $userId = 'admin';
/** @var IURLGenerator */
private $urlGenerator;
public function setUp(): void {
parent::setUp();
@@ -91,6 +94,7 @@ class BoardServiceTest extends TestCase {
$this->activityManager = $this->createMock(ActivityManager::class);
$this->changeHelper = $this->createMock(ChangeHelper::class);
$this->eventDispatcher = $this->createMock(IEventDispatcher::class);
$this->urlGenerator = $this->createMock(IURLGenerator::class);
$this->service = new BoardService(
$this->boardMapper,
@@ -107,6 +111,7 @@ class BoardServiceTest extends TestCase {
$this->activityManager,
$this->eventDispatcher,
$this->changeHelper,
$this->urlGenerator,
$this->userId
);

View File

@@ -43,6 +43,7 @@ use OCP\IUserManager;
use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Test\TestCase;
use OCP\IURLGenerator;
class CardServiceTest extends TestCase {
@@ -76,6 +77,9 @@ class CardServiceTest extends TestCase {
/** @var ChangeHelper|MockObject */
private $changeHelper;
/** @var IURLGenerator|MockObject */
private $urlGenerator;
public function setUp(): void {
parent::setUp();
$this->cardMapper = $this->createMock(CardMapper::class);
@@ -92,6 +96,7 @@ class CardServiceTest extends TestCase {
$this->userManager = $this->createMock(IUserManager::class);
$this->eventDispatcher = $this->createMock(IEventDispatcher::class);
$this->changeHelper = $this->createMock(ChangeHelper::class);
$this->urlGenerator = $this->createMock(IURLGenerator::class);
$this->cardService = new CardService(
$this->cardMapper,
$this->stackMapper,
@@ -107,6 +112,7 @@ class CardServiceTest extends TestCase {
$this->userManager,
$this->changeHelper,
$this->eventDispatcher,
$this->urlGenerator,
'user1'
);
}

View File

@@ -24,32 +24,56 @@
namespace OCA\Deck\Controller;
use OCA\Deck\Db\CardMapper;
use OCA\Deck\Service\CardService;
use OCA\Deck\Service\ConfigService;
use OCA\Deck\Service\PermissionService;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IInitialStateService;
use OCP\IL10N;
use OCP\IRequest;
use OCP\IURLGenerator;
use PHPUnit\Framework\TestCase;
class PageControllerTest extends \Test\TestCase {
class PageControllerTest extends TestCase {
private $controller;
private $request;
private $l10n;
private $permissionService;
private $initialState;
private $configService;
private $eventDispatcher;
/**
* @var mixed|CardMapper|\PHPUnit\Framework\MockObject\MockObject
*/
private $cardMapper;
/**
* @var mixed|IURLGenerator|\PHPUnit\Framework\MockObject\MockObject
*/
private $urlGenerator;
/**
* @var mixed|CardService|\PHPUnit\Framework\MockObject\MockObject
*/
private $cardService;
public function setUp(): void {
$this->l10n = $this->createMock(IL10N::class);
$this->request = $this->createMock(IRequest::class);
$this->permissionService = $this->createMock(PermissionService::class);
$this->configService = $this->createMock(ConfigService::class);
$this->initialState = $this->createMock(IInitialStateService::class);
$this->eventDispatcher = $this->createMock(IEventDispatcher::class);
$this->cardMapper = $this->createMock(CardMapper::class);
$this->urlGenerator = $this->createMock(IURLGenerator::class);
$this->cardService = $this->createMock(CardService::class);
$this->controller = new PageController(
'deck', $this->request, $this->permissionService, $this->initialState, $this->configService, $this->eventDispatcher
'deck',
$this->request,
$this->permissionService,
$this->initialState,
$this->configService,
$this->eventDispatcher,
$this->cardMapper,
$this->urlGenerator,
$this->cardService
);
}