Skip to content

Commit

Permalink
Remove deprecated method usage
Browse files Browse the repository at this point in the history
sebastianbergmann/phpunit#5062

Signed-off-by: Vitor Mattos <vitor@php.rio>
  • Loading branch information
vitormattos committed Sep 13, 2023
1 parent fb18945 commit 18e1f0b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions tests/Unit/Handler/Pkcs12HandlerTest.php
Expand Up @@ -53,7 +53,7 @@ public function testSavePfxWhenPfxFileIsAFolder() {
$node->method('get')->will($this->returnValue($node));
$this->folderService->method('getFolder')->will($this->returnValue($node));

$this->expectErrorMessage('path signature.pfx already exists and is not a file!');
$this->expectExceptionMessage('path signature.pfx already exists and is not a file!');
$this->pkcs12Handler->savePfx('userId', 'content');
}

Expand All @@ -72,7 +72,7 @@ public function testGetPfxWithInvalidPfx() {
$node = $this->createMock(\OCP\Files\Folder::class);
$node->method('nodeExists')->will($this->returnValue(false));
$this->folderService->method('getFolder')->will($this->returnValue($node));
$this->expectErrorMessage('Password to sign not defined. Create a password to sign');
$this->expectExceptionMessage('Password to sign not defined. Create a password to sign');
$this->expectExceptionCode(400);
$this->pkcs12Handler->getPfx('userId');
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Service/AccountServiceTest.php
Expand Up @@ -384,7 +384,7 @@ public function testCreateToSignWithErrorInSendingEmail() {
$this->newUserMail->method('sendMail')->will($this->returnCallback(function () {
throw new \Exception("Error Processing Request", 1);
}));
$this->expectErrorMessage('Unable to send the invitation');
$this->expectExceptionMessage('Unable to send the invitation');
$this->getService()->createToSign('uuid', 'username', 'passwordOfUser', 'passwordToSign');
}

Expand Down
3 changes: 1 addition & 2 deletions tests/Unit/Service/FolderServiceTest.php
Expand Up @@ -29,7 +29,7 @@ public function testGetFolderWithInvalidNodeId() {
$l10n,
171
);
$this->expectErrorMessage('Invalid node');
$this->expectExceptionMessage('Invalid node');
$service->getFolder(171);
}

Expand All @@ -51,7 +51,6 @@ public function testGetFolderWithValidNodeId() {
$l10n,
1
);
$this->getExpectedExceptionMessage('Invalid node');
$actual = $service->getFolder(171);
$this->assertInstanceOf(\OCP\Files\Folder::class, $actual);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Service/PdfParseServiceTest.php
Expand Up @@ -34,7 +34,7 @@ private function getService(): PdfParserService {
*/
public function testGetMetadataWithFail(string $path, string $errorMessage): void {
$this->expectException(LibresignException::class);
$this->expectErrorMessageMatches($errorMessage);
$this->expectExceptionMessageMatches($errorMessage);
$file = $this->createMock(File::class);
if (file_exists($path)) {
$file->method('getContent')
Expand Down
6 changes: 3 additions & 3 deletions tests/Unit/Service/SignFileServiceTest.php
Expand Up @@ -119,7 +119,7 @@ public function testCanDeleteRequestSignatureWhenDocumentAlreadySigned() {
['getSigned', [], '2021-01-01 01:01:01'],
]));
$this->fileUserMapper->method('getByFileUuid')->will($this->returnValue([$fileUser]));
$this->expectErrorMessage('Document already signed');
$this->expectExceptionMessage('Document already signed');
$this->getService()->canDeleteRequestSignature(['uuid' => 'valid']);
}

Expand All @@ -139,7 +139,7 @@ public function testCanDeleteRequestSignatureWhenNoSignatureWasRequested() {
['getEmail', [], 'otheremail@test.coop']
]));
$this->fileUserMapper->method('getByFileUuid')->will($this->returnValue([$fileUser]));
$this->expectErrorMessage('No signature was requested to %');
$this->expectExceptionMessage('No signature was requested to %');
$this->getService()->canDeleteRequestSignature([
'uuid' => 'valid',
'users' => [
Expand All @@ -161,7 +161,7 @@ public function testNotifyCallback() {
}

public function testSignWithFileNotFound() {
$this->expectErrorMessage('File not found');
$this->expectExceptionMessage('File not found');

$this->createUser('username', 'password');

Expand Down

0 comments on commit 18e1f0b

Please sign in to comment.