Skip to content

Commit

Permalink
fix: phpunit
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ <[email protected]>
  • Loading branch information
skjnldsv committed Feb 13, 2024
1 parent ce50c7d commit 97a416e
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ public function testCreateAlreadyShared() {
try {
$this->provider->create($share);
} catch (\Exception $e) {
$this->assertEquals('Sharing myFile failed, because this item is already shared with account [email protected]', $e->getMessage());
$this->assertEquals('Sharing myFile failed, because this item is already shared with the account [email protected]', $e->getMessage());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1679,7 +1679,7 @@ public function testCreateShareInvalidPermissions() {

public function testCreateShareUserNoShareWith() {
$this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
$this->expectExceptionMessage('Please specify a valid person to share with');
$this->expectExceptionMessage('Please specify a valid account to share with');

$share = $this->newShare();
$this->shareManager->method('newShare')->willReturn($share);
Expand Down Expand Up @@ -1707,7 +1707,7 @@ public function testCreateShareUserNoShareWith() {

public function testCreateShareUserNoValidShareWith() {
$this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
$this->expectExceptionMessage('Please specify a valid person to share with');
$this->expectExceptionMessage('Please specify a valid account to share with');

$share = $this->newShare();
$this->shareManager->method('newShare')->willReturn($share);
Expand Down
4 changes: 2 additions & 2 deletions apps/sharebymail/lib/ShareByMailProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ public function create(IShare $share): IShare {
*/
$alreadyShared = $this->getSharedWith($shareWith, IShare::TYPE_EMAIL, $share->getNode(), 1, 0);
if (!empty($alreadyShared)) {
$message = 'Sharing %1$s failed, because this item is already shared with account %2$s';
$message_t = $this->l->t('Sharing %1$s failed, because this item is already shared with account %2$s', [$share->getNode()->getName(), $shareWith]);
$message = 'Sharing %1$s failed, because this item is already shared with the account %2$s';
$message_t = $this->l->t('Sharing %1$s failed, because this item is already shared with the account %2$s', [$share->getNode()->getName(), $shareWith]);
$this->logger->debug(sprintf($message, $share->getNode()->getName(), $shareWith), ['app' => 'Federated File Sharing']);
throw new \Exception($message_t);
}
Expand Down
2 changes: 1 addition & 1 deletion core/Controller/ProfileApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function __construct(
* @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
* @throws OCSBadRequestException Updating visibility is not possible
* @throws OCSForbiddenException Not allowed to edit other users visibility
* @throws OCSNotFoundException User not found
* @throws OCSNotFoundException Account not found
*
* 200: Visibility updated successfully
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/private/Share20/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ protected function userCreateChecks(IShare $share) {

// Identical share already exists
if ($existingShare->getSharedWith() === $share->getSharedWith() && $existingShare->getShareType() === $share->getShareType()) {
$message = $this->l->t('Sharing %s failed, because this item is already shared with account %s', [$share->getNode()->getName(), $share->getSharedWithDisplayName()]);
$message = $this->l->t('Sharing %s failed, because this item is already shared with the account %s', [$share->getNode()->getName(), $share->getSharedWithDisplayName()]);
throw new AlreadySharedException($message, $existingShare);
}

Expand All @@ -589,7 +589,7 @@ protected function userCreateChecks(IShare $share) {
$user = $this->userManager->get($share->getSharedWith());

if ($group->inGroup($user) && $existingShare->getShareOwner() !== $share->getShareOwner()) {
$message = $this->l->t('Sharing %s failed, because this item is already shared with account %s', [$share->getNode()->getName(), $share->getSharedWithDisplayName()]);
$message = $this->l->t('Sharing %s failed, because this item is already shared with the account %s', [$share->getNode()->getName(), $share->getSharedWithDisplayName()]);
throw new AlreadySharedException($message, $existingShare);
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Controller/OCSControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public function testGetIdentityProofWithNotExistingUser() {
->with('NotExistingUser')
->willReturn(null);

$expected = new DataResponse(['User not found'], 404);
$expected = new DataResponse(['Account not found'], 404);
$this->assertEquals($expected, $this->controller->getIdentityProof('NotExistingUser'));
}

Expand Down
4 changes: 2 additions & 2 deletions tests/lib/Share20/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1618,7 +1618,7 @@ public function testUserCreateChecksShareWithGroupMembersOnlySharedGroup() {

public function testUserCreateChecksIdenticalShareExists() {
$this->expectException(AlreadySharedException::class);
$this->expectExceptionMessage('Sharing name.txt failed, because this item is already shared with account user');
$this->expectExceptionMessage('Sharing name.txt failed, because this item is already shared with the account user');

$share = $this->manager->newShare();
$share->setSharedWithDisplayName('user');
Expand Down Expand Up @@ -1647,7 +1647,7 @@ public function testUserCreateChecksIdenticalShareExists() {

public function testUserCreateChecksIdenticalPathSharedViaGroup() {
$this->expectException(AlreadySharedException::class);
$this->expectExceptionMessage('Sharing name2.txt failed, because this item is already shared with account userName');
$this->expectExceptionMessage('Sharing name2.txt failed, because this item is already shared with the account userName');

$share = $this->manager->newShare();

Expand Down

0 comments on commit 97a416e

Please sign in to comment.