@@ -26,6 +26,7 @@ namespace OCA\Deck\Activity;
|
||||
use OC\Activity\Event;
|
||||
use OCA\Deck\Db\Acl;
|
||||
use OCP\Activity\IEvent;
|
||||
use OCP\Comments\ICommentsManager;
|
||||
use OCP\IL10N;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\IUser;
|
||||
@@ -48,6 +49,9 @@ class DeckProviderTest extends TestCase {
|
||||
/** @var IUserManager|MockObject */
|
||||
private $userManager;
|
||||
|
||||
/** @var ICommentsManager|MockObject */
|
||||
private $commentsManager;
|
||||
|
||||
/** @var string */
|
||||
private $userId = 'admin';
|
||||
|
||||
@@ -56,7 +60,8 @@ class DeckProviderTest extends TestCase {
|
||||
$this->urlGenerator = $this->createMock(IURLGenerator::class);
|
||||
$this->activityManager = $this->createMock(ActivityManager::class);
|
||||
$this->userManager = $this->createMock(IUserManager::class);
|
||||
$this->provider = new DeckProvider($this->urlGenerator, $this->activityManager, $this->userManager, $this->userId);
|
||||
$this->commentsManager = $this->createMock(ICommentsManager::class);
|
||||
$this->provider = new DeckProvider($this->urlGenerator, $this->activityManager, $this->userManager, $this->commentsManager, $this->userId);
|
||||
}
|
||||
|
||||
private function mockEvent($objectType, $objectId, $objectName, $subject, $subjectParameters = []) {
|
||||
|
||||
@@ -81,7 +81,8 @@ class CardTest extends TestCase {
|
||||
'attachments' => null,
|
||||
'attachmentCount' => null,
|
||||
'assignedUsers' => null,
|
||||
'deletedAt' => 0
|
||||
'deletedAt' => 0,
|
||||
'commentsUnread' => 0,
|
||||
], $card->jsonSerialize());
|
||||
}
|
||||
public function testJsonSerializeLabels() {
|
||||
@@ -104,7 +105,8 @@ class CardTest extends TestCase {
|
||||
'attachments' => null,
|
||||
'attachmentCount' => null,
|
||||
'assignedUsers' => null,
|
||||
'deletedAt' => 0
|
||||
'deletedAt' => 0,
|
||||
'commentsUnread' => 0,
|
||||
], $card->jsonSerialize());
|
||||
}
|
||||
|
||||
@@ -137,7 +139,8 @@ class CardTest extends TestCase {
|
||||
'attachments' => null,
|
||||
'attachmentCount' => null,
|
||||
'assignedUsers' => ['user1'],
|
||||
'deletedAt' => 0
|
||||
'deletedAt' => 0,
|
||||
'commentsUnread' => 0,
|
||||
], $card->jsonSerialize());
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ use OCA\Deck\NotFoundException;
|
||||
use OCA\Deck\Notification\NotificationHelper;
|
||||
use OCA\Deck\StatusException;
|
||||
use OCP\Activity\IEvent;
|
||||
use OCP\Comments\ICommentsManager;
|
||||
use Test\TestCase;
|
||||
|
||||
class CardServiceTest extends TestCase {
|
||||
@@ -61,6 +62,8 @@ class CardServiceTest extends TestCase {
|
||||
private $attachmentService;
|
||||
/** @var ActivityManager|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $activityManager;
|
||||
/** @var ICommentsManager|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $commentsManager;
|
||||
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
@@ -74,6 +77,7 @@ class CardServiceTest extends TestCase {
|
||||
$this->assignedUsersMapper = $this->createMock(AssignedUsersMapper::class);
|
||||
$this->attachmentService = $this->createMock(AttachmentService::class);
|
||||
$this->activityManager = $this->createMock(ActivityManager::class);
|
||||
$this->commentsManager = $this->createMock(ICommentsManager::class);
|
||||
$this->cardService = new CardService(
|
||||
$this->cardMapper,
|
||||
$this->stackMapper,
|
||||
@@ -85,6 +89,7 @@ class CardServiceTest extends TestCase {
|
||||
$this->assignedUsersMapper,
|
||||
$this->attachmentService,
|
||||
$this->activityManager,
|
||||
$this->commentsManager,
|
||||
'user1'
|
||||
);
|
||||
}
|
||||
@@ -104,11 +109,11 @@ class CardServiceTest extends TestCase {
|
||||
public function testFind() {
|
||||
$card = new Card();
|
||||
$card->setId(1337);
|
||||
$this->cardMapper->expects($this->once())
|
||||
$this->cardMapper->expects($this->any())
|
||||
->method('find')
|
||||
->with(123)
|
||||
->willReturn($card);
|
||||
$this->assignedUsersMapper->expects($this->once())
|
||||
$this->assignedUsersMapper->expects($this->any())
|
||||
->method('find')
|
||||
->with(1337)
|
||||
->willReturn(['user1', 'user2']);
|
||||
|
||||
Reference in New Issue
Block a user