diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-08-02 16:27:52 +0300 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-08-02 16:27:52 +0300 |
commit | 539162ba8ba7f8d1902310000b8ce2284f2124fd (patch) | |
tree | 7341561dbcc7b44a9320b0060d31c6d194e3694a /tests | |
parent | e750137a9ae695f2d9daa5188bf66709da1561fc (diff) |
Remove at matchers from tests in:fix/remove-at-matchers-in-tests
* apps/oauth2
* tests/Test/Repair/Owncloud
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'tests')
3 files changed, 45 insertions, 56 deletions
diff --git a/tests/Test/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php b/tests/Test/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php index 8ecef60c35d..3c15d51fd61 100644 --- a/tests/Test/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php +++ b/tests/Test/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php @@ -107,12 +107,12 @@ class CleanPreviewsBackgroundJobTest extends TestCase { $this->equalTo(['uid' => 'myuid']) ); - $this->logger->expects($this->at(0)) + $this->logger->expects($this->exactly(2)) ->method('info') - ->with($this->equalTo('Started preview cleanup for myuid')); - $this->logger->expects($this->at(1)) - ->method('info') - ->with($this->equalTo('New preview cleanup scheduled for myuid')); + ->withConsecutive( + [$this->equalTo('Started preview cleanup for myuid')], + [$this->equalTo('New preview cleanup scheduled for myuid')], + ); $this->job->run(['uid' => 'myuid']); } @@ -146,12 +146,12 @@ class CleanPreviewsBackgroundJobTest extends TestCase { $this->jobList->expects($this->never()) ->method('add'); - $this->logger->expects($this->at(0)) - ->method('info') - ->with($this->equalTo('Started preview cleanup for myuid')); - $this->logger->expects($this->at(1)) + $this->logger->expects($this->exactly(2)) ->method('info') - ->with($this->equalTo('Preview cleanup done for myuid')); + ->withConsecutive( + [$this->equalTo('Started preview cleanup for myuid')], + [$this->equalTo('Preview cleanup done for myuid')], + ); $thumbnailFolder->expects($this->once()) ->method('delete'); @@ -165,12 +165,12 @@ class CleanPreviewsBackgroundJobTest extends TestCase { ->with($this->equalTo('myuid')) ->willThrowException(new NotFoundException()); - $this->logger->expects($this->at(0)) - ->method('info') - ->with($this->equalTo('Started preview cleanup for myuid')); - $this->logger->expects($this->at(1)) + $this->logger->expects($this->exactly(2)) ->method('info') - ->with($this->equalTo('Preview cleanup done for myuid')); + ->withConsecutive( + [$this->equalTo('Started preview cleanup for myuid')], + [$this->equalTo('Preview cleanup done for myuid')], + ); $this->job->run(['uid' => 'myuid']); } @@ -189,12 +189,12 @@ class CleanPreviewsBackgroundJobTest extends TestCase { ->with($this->equalTo('thumbnails')) ->willThrowException(new NotFoundException()); - $this->logger->expects($this->at(0)) - ->method('info') - ->with($this->equalTo('Started preview cleanup for myuid')); - $this->logger->expects($this->at(1)) + $this->logger->expects($this->exactly(2)) ->method('info') - ->with($this->equalTo('Preview cleanup done for myuid')); + ->withConsecutive( + [$this->equalTo('Started preview cleanup for myuid')], + [$this->equalTo('Preview cleanup done for myuid')], + ); $this->job->run(['uid' => 'myuid']); } @@ -229,12 +229,12 @@ class CleanPreviewsBackgroundJobTest extends TestCase { $this->jobList->expects($this->never()) ->method('add'); - $this->logger->expects($this->at(0)) + $this->logger->expects($this->exactly(2)) ->method('info') - ->with($this->equalTo('Started preview cleanup for myuid')); - $this->logger->expects($this->at(1)) - ->method('info') - ->with($this->equalTo('Preview cleanup done for myuid')); + ->withConsecutive( + [$this->equalTo('Started preview cleanup for myuid')], + [$this->equalTo('Preview cleanup done for myuid')], + ); $thumbnailFolder->expects($this->once()) ->method('delete') diff --git a/tests/Test/Repair/Owncloud/CleanPreviewsTest.php b/tests/Test/Repair/Owncloud/CleanPreviewsTest.php index abd166057be..7a6c374a2d7 100644 --- a/tests/Test/Repair/Owncloud/CleanPreviewsTest.php +++ b/tests/Test/Repair/Owncloud/CleanPreviewsTest.php @@ -79,18 +79,17 @@ class CleanPreviewsTest extends TestCase { $function($user2); })); - $this->jobList->expects($this->at(0)) + $this->jobList->expects($this->exactly(2)) ->method('add') - ->with( - $this->equalTo(CleanPreviewsBackgroundJob::class), - $this->equalTo(['uid' => 'user1']) - ); - - $this->jobList->expects($this->at(1)) - ->method('add') - ->with( - $this->equalTo(CleanPreviewsBackgroundJob::class), - $this->equalTo(['uid' => 'user2']) + ->withConsecutive( + [ + $this->equalTo(CleanPreviewsBackgroundJob::class), + $this->equalTo(['uid' => 'user1']) + ], + [ + $this->equalTo(CleanPreviewsBackgroundJob::class), + $this->equalTo(['uid' => 'user2']) + ], ); $this->config->expects($this->once()) diff --git a/tests/Test/Repair/Owncloud/UpdateLanguageCodesTest.php b/tests/Test/Repair/Owncloud/UpdateLanguageCodesTest.php index 3b0b2f57f5f..b5d339eef2f 100644 --- a/tests/Test/Repair/Owncloud/UpdateLanguageCodesTest.php +++ b/tests/Test/Repair/Owncloud/UpdateLanguageCodesTest.php @@ -96,27 +96,17 @@ class UpdateLanguageCodesTest extends TestCase { /** @var IOutput|\PHPUnit_Framework_MockObject_MockObject $outputMock */ $outputMock = $this->createMock(IOutput::class); - $outputMock->expects($this->at(0)) + $outputMock->expects($this->exactly(7)) ->method('info') - ->with('Changed 1 setting(s) from "bg_BG" to "bg" in preferences table.'); - $outputMock->expects($this->at(1)) - ->method('info') - ->with('Changed 0 setting(s) from "cs_CZ" to "cs" in preferences table.'); - $outputMock->expects($this->at(2)) - ->method('info') - ->with('Changed 1 setting(s) from "fi_FI" to "fi" in preferences table.'); - $outputMock->expects($this->at(3)) - ->method('info') - ->with('Changed 0 setting(s) from "hu_HU" to "hu" in preferences table.'); - $outputMock->expects($this->at(4)) - ->method('info') - ->with('Changed 0 setting(s) from "nb_NO" to "nb" in preferences table.'); - $outputMock->expects($this->at(5)) - ->method('info') - ->with('Changed 0 setting(s) from "sk_SK" to "sk" in preferences table.'); - $outputMock->expects($this->at(6)) - ->method('info') - ->with('Changed 2 setting(s) from "th_TH" to "th" in preferences table.'); + ->withConsecutive( + ['Changed 1 setting(s) from "bg_BG" to "bg" in preferences table.'], + ['Changed 0 setting(s) from "cs_CZ" to "cs" in preferences table.'], + ['Changed 1 setting(s) from "fi_FI" to "fi" in preferences table.'], + ['Changed 0 setting(s) from "hu_HU" to "hu" in preferences table.'], + ['Changed 0 setting(s) from "nb_NO" to "nb" in preferences table.'], + ['Changed 0 setting(s) from "sk_SK" to "sk" in preferences table.'], + ['Changed 2 setting(s) from "th_TH" to "th" in preferences table.'], + ); $this->config->expects($this->once()) ->method('getSystemValue') |