Skip to content

Commit

Permalink
Revert "test test changes"
Browse files Browse the repository at this point in the history
This reverts commit b5918c0.
  • Loading branch information
dartcafe committed Aug 28, 2023
1 parent b5918c0 commit 31ff2da
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tests/Integration/Command/Share/AddTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ public function testValid(array $input, array $pollData): void {
+ count($pollData['expectedInvitations']['group'] ?? [])
+ count($pollData['expectedInvitations']['email'] ?? []);

$expectedShares = [];
$expectedInvitationShareTokens = [];
foreach ($pollData['expectedInvitations'] ?? [] as $type => $shares) {
foreach ($shares as $userId) {
$expectedInvitationShareTokens[] = $this->getShareToken($pollData['pollId'], $type, $userId);
}
}

$this->pollMapper
->expects($this->once())
Expand All @@ -112,23 +117,21 @@ public function testValid(array $input, array $pollData): void {
->expects($this->exactly($expectedShareCount))
->method('add')
->with($pollData['pollId'], $this->logicalOr(User::TYPE, Group::TYPE, Email::TYPE), $this->anything())
->willReturnCallback(function (int $pollId, string $type, string $userId = '') use ($pollData, &$expectedShares): Share {
->willReturnCallback(function (int $pollId, string $type, string $userId = '') use ($pollData): Share {
$userIdConstraint = $this->logicalOr(...$pollData['expectedShares'][$type] ?? []);
$userIdConstraint->evaluate($userId);

if (in_array($userId, $pollData['initialShares'][$type] ?? [])) {
throw new ShareAlreadyExistsException();
}

$share = $this->createShareMock($pollId, $type, $userId);
$expectedShares[] = $share;
return $share;
return $this->createShareMock($pollId, $type, $userId);
});

$this->shareService
->expects($this->exactly($expectedInvitationCount))
->method('sendInvitation')
->with($this->logicalOr(...$expectedShares));
->with($this->logicalOr(...$expectedInvitationShareTokens));

$command = new Add(
$this->pollMapper,
Expand Down

0 comments on commit 31ff2da

Please sign in to comment.